DVA-C02 exam dumps

DVA-C02 practice question 306 of 399

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

DVA-C02 Question 306

Select 2

You are developing a serverless application using AWS Lambda. Your function requires a third-party library that is not included in the standard Lambda runtime. How can you package your Lambda function to ensure the dependencies are available at runtime?

  1. A

    Use the AWS Management Console to directly upload the third-party library as a separate file.

  2. B

    Create a deployment package by zipping your application code and the third-party library together.

  3. C

    Use AWS Lambda Layers to include the third-party library and attach the Layer to your function.

  4. D

    Include the library in your application code by copying the library's source code into your function's handler file.

Show answer and explanation

Correct answers: B, C

Explanation

When using third-party libraries with AWS Lambda, you can include them either by creating a deployment package (zipping your code and dependencies together) or by using AWS Lambda Layers to separate the library from your application code. These methods ensure that all required dependencies are available at runtime. Uploading separate files or copying library code into your handler is either unsupported or not scalable.

  • A. Incorrect.

    Uploading the third-party library as a separate file directly in the AWS Management Console is not supported. Lambda requires a deployment package or a Lambda Layer to include dependencies.

  • B. Correct.

    Creating a deployment package by zipping your application code and the third-party library together is a valid way to package your Lambda function with external dependencies.

  • C. Correct.

    Using AWS Lambda Layers is a recommended way to include external libraries or dependencies that can be shared across multiple functions. By attaching the Layer to your function, the library becomes available at runtime.

  • D. Incorrect.

    Copying the library's source code into your function's handler file is not a practical or scalable approach and is not a recommended best practice.

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