Amazon

DVA-C02 Free Practice Questions — Page 13

Question 122

A developer is working on an application that will be deployed on AWS. The developer needs to test and debug the code locally. The code is packaged and stored in an Amazon S3 bucket. How can the developer test and debug the code locally with the LEAST amount of configuration?

A. Create an application and a deployment group in AWS CodeDeploy. For the compute platform, specify the local machine as the individual instance for the deployment. For the repository type, specify that the application is stored in Amazon S3. Start the deployment to test on the local machine.
B. Create a repository in AWS CodeArtifact. Publish the application code package to the repository. Before deployment, create an upstream repository to test and validate the code.
C. Create a build project in AWS CodeBuild. In AWS CodePipeline, add a CodeBuild test action by adding a stage and an action. For the action provider, specify a CodeBuild test and the build project. View the build log to see the test results.
D. Install the AWS CodeDeploy agent locally to validate the deployment package. Run the codedeploy-local command. Specify the S3 bucket where the code package is located by using the --bundle-location option.
Show Answer
Correct Answer: D
Explanation:
Option D requires the least configuration because it allows the developer to test and debug the existing AWS CodeDeploy deployment package directly on the local machine. By installing the CodeDeploy agent locally and using the `codedeploy-local` command with the S3 bundle location, the developer can validate scripts and application behavior without setting up additional AWS services, pipelines, repositories, or deployment groups. The other options introduce unnecessary AWS infrastructure and configuration overhead for simple local testing.

Question 123

A developer is creating a database of products. Queries for frequently accessed products must have retrieval times of microseconds. To ensure data consistency, the application cache must be updated whenever products are added, changed, or deleted. Which solution will meet these requirements?

A. Set up an Amazon DynamoDB database and a DynamoDB Accelerator (DAX) cluster.
B. Set up an Amazon RDS database and an Amazon ElastiCache for Redis cluster. Implement a lazy loading caching strategy with ElastiCache.
C. Setup an Amazon DynamoDB database that has an in-memory cache. Implement a lazy loading caching strategy in the application.
D. Set up an Amazon RDS database and an Amazon DynamoDB Accelerator (DAX) cluster. Specify a TTL setting for the DAX cluster.
Show Answer
Correct Answer: A
Explanation:
Amazon DynamoDB Accelerator (DAX) is a fully managed, in-memory cache purpose-built for DynamoDB that delivers microsecond read latency. DAX is tightly integrated with DynamoDB and automatically handles cache updates on item writes, updates, and deletes, ensuring data consistency without custom cache invalidation logic. This directly meets the requirements for microsecond retrieval times and automatic cache updates.

Question 124

A gaming application stores scores for players in an Amazon DynamoDB table that has four attributes: user_id, user_name, user_score, and user_rank. The users are allowed to update their names only. A user is authenticated by web identity federation. Which set of conditions should be added in the policy attached to the role for the dynamodb:PutItem API call?

A.
B.
C.
D.
Show Answer
Correct Answer: A
Explanation:
The policy must ensure that an authenticated user can update only their own item and only the user_name attribute. This is achieved by using the condition key dynamodb:LeadingKeys set to the federated identity’s user_id so the PutItem applies only to that user’s partition key, and dynamodb:Attributes restricted to ["user_name"] so no other attributes (user_score or user_rank) can be modified. Option A is the only choice that enforces both ownership and attribute-level restrictions.

Question 125

A developer hosts a static website on Amazon S3 and connects the website to an Amazon CloudFront distribution. The website uses a custom domain name that points to the CloudFront URL. The developer has set up a continuous integration and continuous delivery (CI/CD) pipeline. The pipeline automatically runs when changes occur in an AWS CodeCommit repository. The pipeline has a source stage and then a build stage. The build stage invokes an AWS CodeBuild project that references a buildspec.yml file. The buildspec.yml file builds the code and deploys the static files to the S3 bucket. The pipeline runs successfully, and the latest website files are visible in the S3 bucket and at the S3 website URL. However, when the developer accesses the website through the CloudFront domain, the updates are not reflected on the website. What should the developer configure the buildspec.yml file to do to resolve this issue?

