Amazon

DVA-C02 Free Practice Questions — Page 19

Question 182

A developer wants the ability to roll back to a previous version of an AWS Lambda function in the event of errors caused by a new deployment. How can the developer achieve this with MINIMAL impact on users?

A. Change the application to use an alias that points to the current version. Deploy the new version of the code. Update the alias to use the newly deployed version. If too many errors are encountered, point the alias back to the previous version.
B. Change the application to use an alias that points to the current version. Deploy the new version of the code. Update the alias to direct 10% of users to the newly deployed version. If too many errors are encountered, send 100% of traffic to the previous version.
C. Do not make any changes to the application. Deploy the new version of the code. If too many errors are encountered, point the application back to the previous version using the version number in the Amazon Resource Name (ARN).
D. Create three aliases: new, existing, and router. Point the existing alias to the current version. Have the router alias direct 100% of users to the existing alias. Update the application to use the router alias. Deploy the new version of the code. Point the new alias to this version. Update the router alias to direct 10% of users to the new alias. If too many errors are encountered, send 100% of traffic to the existing alias.
Show Answer
Correct Answer: B
Explanation:
Option B uses Lambda aliases with weighted traffic shifting (canary deployment). By routing only 10% of traffic to the new version, any errors affect a minimal subset of users, and rollback is immediate by shifting traffic back to the previous version. Option A shifts 100% of users at once, causing higher impact if issues occur. Therefore, B best satisfies rollback capability with minimal user impact.

Question 183

A developer updates an AWS Lambda function that an Amazon API Gateway API uses. The API is the backend for a web application. The developer needs to test the updated Lambda function before deploying the Lambda function to production. The testing must not affect any production users of the web application. Which solution will meet these requirements in the MOST operationally efficient way?

A. Create a canary release deployment for the existing API stage. Deploy the API to the existing stage. Test the updated Lambda function by using the existing URL.
B. Update the API Gateway API endpoint type to private. Deploy the changes to the existing API stage. Test the API by using the existing URL.
C. Create a new test API stage in API Gateway. Add stage variables to deploy the updated Lambda function to only the test stage. Test the updated Lambda function by using the new stage URL.
D. Create a new AWS CloudFormation stack to deploy a copy of the entire production API and Lambda function. Use the stack's API URL to test the updated Lambda function.
Show Answer
Correct Answer: C
Explanation:
Creating a new API Gateway stage allows the developer to route traffic to a different Lambda function version or alias using stage variables. This enables isolated testing with a separate stage URL without impacting production users. It is simpler and more efficient than duplicating the entire stack and avoids exposing production traffic to untested code, unlike canary releases or modifying the existing stage.

Question 184

A developer wrote an application that uses an AWS Lambda function to asynchronously generate short videos based on requests from customers. This video generation can take up to 10 minutes. After the video is generated, a URL to download the video is pushed to the customer's web browser. The customer should be able to access these videos for at least 3 hours after generation. Which solution will meet these requirements?

A. Store the video in the /tmp folder within the Lambda execution environment. Push a Lambda function URL to the customer.
B. Store the video in an Amazon Elastic File System (Amazon EFS) file system attached to the function. Generate a pre-signed URL for the video object and push the URL to the customer.
C. Store the video in Amazon S3. Generate a pre-signed URL for the video object and push the URL to the customer.
D. Store the video in an Amazon CloudFront distribution. Generate a pre-signed URL for the video object and push the URL to the customer.
Show Answer
Correct Answer: C
Explanation:
The video must be accessible for several hours after generation and downloadable via a browser. AWS Lambda /tmp storage is ephemeral and not accessible externally, so option A fails. Amazon EFS is not directly accessible from a browser and does not provide native pre-signed URLs, making option B unsuitable. CloudFront requires an origin such as S3 and is unnecessary for simple time-limited access, making option D overly complex. Amazon S3 is designed for durable object storage and supports pre-signed URLs with time-limited access (e.g., 3 hours), which can be shared directly with customers. Therefore, storing the video in S3 and providing a pre-signed URL meets all requirements.

Question 185

A developer manages an application that writes customer orders to an Amazon DynamoDB table. The orders use customer_id as the partition key, order_id as the sort key, and order_date as an attribute. A new access pattern requires accessing data by order_date and order_id. The developer needs to implement a new AWS Lambda function to support the new access pattern. How should the developer support the new access pattern in the MOST operationally efficient way?

