Question

Difficulty: MediumApplication Caching and Session State Management

An organization has a serverless API hosted on Amazon API Gateway that routes requests to an AWS Lambda function. The function queries an Amazon DynamoDB table to retrieve static configuration metadata that changes only once a day. Due to a sudden surge in traffic, the application is experiencing high latency and increased DynamoDB costs. The developer wants to implement a caching strategy to reduce latency and database reads with the least operational overhead and no code changes. Which of the following is the most suitable solution?

  1. Enable caching on the Amazon API Gateway stage for the GET method.Answer
  2. B
    Increase the provisioned Read Capacity Units (RCUs) on the DynamoDB table and use strongly consistent reads for all configuration queries.
  3. C
    Modify the AWS Lambda function code to perform a DynamoDB Scan operation to fetch the configuration metadata on every invocation.
  4. D
    Migrate the configuration metadata to AWS Secrets Manager and configure the Lambda function to fetch the secret on each execution.

Answer

Enable caching on the Amazon API Gateway stage for the GET method.
Enabling caching on the API Gateway stage allows the API Gateway to return cached responses directly to the client for the specified Time-to-Live (TTL). This bypasses the Lambda function invocation and subsequent DynamoDB queries entirely, reducing both latency and costs without requiring any modification to the application code.

Step-by-Step Solution

1
Analyze the requirements for caching static configuration data that changes once a day.
Determine that caching at the entry point (API Gateway) is the most efficient way to prevent traffic from hitting Lambda and DynamoDB.
Reduces read queries, minimizes downstream load, and lowers latency.
2
Evaluate the constraints: least operational overhead and no code changes.
API Gateway stage caching requires zero application code modifications.
Allows implementation directly through AWS configuration.

Key Concept

API Gateway Caching
Rate this question