Amazon

DVA-C02 Free Practice Questions — Page 18

Question 172

A developer creates an AWS Lambda function that is written in Java. During testing, the Lambda function does not work how the developer expected. The developer wants to use tracing capabilities to troubleshoot the problem. Which AWS service should the developer use to accomplish this goal?

A. AWS Trusted Advisor
B. Amazon CloudWatch
C. AWS X-Ray
D. AWS CloudTrail
Show Answer
Correct Answer: C
Explanation:
AWS X-Ray provides distributed tracing for AWS Lambda functions, including those written in Java. It helps developers trace requests, analyze performance bottlenecks, and debug unexpected behavior by visualizing service interactions and execution details. CloudWatch focuses on logs and metrics, CloudTrail on API auditing, and Trusted Advisor on best-practice checks, not tracing.

Question 173

A company runs an ecommerce application on AWS. The application stores data in an Amazon Aurora database. A developer is adding a caching layer to the application. The caching strategy must ensure that the application always uses the most recent value for each data item. Which caching strategy will meet these requirements?

A. Implement a TTL strategy for every item that is saved in the cache.
B. Implement a write-through strategy for every item that is created and updated.
C. Implement a lazy loading strategy for every item that is loaded.
D. Implement a read-through strategy for every item that is loaded.
Show Answer
Correct Answer: B
Explanation:
The requirement is that the application always uses the most recent value. A write-through caching strategy updates the cache at the same time as the database on every create or update, ensuring the cache never becomes stale. TTL, lazy loading, and read-through strategies can all allow outdated values to be served until expiration or reload, so they do not guarantee the most recent data.

Question 174

A company hosts its application in the us-west-1 Region. The company wants to add redundancy in the us-east-1 Region. The application secrets are stored in AWS Secrets Manager in us-west-1. A developer needs to replicate the secrets to us-east-1. Which solution will meet this requirement?

A. Configure secret replication for each secret. Add us-east-1 as a replication Region. Choose an AWS Key Management Service (AWS KMS) key in us-east-1 to encrypt the replicated secrets.
B. Create a new secret in us-east-1 for each secret. Configure secret replication in us-east-1. Set the source to be the corresponding secret in us-west-1. Choose an AWS Key Management Service (AWS KMS) key in us-west-1 to encrypt the replicated secrets.
C. Create a replication rule for each secret. Set us-east-1 as the destination Region. Configure the rule to run during secret rotation. Choose an AWS Key Management Service (AWS KMS) key in us-east-1 to encrypt the replicated secrets.
D. Create a Secrets Manager lifecycle rule to replicate each secret to a new Amazon S3 bucket in us-west-1. Configure an S3 replication rule to replicate the secrets to us-east-1.
Show Answer
Correct Answer: A
Explanation:
AWS Secrets Manager natively supports cross-Region secret replication. By configuring replication on each secret in us-west-1 and adding us-east-1 as a replica Region, Secrets Manager automatically keeps the secrets synchronized. Replicated secrets must be encrypted with an AWS KMS key in the destination Region, which is exactly what option A describes. The other options describe unsupported mechanisms or unnecessary workarounds.

Question 175

A developer needs to modify an application architecture to meet new functional requirements. Application data is stored in Amazon DynamoDB and processed for analysis in a nightly batch. The system analysts do not want to wait until the next day to view the processed data and have asked to have it available in near-real time. Which application architecture pattern would enable the data to be processed as it is received?

A. Event driven
B. Client-server driven
C. Fan-out driven
D. Schedule driven
Show Answer
Correct Answer: A
Explanation:
An event-driven architecture processes data as events occur, rather than waiting for a scheduled batch. By reacting to DynamoDB data changes in near real time (for example, via streams or event notifications), the system can process and analyze data immediately as it is received, meeting the requirement for near-real-time availability.

Question 176

A company is working on a new serverless application. A developer needs to find an automated way to deploy AWS Lambda functions and the dependent infrastructure with minimum coding effort. The application also needs to be reliable. Which method will meet these requirements with the LEAST operational overhead?

A. Build the application by using shell scripts to create .zip files for each Lambda function. Manually upload the .zip files to the AWS Management Console.
B. Build the application by using the AWS Serverless Application Model (AWS SAM). Use a continuous integration and continuous delivery (CI/CD) pipeline and the SAM CLI to deploy the Lambda functions.
C. Build the application by using shell scripts to create .zip files for each Lambda function. Upload the .zip files. Deploy the .zip files as Lambda functions by using the AWS CLI in a continuous integration and continuous delivery (CI/CD) pipeline.
D. Build a container for each Lambda function. Store the container images in AWS CodeArtifact. Deploy the containers as Lambda functions by using the AWS CLI in a continuous integration and continuous delivery (CI/CD) pipeline.
Show Answer
Correct Answer: B
Explanation:
AWS SAM is purpose-built for serverless applications and provides infrastructure as code, automated packaging and deployment, and native support for Lambda and related services. Using SAM with a CI/CD pipeline and the SAM CLI minimizes custom scripting, reduces operational overhead, and improves reliability compared with manual zip uploads, custom shell scripts, or container-based approaches that add unnecessary complexity.

Question 177

A developer has written a distributed application that uses microservices. The microservices are running on Amazon EC2 instances. Because of message volume, the developer is unable to match log output from each microservice to a specific transaction. The developer needs to analyze the message flow to debug the application. Which combination of steps should the developer take to meet this requirement? (Choose two.)

