DVA-C02 Question Bank · Latest 50 Questions Free Preview (Page 3/5)
Questions 21–30 of the latest 50 DVA-C02 questions (5 pages total), with answers and explanations, no login required. Practice all 1394 questions online.
Question 21 · No. 1365 · Single choice
A developer is using AWS CodeDeploy to launch an application onto Amazon EC2 instances. The application deployment fails during testing. The developer notices an IAM_ROLE_PERMISSIONS error code in Amazon CloudWatch logs. What should the developer do to resolve the error?
- A. Ensure that the deployment group is using the correct role name for the CodeDeploy service role.
- B. Attach the AWSCodeDeployRoleECS policy to the CodeDeploy service role.
- C. Attach the AWSCodeDeployRole policy to the CodeDeploy service role.
- D. Ensure the CodeDeploy agent is installed and running on all instances in the deployment group.
Answer: C
Explanation: The error code IAM_ROLE_PERMISSIONS indicates that the CodeDeploy service role does not have the necessary permissions to perform the deployment. To resolve this, the developer should ensure that the AWSCodeDeployRole policy, which contains the required permissions for deploying applications on EC2 instances, is attached to the CodeDeploy service role.
Question 22 · No. 1366 · Single choice
A team deploys an AWS CloudFormation template to update a stack that already included an Amazon DynamoDB table. However, before the deployment of the update, the team changed the name of the DynamoDB table on the template by mistake. The DeletionPolicy attribute for all resources has the default value. What will be the result of this mistake?
- A. CloudFormation will create a new table and will delete the existing table.
- B. CloudFormation will create a new table and will keep the existing table.
- C. CloudFormation will overwrite the existing table and will rename the existing table.
- D. CloudFormation will keep the existing table and will not create a new table.
Answer: A
Explanation: The default DeletionPolicy in AWS CloudFormation is 'Delete'. When the name of the DynamoDB table is changed in the template, CloudFormation treats it as a replacement of the resource. This means that the existing table will be deleted, and a new table with the new name will be created.
Question 23 · No. 1367 · Single choice
A company is launching a photo sharing application on AWS. Users use the application to upload images to an Amazon S3 bucket. When users upload images, an AWS Lambda function creates thumbnail versions of the images and stores the thumbnail versions in another S3 bucket. During development, a developer notices that the Lambda function takes more than 2 minutes to complete the thumbnail process. The company needs alll images to be processed in less than 30 seconds. What should the developer do to meet these requirements?
- A. Increase the virtual CPUs (vCPUs) for the Lambda function to use 10 vCPUs.
- B. Change Lambda function instance type to use m6a.4xlarge.
- C. Configure the Lambda function to increase the amount of memory.
- D. Configure burstable performance for the Lambda function.
Answer: C
Explanation: The Lambda function's performance is directly tied to the amount of memory allocated to it. When you increase the memory, AWS also proportionally increases the CPU power available to the function. This allows the function to process tasks faster. In this case, increasing the memory will help the Lambda function complete the thumbnail generation process within the required 30 seconds. The other options are either invalid (like increasing vCPUs or changing instance types which aren't configurable for Lambda) or irrelevant (such as burstable performance).
Question 24 · No. 1368 · Single choice
An application that is running on Amazon EC2 instances stores data in an Amazon S3 bucket. All the data must be encrypted in transit. How can a developer ensure that all traffic to the S3 bucket is encrypted?
- A. Install certificates on the EC2 instances.
- B. Create a private VPC endpoint.
- C. Configure the S3 bucket with server-side encryption with AWS KMS managed encryption keys (SSE-KMS).
- D. Create an S3 bucket policy that denies traffic when the value for the aws:SecureTransport condition key is false.
Answer: D
Explanation: The correct answer is D because the requirement is to ensure that all traffic to the S3 bucket is encrypted in transit. An S3 bucket policy can be configured with a condition that denies requests where the aws:SecureTransport key is false, effectively enforcing HTTPS (SSL/TLS) for all communication with the S3 bucket. Options A, B, and C do not directly address encryption in transit: A focuses on installing certificates but does not enforce HTTPS; B creates a private VPC endpoint but does not inherently encrypt traffic; and C enables server-side encryption, which protects data at rest, not in transit.
Question 25 · No. 1369 · Single choice
An AWS Lambda function that handles application requests uses the default Lambda logging mechanism to log the timestamp, processing time, and status of requests. A developer needs to create Amazon CloudWatch metrics based on the logs. The developer needs to write the metrics to a custom CloudWatch metrics namespace. Which solution will meet these requirements?
- A. Use Amazon CloudWatch Logs Insights to generate custom metrics from the logs by using CloudWatch embedded metric format (EMF).
- B. Use Amazon CloudWatch RUM to generate custom metrics from the logs by using CloudWatch embedded metric format (EMF).
- C. Use Amazon CloudWatch Logs Insights to generate custom metrics from the logs by using JSON format.
- D. Use the CloudWatch embedded metric format (EMF) for the structure of the log statements to generate custom CloudWatch metrics.
Answer: D
Explanation: The question requires creating custom Amazon CloudWatch metrics from AWS Lambda logs. The best solution is to use the CloudWatch Embedded Metric Format (EMF) directly in the structure of the log statements generated by the Lambda function. EMF allows you to emit custom metrics directly from your logs without requiring additional tools like CloudWatch Logs Insights or RUM, making it efficient and straightforward.
Question 26 · No. 1370 · Single choice
A company is building a social media application. A developer is modifying an AWS Lambda function that updates a database with data that tracks each user's online activity. A web application server uses the AWS SDK to invoke the Lambda function. The developer has tested the new Lambda code and is ready to deploy the code into production. However, the developer wants to allow only a small percentage of the invocations from the AWS SDK to call the new code. Which solution will meet these requirements?
- A. Configure a Lambda version that has a specific weight value for the updated Lambda function.
- B. Create an alias for the Lambda function. Configure a specific weight value for the updated version.
- C. Create an Application Load Balancer. Specify weighted target groups for the original Lambda function and the updated Lambda function.
- D. Create a Network Load Balancer. Specify weighted target groups for the original Lambda function and the updated Lambda function.
Answer: B
Explanation: The correct solution is to create an alias for the Lambda function and configure a specific weight value for the updated version. Aliases in AWS Lambda allow you to manage different versions of your function and split traffic between them using weights. This capability enables gradual deployment by routing a small percentage of invocations to the new version while the majority still go to the stable version, ensuring controlled testing in production.
Question 27 · No. 1371 · Single choice
A developer published a change to a new version of an AWS Lambda function. To test the change, the developer must route 50% of the traffic to the new version and 60% of the traffic to the current version. What is the MOST operationally efficient way to meet this requirement?
- A. Create two Amazon Route 53 records that use a simple routing policy to route traffic to the different versions of the Lambda function. Create another Route 53 record that uses a weighted routing policy to route 50% of the traffic to each simple routing record. Test the Lambda function by using the weighted routing record.
- B. Create an Amazon API Gateway API with a POST method that is integrated with the Lambda function. Add a stage variable that includes the version of the Lambda function. Add a canary release that will override the version variable 50% of the time. Deploy and test the Lambda function through the API Gateway stage.
- C. Create a Lambda function alias. Set the weight to 50% for the current version and 50% for the new version. Set the event source mappings for the Lambda function to point to the alias.
- D. Update the event source mappings for the Lambda function. In the mappings, set the weight to 50% for the current version and 50% for the new version.
Answer: C
Explanation: The most operationally efficient way to meet the requirement is to use a Lambda function alias. By setting up an alias, you can assign weights to different versions of the Lambda function (50% for the current version and 50% for the new version). This approach eliminates the need for additional services like Route 53 or API Gateway and directly achieves traffic splitting at the Lambda level.
Question 28 · No. 1372 · Single choice
A company has an Amazon DynamoDB table that contains records of users that have signed up for a trial of the company’s product. The company is using a spreadsheet to track data about the product trial. The company needs to ensure the spreadsheet is automatically updated with the latest information when individual trials begin, are updated, or finish. Which solution will meet these requirements?
- A. Create a DynamoDB Accelerator (DAX) cluster from the table. Set the view type to old image. Create an AWS Lambda function that uses the cluster data to update the spreadsheet. Subscribe the Lambda function to the cluster.
- B. Create a DynamoDB Accelerator (DAX) cluster from the table. Set the view type to new image. Create an AWS Lambda function that uses the cluster data to update the spreadsheet. Subscribe the Lambda function to the cluster.
- C. Enable a DynamoDB stream for the table. Set the view type to new image. Create an AWS Lambda function that uses the stream data to update the spreadsheet. Subscribe the Lambda function to the stream.
- D. Enable a DynamoDB stream for the table. Set the view type to old image. Create an AWS Lambda function that uses the stream data to update the spreadsheet. Subscribe the Lambda function to the stream.
Answer: C
Explanation: The correct solution is to enable a DynamoDB stream for the table and set the view type to 'new image'. This ensures that any changes to the table (inserts, updates, or deletions) are captured in the stream. A Lambda function can then process these changes and update the spreadsheet accordingly. DynamoDB streams are specifically designed to capture table activity and propagate it to other services like Lambda, making them ideal for this scenario. Using DynamoDB Accelerator (DAX) as proposed in options A and B is incorrect because DAX is a caching layer for DynamoDB and does not provide real-time notifications of changes.
Question 29 · No. 1373 · Single choice
A developer created an AWS Lambda function named ProcessMessages. The Lambda function is invoked asynchronously when a message is published to an Amazon Simple Notification Service (Amazon SNS) topic named InputTopic. The developer uses a second SNS topic named ErrorTopic to handle alerts of failures for other services. The developer wants to receive notifications from the ErrorTopic SNS topic when the ProcessMessages Lambda function fails to process a message. Which solution will meet this requirement?
- A. Configure a subscription for the ErrorTopic SNS topic. Configure a filter policy for failures. Specify the ProcessMessages Lambda function as the endpoint.
- B. Configure a failure destination for the ProcessMessages Lambda function. Specify the Amazon Resource Name (ARN) of the ErrorTopic SNS topic as the destination ARN.
- C. Configure a trigger for the ProcessMessages Lambda function. Specify the ErrorTopic SNS topic as the trigger topic. Configure a filter policy on the topic for failures
- D. Configure a delivery policy on the ErrorTopic SNS topic. Configure a filter policy for failures. Specify the Lambda function as the input endpoint.
Answer: B
Explanation: The correct solution is to configure a failure destination for the ProcessMessages Lambda function and specify the ARN of the ErrorTopic SNS topic as the destination. This approach ensures that whenever the Lambda function fails to process a message, the error details are automatically sent to the specified SNS topic for further handling or notification. Other options either involve incorrect configurations (like using filter policies on SNS topics or triggers) or do not directly address the requirement of sending failure notifications to the ErrorTopic.
Question 30 · No. 1374 · Multiple choice
A developer is creating an application that uses an AWS Lambda function to transform and load data from an Amazon S3 bucket. When the developer tests the application, the developer finds that some invocations of the Lambda function are slower than others. The developer needs to update the Lambda function to have predictable invocation durations that run with low latency. Any initialization activities, such as loading libraries and instantiating clients, must run during allocation time rather than during actual function invocations. Which combination of steps will meet these requirements? (Choose two.)
- A. Create a schedule group in Amazon EventBridge Scheduler to invoke the Lambda function.
- B. Configure provisioned concurrency for the Lambda function to have the necessary number of execution environments.
- C. Use the $LATEST version of the Lambda function.
- D. Configure reserved concurrency for the Lambda function to have the necessary number of execution environments.
- E. Deploy changes, and publish a new version of the Lambda function.
Answer: B, E
Explanation: The question requires predictable invocation durations and low latency for the Lambda function. To achieve this, initialization activities like loading libraries and instantiating clients should not occur during actual function invocations but instead during allocation time. Option B (configure provisioned concurrency) ensures that the necessary execution environments are pre-initialized, reducing latency during invocation. Option E (publish a new version of the Lambda function) ensures that changes to the function are properly deployed and versioned, which is essential for consistent behavior. Option A is unrelated to solving latency issues, Option C ($LATEST version) is not recommended for production due to unpredictability, and Option D (reserved concurrency) limits scaling but does not address latency.