DVA-C02 exam dumps

DVA-C02 practice question 228 of 399

AWS Certified Developer - Associate. Associate level, Amazon Web Services. Free question with the correct answer and a full explanation.

DVA-C02 Question 228

Select 2

A developer is working on an AWS Lambda function that requires an external library not included in the standard runtime. The function also needs to handle environment-specific configurations, such as API keys and database connection strings. What is the most efficient way to package and deploy the Lambda function while adhering to best practices?

  1. A

    Use Lambda Layers to include the external library and configure environment variables through the Lambda console.

  2. B

    Include the external library in the deployment package by bundling it with the function code and hardcode environment-specific configurations within the code.

  3. C

    Use Lambda Layers to include the external library and manage environment variables through AWS Systems Manager Parameter Store or AWS Secrets Manager.

  4. D

    Package the external library with the function code in a .zip file and set environment variables using the AWS CLI.

  5. E

    Use container images for the Lambda function and pass environment-specific configurations as environment variables.

Show answer and explanation

Correct answers: A, C

Explanation

The best approach combines the use of Lambda Layers for managing external libraries and proper handling of environment-specific configurations. Lambda Layers help reduce redundancy and improve modularity, while using environment variables or secure services like AWS Systems Manager Parameter Store or AWS Secrets Manager ensures that sensitive information is managed securely. This approach adheres to AWS best practices for maintainability, security, and scalability.

  • A. Correct.

    Correct: Using Lambda Layers for external libraries reduces the size of your deployment package and allows for reuse of common dependencies. Setting environment variables directly in the Lambda console is a straightforward and common approach.

  • B. Incorrect.

    Incorrect: Bundling the external library within the deployment package makes the package larger and less modular. Hardcoding environment-specific configurations is not recommended as it is insecure and inflexible.

  • C. Correct.

    Correct: Lambda Layers are an efficient way to manage external libraries, and using AWS Systems Manager Parameter Store or AWS Secrets Manager for environment variables enhances security and scalability.

  • D. Incorrect.

    Incorrect: While packaging the external library with the code works, it increases the size of the deployment package and lacks modularity. Setting environment variables using the AWS CLI is valid but less efficient compared to the other options.

  • E. Incorrect.

    Incorrect: Using container images is an option for Lambda deployment, but it is unnecessary for this scenario since the requirements can be met with Lambda Layers and environment variables.

Timed practice exam

Take a DVA-C02 practice test under exam conditions

65 questions in 130 minutes, drawn from this bank, with a score report and a per-question review when you finish.

Start timed exam