A. Download the AWS X-Ray daemon. Install the daemon on an EC2 instance. Ensure that the EC2 instance allows UDP traffic on port 2000.
B. Configure an interface VPC endpoint to allow traffic to reach the global AWS X-Ray daemon on TCP port 2000.
C. Enable AWS X-Ray. Configure Amazon CloudWatch to push logs to X-Ray.
D. Add the AWS X-Ray software development kit (SDK) to the microservices. Use X-Ray to trace requests that each microservice makes.
E. Set up Amazon CloudWatch metric streams to collect streaming data from the microservices.
Show Answer
Correct Answer: A, D
Explanation:
To trace and analyze end-to-end request flows across microservices on EC2, AWS X-Ray must be properly enabled and instrumented. Installing the AWS X-Ray daemon on the EC2 instances is required so trace data can be collected and sent to the X-Ray service (A). In addition, the microservices themselves must be instrumented with the AWS X-Ray SDK so that each request and downstream call is traced and correlated across services (D). Together, these steps allow the developer to follow a single transaction through multiple microservices and debug message flow issues.

Question 178

A developer is creating AWS CloudFormation templates to manage an application's deployment in Amazon Elastic Container Service (Amazon ECS) through AWS CodeDeploy. The developer wants to automatically deploy new versions of the application to a percentage of users before the new version becomes available for all users. How should the developer manage the deployment of the new version?

A. Modify the CloudFormation template to include a Transform section and the AWS::CodeDeploy::BlueGreen hook.
B. Deploy the new version in a new CloudFormation stack. After testing is complete, update the application's DNS records for the new stack.
C. Run CloudFormation stack updates on the application stack to deploy new application versions when they are available.
D. Create a nested stack for the new version. Include a Transform section and the AWS::CodeDeploy::BlueGreen hook.
Show Answer
Correct Answer: A
Explanation:
To deploy a new version to only a percentage of users before full rollout, the developer must use a blue/green deployment strategy with traffic shifting (canary or linear). AWS supports this for ECS through AWS CodeDeploy when the CloudFormation template includes a Transform section and an AWS::CodeDeploy::BlueGreen hook. This enables automated traffic shifting between old and new task sets, allowing partial exposure before full deployment. The other options do not provide controlled, percentage-based traffic shifting managed by CodeDeploy.

Question 179

A developer is designing a fault-tolerant environment where client sessions will be saved. How can the developer ensure that no sessions are lost if an Amazon EC2 instance fails?

A. Use sticky sessions with an Elastic Load Balancer target group.
B. Use Amazon SQS to save session data.
C. Use Amazon DynamoDB to perform scalable session handling.
D. Use Elastic Load Balancer connection draining to stop sending requests to failing instances.
Show Answer
Correct Answer: C
Explanation:
To prevent session loss when an EC2 instance fails, session state must be stored outside the instance. Amazon DynamoDB provides a highly available, durable, and scalable data store that multiple instances can access, ensuring sessions persist across failures. Sticky sessions and connection draining do not protect against instance failure, and SQS is not designed for low-latency session state management.

Question 180

A developer is creating an AWS Lambda function that is invoked by messages to an Amazon Simple Notification Service (Amazon SNS) topic. The messages represent customer data updates from a customer relationship management (CRM) system The developer wants the Lambda function to process only the messages that pertain to email address changes. Additional subscribers to the SNS topic will process any other messages. Which solution will meet these requirements in the LEAST development effort?

A. Use Lambda event filtering to allow only messages that are related to email address changes to invoke the Lambda function.
B. Use an SNS filter policy on the Lambda function subscription to allow only messages that are related to email address changes to invoke the Lambda function.
C. Subscribe an Amazon Simple Queue Service (Amazon SQS) queue to the SNS topic. Configure the SQS queue with a filter policy to allow only messages that are related to email address changes. Connect the SQS queue to the Lambda function.
D. Configure the Lambda code to check the received message. If the message is not related to an email address change, configure the Lambda function to publish the message back to the SNS topic for the other subscribers to process.
Show Answer
Correct Answer: B
Explanation:
Amazon SNS subscription filter policies are designed to route messages to different subscribers based on message attributes before invocation. By applying a filter policy directly on the Lambda subscription, only email address change messages will trigger the function, with no additional infrastructure or code changes. Lambda event filtering does not apply to SNS, and the SQS or code-based approaches add unnecessary complexity.

Question 181

A developer is creating a web application for a school that stores data in Amazon DynamoDB. The ExamScores table has the following attributes: student_id, subject_name, and top_score. Each item in the ExamScores table is identified with student_id as the partition key and subject_name as the sort key. The web application needs to display the student _id for the top scores for each school subject. The developer needs to increase the speed of the queries to retrieve the student_id for the top scorer for each school subject. Which solution will meet these requirements?

A. Create a local secondary index (LSI) with subject_name as the partition key and top_score as the sort key.
B. Create a local secondary index (LSI) with top_score as the partition key and student_id as the sort key.
C. Create a global secondary index (GSI) with subject_name as the partition key and top_score as the sort key.
D. Create a global secondary index (GSI) with subject_name as the partition key and student_id as the sort key.
Show Answer
Correct Answer: C
Explanation:
To efficiently retrieve the top scorer per subject, the application must query by subject and sort by score. A global secondary index (GSI) allows a different partition key from the base table. Using subject_name as the GSI partition key groups all students for a subject together, and using top_score as the sort key allows querying in descending order to quickly fetch the highest score (and its student_id). LSIs cannot change the partition key, and a GSI without top_score as the sort key cannot efficiently find the top scorer.

$19

Get all 555 questions with detailed answers and explanations

  • Instant download HTML + PDF delivered the moment payment clears.
  • Secure Stripe checkout we never see or store your card details.
  • 7-day refund if files are defective see our refund policy.