DVA-C02 exam dumps

DVA-C02 practice question 20 of 399

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

DVA-C02 Question 20

Single answer

You are developing a web application that uses an Amazon API Gateway to trigger AWS Lambda functions. The API Gateway endpoints are stateless, but the Lambda function requires session-specific data to process user requests. Which of the following is the best approach to handle this requirement?

  1. A

    Store session-specific data in Amazon DynamoDB and pass a session ID to the Lambda function.

  2. B

    Use an Elastic Load Balancer to maintain session information and forward it to the Lambda function.

  3. C

    Store session-specific data in the API Gateway's stateful context and retrieve it within the Lambda function.

  4. D

    Pass all session-specific data directly in the API request payload to the Lambda function.

Show answer and explanation

Correct answer: A

Explanation

Stateless services like API Gateway and Lambda do not retain information between requests. To handle session-specific data, it is necessary to use external storage solutions like Amazon DynamoDB to maintain state outside the compute environment. By passing a session ID in the request, the Lambda function can retrieve only the required data without violating the stateless nature of the services.

  • A. Correct.

    This is the correct option. Amazon DynamoDB is well-suited for storing session-specific data due to its scalability and low-latency performance. Passing a session ID allows the Lambda function to retrieve the necessary data without storing state locally.

  • B. Incorrect.

    Elastic Load Balancers are used for distributing traffic and do not directly manage session data for stateless services like API Gateway or Lambda.

  • C. Incorrect.

    API Gateway is inherently stateless and does not support storing session data. This makes this option invalid.

  • D. Incorrect.

    While passing session-specific data directly in the payload is possible, it is not optimal for performance or security, especially when data grows in size or contains sensitive information.

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