A. Add a new local secondary index (LSI) to the DynamoDB table that specifies order_date as the partition key and order_id as the sort key. Write the new Lambda function to query the new LSI index.
B. Write the new Lambda function to scan the DynamoDB table. In the Lambda function, write a method to retrieve and combine results by order_date and order_id.
C. Add a new global secondary index (GSI) to the DynamoDB table that specifies order_date as the partition key and order_id as the sort key. Write the new Lambda function to query the new GSI index.
D. Enable DynamoDB Streams on the table. Choose the new and old images information to write to the DynamoDB stream. Write the new Lambda function to query the DynamoDB stream
Show Answer
Correct Answer: C
Explanation:
The new access pattern requires querying by attributes (order_date and order_id) that are not part of the table’s primary key. A Global Secondary Index allows defining a completely different partition key and sort key from the base table and can be added after table creation. Querying a GSI is efficient and scalable, making it the most operationally efficient solution. An LSI cannot change the partition key, scans are inefficient, and DynamoDB Streams are not designed for query access patterns.

Question 186

A developer is building an ecommerce application. When there is a sale event, the application needs to concurrently call three third-party systems to record the sale. The developer wrote three AWS Lambda functions. There is one Lambda function for each third-party system, which contains complex integration logic. These Lambda functions are all independent. The developer needs to design the application so each Lambda function will run regardless of others' success or failure. Which solution will meet these requirements?

A. Publish the sale event from the application to an Amazon Simple Queue Service (Amazon SQS) queue. Configure the three Lambda functions to poll the queue.
B. Publish the sale event from the application to an Amazon Simple Notification Service (Amazon SNS) topic. Subscribe the three Lambda functions to be triggered by the SNS topic.
C. Publish the sale event from the application to an Application Load Balancer (ALB). Add the three Lambda functions as ALB targets.
D. Publish the sale event from the application to an AWS Step Functions state machine. Move the logic from the three Lambda functions into the Step Functions state machine.
Show Answer
Correct Answer: B
Explanation:
Amazon SNS supports a fan-out messaging pattern. Publishing the sale event to an SNS topic allows all three Lambda functions to be invoked concurrently and independently. Each Lambda subscription is isolated, so a failure in one Lambda does not affect the execution of the others. This directly meets the requirement for concurrent execution and failure independence.

Question 187

A company that has large online business uses an Amazon DynamoDB table to store sales data. The company enabled Amazon DynamoDB Streams on the table. The transaction status of each sale is stored in a TransactionStatus attribute in the table. The value of the TransactionStatus attribute must be either failed, pending, or completed. The company wants to be notified of failed sales where the Price attribute is above a specific threshold. A developer needs to set up notification for the failed sales. Which solution will meet these requirements with the LEAST development effort?

A. Create an event source mapping between DynamoDB Streams and an AWS Lambda function. Use Lambda event filtering to trigger the Lambda function only if sales fail when the price is above the specified threshold. Configure the Lambda function to publish the data to an Amazon Simple Notification Service (Amazon SNS) topic.
B. Create an event source mapping between DynamoDB Streams and an AWS Lambda function. Configure the Lambda function handler code to publish to an Amazon Simple Notification Service (Amazon SNS) topic if sales fail when price is above the specified threshold.
C. Create an event source mapping between DynamoDB Streams and an Amazon Simple Notification Service (Amazon SNS) topic. Use event filtering to publish to the SNS topic if sales fail when the price is above the specified threshold.
D. Create an Amazon CloudWatch alarm to monitor the DynamoDB Streams sales data. Configure the alarm to publish to an Amazon Simple Notification Service (Amazon SNS) topic if sales fail due when price is above the specified threshold.
Show Answer
Correct Answer: A
Explanation:
Using DynamoDB Streams as an event source for AWS Lambda with event filtering allows the service to invoke the function only when records match specific conditions (TransactionStatus = failed and Price above a threshold). This requires no custom filtering logic in code, minimizes Lambda invocations, and then the Lambda can simply publish matching events to SNS. SNS cannot be directly mapped to DynamoDB Streams with attribute-level filtering, and CloudWatch alarms cannot inspect individual stream records, so those options require more effort or are not feasible.

Question 188

An IAM role is attached to an Amazon EC2 instance that explicitly denies access to all Amazon S3 API actions. The EC2 instance credentials file specifies the IAM access key and secret access key, which allow full administrative access. Given that multiple modes of IAM access are present for this EC2 instance, which of the following is correct?

