DVA-C02 Question Bank · Latest 50 Questions Free Preview (Page 4/5)
Questions 31–40 of the latest 50 DVA-C02 questions (5 pages total), with answers and explanations, no login required. Practice all 1394 questions online.
Question 31 · No. 1375 · Single choice
A company is building an application to accept data from customers. The data must be encrypted at rest and in transit. The application uses an Amazon API Gateway API that resolves to AWS Lambda functions. The Lambda functions store the data in an Amazon Aurora MySQL DB cluster. The application worked properly during testing. A developer configured an Amazon CloudFront distribution with field-level encryption that uses an AWS Key Management Service (AWS KMS) key. After the configuration of the distribution, the application behaved unexpectedly. All the data in the database changed from plaintext to ciphertext. The developer must ensure that the data is not stored in the database as the ciphertext from the CloudFront field-level encryption. Which solution will meet this requirement?
- A. Change the CloudFront Viewer protocol policy from “HTTP and HTTPS” to “HTTPS only.”
- B. Add a Lambda function that uses the KMS key to decrypt the data fields before saving the data to the database.
- C. Enable encryption on the DB cluster by using the same KMS key that is used in CloudFront.
- D. Request and deploy a new SSL certificate to use with the CloudFront distribution.
Answer: B
Explanation: The issue arises because the data is being encrypted at the CloudFront level via field-level encryption, and this encrypted data is then being stored directly in the database. To resolve this, a Lambda function can be used to decrypt the data fields using the KMS key before saving them to the database. This ensures that the data remains in plaintext within the database as intended.
Question 32 · No. 1376 · Single choice
A developer needs to build a workflow to handle messages that are sent to an Amazon Simple Queue Service (Amazon SQS) queue. When a message reaches the queue, the workflow must implement a delay before invoking an AWS Lambda function to process the message. Which solution will meet this requirement in the MOST operationally efficient way?
- A. Create an AWS Step Functions state machine to process the SQS queue. Use a Wait state to delay the Lambda function’s processing for the required number of seconds after message delivery to the SQS queue. Use Amazon EventBridge to invoke the state machine every 5 minutes.
- B. Configure the Lambda function to poll the SQS queue. Update the Lambda code to republish each message with a custom attribute that contains a future time when the message should be fully processed. Update the Lambda code to fully process messages when the custom attribute’s future time has passed.
- C. Set the DelaySeconds value of the SQS queue to be the number of seconds required to delay delivery of the messages. Add an event source mapping for the Lambda function. Specify the SQS queue as a source.
- D. Set the Visibility Timeout value of the SQS queue to be the number of seconds required to delay delivery of the messages. Add an event source mapping for the Lambda function. Specify the SQS queue as a source.
Answer: C
Explanation: The most operationally efficient solution is to use the built-in SQS feature 'DelaySeconds' which delays the delivery of messages in the queue. This approach requires minimal code changes and leverages AWS's managed services effectively. After the delay, an event source mapping triggers the Lambda function automatically, ensuring seamless integration.
Question 33 · No. 1377 · Single choice
A development team has an Amazon API Gateway REST API that is backed by an AWS Lambda function. Users have reported performance issues for the Lambda function. The development team identified the source of the issues as a cold start of the Lambda function. The development team needs to reduce the time needed for the Lambda function to initialize. Which solution will meet this requirement?
- A. Change the Lambda concurrency to reserved concurrency.
- B. Increase the timeout of the Lambda function.
- C. Increase the memory allocation of the Lambda function.
- D. Configure provisioned concurrency for the Lambda function.
Answer: D
Explanation: The issue described is related to cold starts in the Lambda function. Cold starts occur when a Lambda function is invoked after being idle for some time, causing latency due to the initialization of the execution environment. To reduce cold start times, the best solution is to configure provisioned concurrency for the Lambda function. Provisioned concurrency keeps the function initialized and ready to handle requests, eliminating the cold start problem. Reserved concurrency (Option A) manages the number of concurrent executions but does not address cold starts. Increasing timeout (Option B) or memory allocation (Option C) does not directly impact cold start performance.
Question 34 · No. 1378 · Single choice
A developer is building an application that includes an AWS Lambda function that is written in .NET Core. The Lambda function’s code needs to interact with Amazon DynamoDB tables and Amazon S3 buckets. The developer must minimize the Lambda function’s deployment time and invocation duration. Which solution will meet these requirements?
- A. Increase the Lambda function’s memory.
- B. Include the entire AWS SDK for .NET in the Lambda function’s deployment package.
- C. Include only the AWS SDK for .NET modules for DynamoDB and Amazon S3 in the Lambda function’s deployment package.
- D. Configure the Lambda function to download the AWS SDK for .NET from an S3 bucket at runtime.
Answer: C
Explanation: Including only the necessary AWS SDK for .NET modules (for DynamoDB and S3) in the Lambda function's deployment package reduces the package size. This minimizes both the deployment time and the invocation duration, as smaller packages are uploaded faster and consume less memory during execution. Including the entire SDK (option B) or downloading it at runtime (option D) would increase the deployment size and/or invocation latency, which is not optimal. Increasing memory (option A) might improve execution speed but does not address the deployment size issue.
Question 35 · No. 1379 · Single choice
A developer must cache dependent artifacts from Maven Central, a public package repository, as part of an application’s build pipeline. The build pipeline has an AWS CodeArtifact repository where artifacts of the build are published. The developer needs a solution that requires minimum changes to the build pipeline. Which solution meets these requirements?
- A. Modify the existing CodeAriifact repository to associate an upstream repository with the public package repository.
- B. Create a new CodeAtfact repository that has an external connection to the public package repository.
- C. Create a new CodeAifact domain that contains a new repository that has an external connection to the public package repository.
- D. Modify the CodeAnifact repository resource policy to allow artifacts to be fetched from the public package repository.
Answer: A
Explanation: The question requires a solution that minimizes changes to the existing build pipeline. Option A involves modifying the existing CodeArtifact repository to associate it with an upstream repository (Maven Central). This approach fulfills the requirement without introducing significant changes to the pipeline, as it leverages the current repository setup. Options B and C involve creating new repositories or domains, which introduces more changes than necessary. Option D is incorrect because modifying the resource policy alone does not enable fetching artifacts from Maven Central; an upstream repository association is required.
Question 36 · No. 1380 · Single choice
A developer needs to write an AWS CloudFormation template on a local machine and deploy a CloudFormation stack to AWS. What must the developer do to complete these tasks?
- A. Install the AWS CLI. Configure the AWS CLI by using an IAM user name and password.
- B. Install the AWS CLI. Configure the AWS CLI by using an SSH key.
- C. Install the AWS CLI, Configure the AWS CLI by using an IAM user access key and secret key.
- D. Install an AWS software development kit (SDK). Configure the SDK by using an X.509 certificate.
Answer: C
Explanation: To interact with AWS services like deploying a CloudFormation stack, the developer needs to use the AWS CLI configured with valid IAM credentials. IAM user access keys (access key ID and secret access key) are required for programmatic access to AWS services. Using an SSH key or X.509 certificate is not relevant for this scenario, as those methods are used for different purposes. The correct answer is C.
Question 37 · No. 1381 · Multiple choice
A developer is making changes to a custom application that uses AWS Elastic Beanstalk. Which solutions will update the Elastic Beanstalk environment with the new application version after the developer completes the changes? (Choose two.)
- A. Package the application code into a zip file. Use the AWS Management Console to upload the .zip file and deploy the packaged application.
- B. Package the application code into a .tar file. Use the AWS Management Console to create a new application version from the .tar file. Update the environment by using the AWS CLI.
- C. Package the application code into a .tar file. Use the AWS Management Console to upload the .tar file and deploy the packaged application.
- D. Package the application code into a .zip file. Use the AWS CL to create a new application version from the .zip file and to update the environment.
- E. Package the application code into a .zip file. Use the AWS Management Console to create a new application version from the .zip file. Rebuild the environment by using the AWS CLI.
Answer: A, D
Explanation: The question asks for two solutions that will update the Elastic Beanstalk environment with a new application version. Option A is correct because it describes packaging the code into a .zip file and deploying it directly through the AWS Management Console, which is a valid method. Option D is also correct because it involves creating a new application version from a .zip file using the AWS CLI and then updating the environment, which is another valid approach. Options B, C, and E are incorrect because they either involve unnecessary steps (like rebuilding the environment) or unsupported file types (.tar files).
Question 38 · No. 1382 · Single choice
A company runs continuous integration/continuous delivery (CI/CD) pipelines for its application on AWS CodePipeline. A developer must write unit tests and run them as part of the pipelines before staging the artifacts for testing. How should the developer incorporate unit tests as part of CI/CD pipelines?
- A. Create a separate CodePipeline pipeline to run unit tests.
- B. Update the AWS CodeBuild build specification to include a phase for running unit tests.
- C. Install the AWS CodeDeploy agent on an Amazon EC2 instance to run unit tests.
- D. Create a testing branch in a git repository for the pipelines to run unit tests.
Answer: B
Explanation: The best way to incorporate unit tests as part of CI/CD pipelines is to update the AWS CodeBuild build specification to include a phase for running unit tests. This approach ensures that the tests are executed automatically during the build phase, before the artifacts are staged for further testing. Using CodeBuild's native capabilities keeps the pipeline streamlined and leverages AWS services effectively without requiring additional resources or complex configurations.
Question 39 · No. 1383 · Single choice
A team has an Amazon API Gateway REST API that consists of a single resource and a GET method that is backed by an AWS Lambda integration. A developer makes a change to the Lambda function and deploys the function as a new version. The developer needs to set up a process to test the new version of the function before using the new version in production. The tests must not affect the production REST API. Which solution will meet these requirements with the LEAST operational overhead?
- A. Create a new resource in the REST API. Add a GET method to the new resource, and add a Lambda integration to the updated version of the Lambda function. Deploy the new version.
- B. Create a new stage for the REST API. Create a stage variable. Assign the stage variable to the Lambda function. Set the API Gateway integrated Lambda function name to the stage variable. Deploy the new version.
- C. Create a new REST API. Add a resource that has a single GET method that is integrated with the updated version of the Lambda function.
- D. Update the Lambda integration of the existing GET method to point to the updated version of the Lambda function. Deploy the new version.
Answer: B
Explanation: The requirement is to test the new version of the Lambda function without affecting the production REST API and with minimal operational overhead. Option B suggests creating a new stage for the REST API and using a stage variable to point to the updated Lambda function. This allows testing of the new Lambda version in isolation (on the new stage) without impacting the existing production stage. It avoids the need to create additional resources or a completely new REST API, reducing complexity and overhead.
Question 40 · No. 1384 · Single choice
A developer created reusable code that several AWS Lambda functions need to use. The developer bundled the code into a zip archive. The developer needs to deploy the code to AWS and update the Lambda functions to use the code. Which solution will meet this requirement in the MOST operationally efficient way?
- A. Upload the zip archive to Amazon S3. Configure an import path on the Lambda functions to point to the zip archive.
- B. Create a new Lambda function that contains and runs the shared code. Update the existing Lambda functions to invoke the new Lambda function synchronously.
- C. Create a Lambda layer that contains the zip archive. Attach the Lambda layer to the Lambda functions.
- D. Create a Lambda container image that includes the shared code. Use the container image as a Lambda base image for all the functions.
Answer: C
Explanation: The most operationally efficient solution is to create a Lambda layer that contains the zip archive and attach it to the Lambda functions. Lambda layers are specifically designed for sharing reusable code across multiple Lambda functions without duplicating the code in each function’s deployment package. This approach simplifies updates to the shared code since changes made to the layer automatically propagate to all functions using it, reducing operational overhead.