Amazon DVA-C02 Practice Test - Questions Answers, Page 20
List of questions
Question 191

A company runs a payment application on Amazon EC2 instances behind an Application Load Balance The EC2 instances run in an Auto Scaling group across multiple Availability Zones The application needs to retrieve application secrets during the application startup and export the secrets as environment variables These secrets must be encrypted at rest and need to be rotated every month.
Which solution will meet these requirements with the LEAST development effort?
Explanation:
AWS Secrets Manager:Built for managing secrets, providing encryption, automatic rotation, and access control.
Customer Master Key (CMK):Provides an extra layer of control over encryption through AWS KMS.
Automatic Rotation:Enhances security by regularly changing the secret.
User Data Script:Allows secrets retrieval at instance startup and sets them as environment variables for seamless use within the application.
AWS Secrets Manager Documentation:https://docs.aws.amazon.com/secretsmanager/
AWS KMS Documentation:https://docs.aws.amazon.com/kms/
User Data for EC2 Instances:https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html
Question 192

A company is using Amazon API Gateway to invoke a new AWS Lambda function The company has Lambda function versions in its PROD and DEV environments. In each environment, there is a Lambda function alias pointing to the corresponding Lambda function version API Gateway has one stage that is configured to point at the PROD alias
The company wants to configure API Gateway to enable the PROD and DEV Lambda function versions to be simultaneously and distinctly available
Which solution will meet these requirements?
Explanation:
API Gateway Stages:Stages in API Gateway represent distinct environments (like PROD and DEV) allowing different configurations.
Stage Variables:Stage variables store environment-specific information, including Lambda function aliases.
Ease of Management:This solution offers a straightforward way to manage different Lambda function versions across environments.
API Gateway Stages:https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-stages.html
API Gateway Stage Variables:https://docs.aws.amazon.com/apigateway/latest/developerguide/stage-variables.html
Question 193

A developer is working on an ecommerce platform that communicates with several third-party payment processing APIs The third-party payment services do not provide a test environment.
The developer needs to validate the ecommerce platform's integration with the third-party payment processing APIs. The developer must test the API integration code without invoking the third-party payment processing APIs.
Which solution will meet these requirements'?
Explanation:
Mocking API Responses:API Gateway's Mock integration type enables simulating API behavior without invoking backend services.
Testing with Sample Data:Using captured responses from the real third-party API ensures realistic testing of the integration code.
Focus on Integration Logic:This solution allows the developer to isolate and test the application's interaction with the payment APIs, even without a test environment from the third-party providers.
Amazon API Gateway Mock Integrations:https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-mock-integration.html
Question 194

A developer is creating a simple proof-of-concept demo by using AWS CloudFormation and AWS Lambda functions The demo will use a CloudFormation template to deploy an existing Lambda function The Lambda function uses deployment packages and dependencies stored in Amazon S3 The developer defined anAWS Lambda Function resource in a CloudFormation template. The developer needs to add the S3 bucket to the CloudFormation template.
What should the developer do to meet these requirements with the LEAST development effort?
Explanation:
S3BucketandS3Key:These properties in a CloudFormationAWS::Lambda::Functionresource specify the location of the function's code in S3.
Least Development Effort:This solution minimizes code changes, relying on CloudFormation to reference the existing S3 deployment package.
AWS::Lambda::Function Resourcehttps://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html
Question 195

A company is planning to use AWS CodeDeploy to deploy an application to Amazon Elastic Container Service (Amazon ECS) During the deployment of a new version of the application, the company initially must expose only 10% of live traffic to the new version of the deployed application. Then, after 15 minutes elapse, the company must route all the remaining live traffic to the new version of the deployed application.
Which CodeDeploy predefined configuration will meet these requirements?
Explanation:
CodeDeploy Predefined Configurations:CodeDeploy offers built-in deployment configurations for common scenarios.
Canary Deployment:Canary deployments gradually shift traffic to a new version, ideal for controlled rollouts like this requirement.
CodeDeployDefault.ECSCanary10Percent15Minutes:This configuration matches the company's requirements, shifting 10% of traffic initially and then completing the rollout after 15 minutes.
AWS CodeDeploy Deployment Configurations:https://docs.aws.amazon.com/codedeploy/latest/userguide/deployment-configurations-create.html
Question 196