A. The EC2 instance will only be able to list the S3 buckets.
B. The EC2 instance will only be able to list the contents of one S3 bucket at a time.
C. The EC2 instance will be able to perform all actions on any S3 bucket.
D. The EC2 instance will not be able to perform any S3 action on any S3 bucket.
Show Answer
Correct Answer: C
Explanation:
When multiple credential sources are available on an EC2 instance, the AWS SDK/CLI uses the credential provider chain. Explicit access keys in the credentials file are used before the EC2 instance profile (IAM role). The IAM role’s explicit deny applies only to requests made using that role’s temporary credentials, not to requests signed with separate IAM user access keys. Therefore, with credentials that have full administrative permissions in the credentials file, the instance can perform all S3 actions.

Question 189

A developer is working on an app for a company that uses an Amazon DynamoDB table named Orders to store customer orders. The table uses OrderID as the partition key and there is no sort key. The table contains more than 100,000 records. The developer needs to add a functionality that will retrieve all Orders records that contain an OrderSource attribute with the MobileApp value. Which solution will improve the user experience in the MOST efficient way?

A. Perform a Scan operation on the Orders table. Provide a QueryFilter condition to filter to only the items where the OrderSource attribute is equal to the MobileApp value.
B. Create a local secondary index (LSI) with OrderSource as the partition key. Perform a Query operation by using MobileApp as the key.
C. Create a global secondary index (GSI) with OrderSource as the sort key. Perform a Query operation by using MobileApp as the key.
D. Create a global secondary index (GSI) with OrderSource as the partition key. Perform a Query operation by using MobileApp as the key.
Show Answer
Correct Answer: D
Explanation:
The requirement is to efficiently retrieve all items by a non-key attribute (OrderSource) from a large DynamoDB table. A Scan with a filter (A) is inefficient and slow for large tables. An LSI (B) cannot be added after table creation and also requires a sort key on the base table, which does not exist. A GSI with OrderSource as a sort key (C) would still require a partition key to query, so it would not support querying solely by OrderSource. Creating a GSI with OrderSource as the partition key (D) allows efficient Query operations using MobileApp as the key, which is the most performant and user-friendly solution.

Question 190

A company has an application that uses an AWS Lambda function to process data. A developer must implement encryption in transit for all sensitive configuration data, such as API keys, that is stored in the application. The developer creates an AWS Key Management Service (AWS KMS) customer managed key. What should the developer do next to meet the encryption requirement?

A. Create parameters of the String type in AWS Systems Manager Parameter Store. For each parameter, specify the KMS key ID to encrypt the parameter in transit. Reference the GetParameter API call in the Lambda environment variables.
B. Create secrets in AWS Secrets Manager by using the customer managed KMS key. Create a new Lambda function and set up a Lambda layer. Configure the Lambda layer to retrieve the values from Secrets Manager.
C. Create objects in Amazon S3 for each sensitive data field. Specify the customer managed KMS key to encrypt the object. Configure the Lambda function to retrieve the objects from Amazon S3 during data processing.
D. Create encrypted Lambda environment variables. Specify the customer managed KMS key to encrypt the variables. Enable encryption helpers for encryption in transit. Grant permission to the Lambda function's execution role to access the KMS key.
Show Answer
Correct Answer: B
Explanation:
The requirement is encryption **in transit** for sensitive configuration data such as API keys. Lambda environment variables are encrypted only at rest and are not retrieved over a network at runtime, so they do not meet an in‑transit requirement. AWS Secrets Manager is designed for storing secrets and always uses TLS for in‑transit encryption, while also encrypting secrets at rest with a customer managed KMS key. Therefore, retrieving secrets from Secrets Manager satisfies the requirement.

Question 191

A developer is writing an application, which stores data in an Amazon DynamoDB table. The developer wants to query the DynamoDB table by using the partition key and a different sort key value. The developer needs the latest data with all recent write operations. How should the developer write the DynamoDB query?

A. Add a local secondary index (LSI) during table creation. Query the LSI by using eventually consistent reads.
B. Add a local secondary index (LSI) during table creation. Query the LSI by using strongly consistent reads.
C. Add a global secondary index (GSI) during table creation. Query the GSI by using eventually consistent reads.
D. Add a global secondary index (GSI) during table creation. Query the GSI by using strongly consistent reads.
Show Answer
Correct Answer: B
Explanation:
The requirement is to query using the same partition key but a different sort key, which is exactly what a Local Secondary Index (LSI) provides. The developer also needs the latest data, which requires strongly consistent reads. Strongly consistent reads are supported on the base table and LSIs, but not on GSIs. Therefore, querying an LSI with strongly consistent reads is the correct approach.

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