DVA-C02 Question Bank · Latest 50 Questions Free Preview (Page 5/5)
Questions 41–50 of the latest 50 DVA-C02 questions (5 pages total), with answers and explanations, no login required. Practice all 1394 questions online.
Question 41 · No. 1385 · Single choice
A developer is testing an AWS Lambda function that has an event source of an Amazon Simple Queue Service (Amazon SQS) queue. The developer notices that some of the messages the Lambda function processes re-appear in the queue while the messages are being processed. The developer must correct this behavior. Which solution will meet this requirement?
- A. Increase the timeout of the Lambda function.
- B. Increase the visibility timeout of the SQS queue.
- C. Increase the memory allocation of the Lambda function.
- D. Increase the batch size in the event source mapping.
Answer: B
Explanation: The issue occurs because the Lambda function is taking longer to process messages than the visibility timeout of the SQS queue. When the visibility timeout expires, the message becomes visible again in the queue, even though it is still being processed. To prevent this, the developer should increase the visibility timeout of the SQS queue to ensure that messages remain hidden while they are being processed.
Question 42 · No. 1386 · Single choice
A company is launching a feature that uses an HTTP API built with Amazon API Gateway and AWS Lambda. An API Gateway endpoint performs several independent tasks that run in a Lambda function. The independent tasks can take up to 10 minutes in total to finish running. Users report that the endpoint sometimes returns an HTTP 604 status code. The Lambda function invocations are successful. Which solution will stop the endpoint from returning the HTTP 504 status cade?
- A. Increase the Lambda function’s timeout value.
- B. Increase the reserved concurrency of the Lambda function.
- C. Increase the memory that is available to the Lambda function.
- D. Refactor the Lambda function to start an AWS Step Functions state machine.
Answer: D
Explanation: The HTTP 504 status code indicates a 'Gateway Timeout,' which means the API Gateway did not receive a timely response from the backend (in this case, the Lambda function). Since the Lambda function is taking up to 10 minutes to complete its tasks, and API Gateway has a maximum timeout of 29 seconds, the request times out. To resolve this, the best solution is to refactor the Lambda function to start an AWS Step Functions state machine. This approach allows the long-running tasks to be broken into smaller steps managed by Step Functions, while API Gateway immediately returns a response indicating that the process has started. This design avoids timeouts and fits within the constraints of API Gateway.
Question 43 · No. 1387 · Single choice
A company runs an application on Amazon EC2 instances in an Auto Scaling group. The application experiences variable loads throughout each day. The company needs to collect detailed metrics from the EC2 instances to right-size the instances. The company also wants to monitor custom application metrics to ensure the application is performing efficiently. Which solution will meet these requirements?
- A. Install the AWS X-Ray agent on the instances. Configure the agent to collect the EC2 instance metrics and the custom application metrics.
- B. Install the Amazon CloudWatch agent on the instances. Configure the agent to collect the EC2 instance metrics and the custom application metrics.
- C. Install the AWS SDK in the application’s cade. Update the application to use the AWS SDK to collect and publish the EC2 instance metrics and the custom application metrics.
- D. Configure AWS CloudTrail to capture and analyze the EC2 instance metrics and the custom application metrics.
Answer: B
Explanation: The Amazon CloudWatch agent is the most suitable solution for collecting detailed metrics from EC2 instances and monitoring custom application metrics. It is specifically designed to collect both system-level metrics (like CPU, memory, disk, etc.) and custom application metrics, making it ideal for right-sizing instances and ensuring efficient application performance.
Question 44 · No. 1388 · Single choice
In a move toward using microservices, a company’s management team has asked all development teams to build their services so that API requests depend only on that service’s data store. One team is building a Payments service which has its own database; the service needs data that originates in the Accounts database. Both are using Amazon DynamoDB. What approach will result in the simplest, decoupled, and reliable method to get near-real time updates from the Accounts database?
- A. Use AWS Glue to perform frequent ETL updates from the Accounts database to the Payments database.
- B. Use Amazon ElastiCache in Payments, with the cache updated by triggers in the Accounts database.
- C. Use Amazon Data Firehose to deliver all changes from the Accounts database to the Payments database.
- D. Use Amazon DynamoDB Streams to deliver all changes from the Accounts database to the Payments database.
Answer: D
Explanation: The best approach is to use Amazon DynamoDB Streams to deliver all changes from the Accounts database to the Payments database. DynamoDB Streams is designed to capture table activity continuously and in near-real time, making it ideal for this scenario. It ensures decoupling between the services while providing reliable updates. Other options like AWS Glue, ElastiCache, or Data Firehose either add unnecessary complexity or do not fit as well with the requirements of near-real-time updates and decoupling.
Question 45 · No. 1389 · Single choice
A developer has an application that uses AWS Security Token Service (AWS STS). The application calls the STS AssumeRole API operation to provide trusted users with temporary security credentials. The application calls AWS STS at the service's default endpoint: https://sts.amazonaws.com. The application is deployed in an Asia Pacific AWS Region. The application is experiencing errors that are related to intermittent latency when the application calls AWS STS. What should the developer do to resolve this issue?
- A. Update the application to use the GetSessionToken API operation.
- B. Update the application to use the AssumeRoleWithSAML API operation.
- C. Update the application to use a Regional STS endpoint that is closer to the application deployment.
- D. Update the application to use the AssumeRoleWithWebldentity API operation. Move the STS endpoint to a global endpoint.
Answer: C
Explanation: The application is experiencing latency because it is using the default global STS endpoint (https://sts.amazonaws.com) while being deployed in an Asia Pacific region. AWS STS has Regional endpoints that can reduce latency by processing requests closer to the application's deployment region. Using a Regional endpoint that is geographically closer to the application will resolve the issue.
Question 46 · No. 1390 · Single choice
A developer is building a three-tier application with an Application Load Balancer (ALB), Amazon EC2 instances, and Amazon RDS. There is an alias record in Amazon Route 53 that points to the ALB. When the developer tries to access the ALB from a laptop, the request times out. Which logs should the developer investigate to verify that the request is reaching the AWS network?
- A. VPC Flow Logs
- B. Amazon Route 53 logs
- C. AWS Systems Manager Agent logs
- D. Amazon CloudWatch agent logs
Answer: A
Explanation: The developer should investigate VPC Flow Logs because they capture information about the IP traffic going to and from network interfaces in a VPC. This can help verify whether the request is reaching the AWS network and identify if there are any issues with the routing, security groups, or network ACLs that might be causing the timeout.
Question 47 · No. 1391 · Single choice
An application includes an Amazon DynamoDB table that is named orders. The table has a primary partition key of id and a global secondary index (GSI) that is named an accountIndex. The GSI has a partition key of accountId and a sort key of orderDateTime. A developer needs to create an AWS Lambda function to retrieve the orders that have an accountId of 100. Which solution will meet this requirement by using the LEAST read capacity?
- A. Define a DynamoDB API request for the GetItem action with the following parameters:
- B. Define a DynamoDB API request for the BatchGetItem action with the following parameters:
- C. Define a DynamoDB API request for the Scan action with the following parameters:
- D. Define a DynamoDB API request for the Query action with the following parameters:
Answer: D
Explanation: The Query action is the most efficient way to retrieve items from a DynamoDB table using a Global Secondary Index (GSI). Since the GSI has a partition key of accountId and a sort key of orderDateTime, the developer can specify the accountId value of 100 in the query to retrieve all matching orders. This method uses the least read capacity because it directly accesses the indexed data without scanning the entire table or requiring multiple API calls.
Question 48 · No. 1392 · Single choice
A developer is working on an ecommerce application that stores data in an Amazon RDS for MySQL cluster. The developer needs to implement a caching layer for the application to retrieve information about the most viewed products. Which solution will meet these requirements?
- A. Edit the RDS for MySQL cluster by adding a cache node. Configure the cache endpoint instead of the cluster endpoint in the application.
- B. Create an Amazon ElastiCache for Redis cluster. Update the application code to use the ElastiCache for Redis cluster endpoint.
- C. Create an Amazon DynamoDB Accelerator (DAX) cluster in front of the RDS for MySQL cluster. Configure the application to connect to the DAX endpoint instead of the RDS endpoint.
- D. Configure the RDS for MySQL cluster to add a standby instance in a different Availability Zone. Configure the application to read the data from the standby instance.
Answer: B
Explanation: The best solution for implementing a caching layer in this scenario is to use Amazon ElastiCache for Redis. Redis is specifically designed for caching and can handle high request rates with low latency, making it ideal for retrieving information about the most viewed products. The other options are either not suitable (e.g., DynamoDB Accelerator is for DynamoDB, not RDS) or do not provide a true caching mechanism (e.g., adding a standby instance in RDS is for high availability, not caching).
Question 49 · No. 1393 · Multiple choice
A developer is building an application that will process messages from an Amazon Simple Queue Service (Amazon SQS) standard queue. The application needs to process the messages in an Amazon Elastic Container Service (Amazon ECS) task. Which actions will result in the MOST cost-effective processing of the messages? (Choose two.)
- A. Use long polling to query the queue for new messages.
- B. Use short polling to query the queue for new messages.
- C. Use message batching to retrieve messages from the queue.
- D. Use Amazon ElastiCache to cache messages in the queue.
- E. Use an SQS FIFO queue to manage the messages.
Answer: A, C
Explanation: Long polling (A) reduces the number of empty responses and lowers the cost by minimizing the number of API calls. Message batching (C) allows retrieving multiple messages in a single request, which is more efficient and reduces the overall cost of processing messages from the queue. Short polling (B) can lead to more frequent, unnecessary requests, making it less cost-effective. Using ElastiCache (D) would introduce additional costs and complexity without directly improving the efficiency of SQS message retrieval. Switching to an SQS FIFO queue (E) would add unnecessary cost since the question does not specify a need for message ordering or exactly-once processing.
Question 50 · No. 1394 · Single choice
A developer is updating an Amazon API Gateway REST API to have a mock endpoint. The developer wants to update the integration request mapping template so the endpoint will respond to mock integration requests with specific HTTP status codes based on various conditions. Which statement will meet these requirements?
- A. 请提供需要翻译的英文内容。
- B. 请提供需要翻译的英文内容。
- C. 请提供需要翻译的英文内容。
- D. 请提供需要翻译的英文内容。
Answer: B