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:
Using a Lambda alias with weighted routing enables a canary deployment by sending a small percentage of traffic (10%) to the new published version while the rest continues using the stable version. If errors occur, the alias can immediately route 100% of traffic back to the previous version, minimizing user impact. Option A exposes all users to the new version before rollback. Option C requires application changes to version ARNs and is not minimal impact. Option D is invalid because Lambda aliases route to function versions, not to other aliases.

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 separate API Gateway stage for testing isolates the updated Lambda from production traffic. By using stage variables (or stage-specific Lambda integration), the test stage can invoke the updated Lambda version while the production stage continues using the production Lambda. This avoids impacting production users and is more operationally efficient than duplicating the entire stack. A canary release still exposes some production users to the new version, a private endpoint changes production accessibility, and a full duplicate stack is unnecessary overhead.

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:
Amazon S3 is the appropriate durable storage for generated videos. A pre-signed S3 URL provides time-limited access (such as at least 3 hours) without making the object public. Lambda /tmp storage is ephemeral, EFS does not natively use S3-style pre-signed object URLs, and CloudFront serves content but is not an origin storage service for generated files.

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:
A global secondary index (GSI) supports a different partition key and sort key from the base table, enabling efficient queries by order_date (partition key) and order_id (sort key). An LSI must share the base table's partition key (customer_id), so it cannot use order_date as the partition key. Scanning the table is inefficient, and DynamoDB Streams are for change capture, not 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 provides a publish/subscribe fan-out pattern. Publishing one sale event to an SNS topic triggers all three subscribed Lambda functions independently and concurrently. A failure in one Lambda invocation does not prevent the others from being invoked. An SQS queue distributes messages among consumers rather than broadcasting to all of them, ALB is not an event fan-out mechanism, and Step Functions is unnecessary here and does not match the requirement to keep the independent Lambda functions while ensuring independent execution.

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:
Use DynamoDB Streams as an event source for AWS Lambda, and apply Lambda event filtering so only records where TransactionStatus is 'failed' and Price exceeds the threshold invoke the function. The Lambda function then publishes a notification to Amazon SNS. This minimizes development effort by avoiding custom filtering logic for all stream records. DynamoDB Streams cannot directly invoke SNS, and CloudWatch alarms do not inspect individual DynamoDB Streams records.

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:
IAM policy evaluation (including explicit deny) applies when evaluating requests made with a given principal's credentials. If the application is configured with IAM user access keys from the local credentials file, those credentials are used instead of the EC2 instance role credentials. The IAM role's explicit deny does not apply to requests signed with a different IAM principal (the IAM user). Therefore, with full administrative IAM user credentials 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 existing table has only a partition key (OrderID), so querying by OrderSource is not possible without an index. A Scan with a filter still reads the entire table and is inefficient for more than 100,000 items. An LSI cannot be added after table creation and must share the same partition key as the base table, so it would not fit this use case. A GSI should use OrderSource as its partition key so that all items with OrderSource='MobileApp' can be efficiently retrieved with a Query operation. Using OrderSource only as a GSI sort key would not allow querying by that attribute alone.

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: D
Explanation:
Lambda environment variables can be encrypted with a customer managed AWS KMS key, and enabling Lambda encryption helpers provides client-side encryption to protect sensitive values in transit when configuring them. The Lambda execution role must be granted permission to use the KMS key. This directly addresses sensitive configuration data stored with the Lambda application.

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:
A local secondary index (LSI) uses the same partition key as the base table but a different sort key, matching the requirement to query with the partition key and a different sort key. LSIs support strongly consistent reads, whereas GSIs support only eventually consistent reads. Because the application needs the latest data with all recent writes, the query should use strongly consistent reads on an LSI.

$19

Get all 553 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.