A developer is using AWS Step Functions to automate a workflow The workflow defines each step as an AWS Lambda function task The developer notices that runs of the Step Functions state machine fail in the GetResource task with either an UlegalArgumentException error or a TooManyRequestsException error
The developer wants the state machine to stop running when the state machine encounters an UlegalArgumentException error. The state machine needs to retry the GetResource task one additional time after 10 seconds if the state machine encounters a TooManyRequestsException error. If the second attempt fails, the developer wants the state machine to stop running.
How can the developer implement the Lambda retry functionality without adding unnecessary complexity to the state machine'?
Explanation:
Step Functions Retriers: Retriers provide a built-in way to gracefully handle transient errors within State Machines. Here's how to use them:
Directly attach a retrier to the problematic 'GetResource' task.
Configure the retrier:
ErrorEquals:Set this to ['TooManyRequestsException'] to target the specific error.
IntervalSeconds:Set to 10 for the desired retry delay.
MaxAttempts:Set to 1, as you want only one retry attempt.
Error Handling:
Upon 'TooManyRequestsException', the retrier triggers the task again after 10 seconds.
On a second failure, Step Functions moves to the next state or fails the workflow, as per your design.
'IllegalArgumentException' causes error propagation as intended.
Error Handling in Step Functions:https://docs.aws.amazon.com/step-functions/latest/dg/concepts-error-handling.html
Question 197

An Amazon Simple Queue Service (Amazon SQS) queue serves as an event source for an AWS Lambda function In the SQS queue, each item corresponds to a video file that the Lambda function must convert to a smaller resolution The Lambda function is timing out on longer video files, but the Lambda function's timeout is already configured to its maximum value
What should a developer do to avoid the timeouts without additional code changes'?
Explanation:
Visibility Timeout: When an SQS message is processed by a consumer (here, the Lambda function), it's temporarily hidden from other consumers. Visibility timeout controls this duration.
How It Helps:
Increase the visibility timeout beyond the maximum processing time your Lambda might typically take for long videos.
This prevents the message from reappearing in the queue while Lambda is still working, avoiding premature timeouts.
SQS Visibility Timeout:https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-visibility-timeout.html
Question 198

A developer is creating an Amazon DynamoDB table by using the AWS CLI The DynamoDB table must use server-side encryption with an AWS owned encryption key
How should the developer create the DynamoDB table to meet these requirements?
Explanation:
Default SSE in DynamoDB:DynamoDB tables are encrypted at rest by default using an AWS owned key (SSE-S3).
No Additional Action Needed:Creating a table without explicitly specifying a KMS key will use this default encryption.
DynamoDB Server-Side Encryption:https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Encryption
Question 199

A software company is launching a multimedia application. The application will allow guest users to access sample content before the users decide if they want to create an account to gain full access. The company wants to implement an authentication process that can identify users who have already created an account. The company also needs to keep track of the number of guest users who eventually create an account.
Which combination of steps will meet these requirements? {Select TWO.)
Create an Amazon Cognito user pool. Configure the user pool to allow unauthenticated users. Exchange user tokens for temporary credentials that allow authenticated users to assume a role.
Create an Amazon Cognito identity pool. Configure the identity pool to allow unauthenticated users. Exchange unique identity for temporary credentials that allow all users to assume a role.
Create an Amazon CloudFront distribution. Configure the distribution to allow unauthenticated users. Exchange user tokens for temporary credentials that allow all users to assume a role.
Create a role for authenticated users that allows access to all content. Create a role for unauthenticated users that allows access to only the sample content.
Allow all users to access the sample content by default. Create a role for authenticated users that allows access to the other content.
Question 200

A developer received the following error message during an AWS CloudFormation deployment:
Which action should the developer take to resolve this error?
Contact AWS Support to report an issue with the Auto Scaling Groups (ASG> service.
Add a DependsOn attribute to the ASGInstanceRole12345678 resource in the CloudFormation template. Then delete the stack.
Modify the CloudFormation template to retain the ASGInstanceRolet 2345678 resource. Then manually delete the resource after deployment.
Add a force parameter when calling CloudFormation with the role-am of ASGInstanceRole12345678.
Question