A. Properly synchronize the objects in the S3 bucket with new files from the source stage.
B. Delete the previous website files in the S3 bucket and redeploy the website files.
C. Invalidate the file caches for the primary CloudFront distribution.
D. Modify the cross-origin resource sharing (CORS) policy of the S3 bucket and redeploy the website files.
Show Answer
Correct Answer: C
Explanation:
CloudFront caches objects and will continue to serve cached versions even after new files are deployed to S3. Since the updates are visible at the S3 website URL but not through CloudFront, the issue is cache staleness. Configuring the buildspec.yml to create a CloudFront invalidation forces CloudFront to fetch the latest content from S3.

Question 126

A company uses AWS to run its learning management system (LMS) application. The application runs on Amazon EC2 instances behind an Application Load Balancer (ALB). The application's domain name is managed in Amazon Route 53. The application is deployed in a single AWS Region, but the company wants to improve application performance for users all over the world. Which solution will improve global performance with the LEAST operational overhead?

A. Set up an Amazon CloudFront distribution that uses the ALB as the origin server. Configure Route 53 to create a DNS alias record that points the application's domain name to the CloudFront distribution URL.
B. Launch more EC2 instances behind the ALConfigure the ALB to use session affinity (sticky sessions). Create a Route 53 alias record for the ALB by using a geolocation routing policy.
C. Create an AWS Client VPN endpoint in the VPInstruct users to connect to the VPN to access the application. Create a Route 53 alias record for the VPN endpoint. Configure Route 53 to use a geolocation routing policy.
D. Deploy the application to multiple Regions across the world. Create a Route 53 alias record for the ALB by using a latency-based routing policy.
Show Answer
Correct Answer: A
Explanation:
Using Amazon CloudFront in front of the existing ALB provides global edge caching and optimized network paths, significantly improving performance for worldwide users with minimal changes. It avoids the operational complexity of multi-Region deployments or custom routing logic while leveraging AWS-managed global infrastructure. The other options add operational overhead or do not meaningfully improve global application performance.

Question 127

A developer is creating a solution to track an account's Amazon S3 buckets over time. The developer has created an AWS Lambda function that will run on a schedule. The function will list the account's S3 buckets and will store the list in an Amazon DynamoDB table. The developer receives a permissions error when the developer runs the function with the AWSLambdaBasicExecutionRole AWS managed policy. Which combination of permissions should the developer use to resolve this error? (Choose two.)

A. Cross-account IAM role
B. Permission for the Lambda function to list buckets in Amazon S3
C. Permission for the Lambda function to write in DynamoDB
D. Permission for Amazon S3 to invoke the Lambda function
E. Permission for DynamoDB to invoke the Lambda function
Show Answer
Correct Answer: B, C
Explanation:
The AWSLambdaBasicExecutionRole only provides permissions for logging to Amazon CloudWatch. To list Amazon S3 buckets, the Lambda execution role must have permission such as s3:ListAllMyBuckets. To store the bucket list, the function must also have permission to write items to the DynamoDB table (for example, dynamodb:PutItem). No cross-account role or service invocation permissions are required.

Question 128

A developer uses Amazon S3 Event Notifications to invoke AWS Lambda functions. The Lambda functions process images after the images are uploaded to S3 buckets. The developer has set up a development S3 bucket, a production S3 bucket, a development Lambda function, and a production Lambda function in the same AWS account. The developer notices that uploads to the development S3 bucket wrongly invoke the production Lambda function. The developer must prevent development data from affecting the production Lambda function. What should the developer do to meet these requirements?

A. Update the execution role for the production Lambda function. Add a policy that allows the execution role to read from only the production S3 bucket.
B. Update the S3 bucket policy for the production S3 bucket to invoke the production Lambda function. Update the S3 bucket policy for the development S3 bucket to invoke the development Lambda function.
C. Separate the development environment and the production environment into their own AWS accounts. Update the execution role for each Lambda function. Add a policy that allows the execution role to read from only the S3 bucket that is in the same account.
D. Separate the development environment and the production environment into their own AWS accounts. Add a resource policy to the Lambda functions to allow only S3 bucket events in the same account to invoke the functions.
Show Answer
Correct Answer: D
Explanation:
The correct solution is to isolate development and production so that events from one cannot invoke resources in the other. Separating the environments into different AWS accounts creates a strong boundary. Adding a Lambda resource-based policy that allows invocation only from S3 buckets in the same account ensures that development S3 events cannot invoke the production Lambda function. Other options either do not control invocation (execution roles), misuse S3 bucket policies, or do not fully prevent cross-environment invocation.

Question 129

A developer is building a microservice that uses AWS Lambda to process messages from an Amazon Simple Queue Service (Amazon SQS) standard queue. The Lambda function calls external APIs to enrich the SQS message data before loading the data into an Amazon Redshift data warehouse. The SQS queue must handle a maximum of 1,000 messages per second. During initial testing, the Lambda function repeatedly inserted duplicate data into the Amazon Redshift table. The duplicate data led to a problem with data analysis. All duplicate messages were submitted to the queue within 1 minute of each other. How should the developer resolve this issue?

A. Create an SQS FIFO queue. Enable message deduplication on the SQS FIFO queue.
B. Reduce the maximum Lambda concurrency that the SQS queue can invoke.
C. Use Lambda's temporary storage to keep track of processed message identifiers
D. Configure a message group ID for every sent message. Enable message deduplication on the SQS standard queue.
Show Answer
Correct Answer: A
Explanation:
Amazon SQS standard queues provide at-least-once delivery, so duplicate messages are expected and can occur within short time windows, which explains the repeated inserts into Amazon Redshift. To resolve this at the messaging layer, the developer should use an SQS FIFO queue with message deduplication enabled. FIFO queues support exactly-once processing semantics within a 5-minute deduplication interval by using a MessageDeduplicationId (or content-based deduplication), which will prevent duplicate messages submitted within 1 minute from being delivered multiple times to the Lambda function. The other options do not guarantee elimination of duplicates at the source.

Question 130

A developer is building various microservices for an application that will run on Amazon EC2 instances. The developer needs to monitor the end-to-end view of the requests between the microservices and debug any issues in the various microservices. What should the developer do to accomplish these tasks?

A. Use Amazon CloudWatch to aggregate the microservices' logs and metrics, and build the monitoring dashboard.
B. Use AWS CloudTrail to aggregate the microservices' logs and metrics, and build the monitoring dashboard.
C. Use the AWS X-Ray SDK to add instrumentation in all the microservices, and monitor using the X-Ray service map.
D. Use AWS Health to monitor the health of all the microservices.
Show Answer
Correct Answer: C
Explanation:
AWS X-Ray is purpose-built for distributed tracing in microservices architectures. By instrumenting each microservice with the X-Ray SDK, the developer can trace requests end-to-end across services, visualize dependencies with the service map, and quickly debug latency, errors, and bottlenecks. CloudWatch focuses on metrics/logs, CloudTrail audits API calls, and AWS Health reports service health, none of which provide end-to-end request tracing.

Question 131

A developer is building an application integrating an Amazon API Gateway with an AWS Lambda function. When calling the API, the developer receives the following error: Wed Nov 08 01:13:00 UTC 2017 : Method completed with status: 502 What should the developer do to resolve the error?

A. Change the HTTP endpoint of the API to an HTTPS endpoint.
B. Change the format of the payload sent to the API Gateway.
C. Change the format of the Lambda function response to the API call.
D. Change the authorization header in the API call to access the Lambda function.
Show Answer
Correct Answer: C
Explanation:
A 502 Bad Gateway error from Amazon API Gateway commonly indicates that the Lambda function returned a response that API Gateway could not parse or map. When using Lambda proxy integration, the function must return a properly formatted JSON response containing fields like statusCode and body. Changing the Lambda function response format to match API Gateway requirements resolves the error.

$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.