Ensure AWS API Gateway caching is enabled

Error: AWS API Gateway caching is disabled

Bridgecrew Policy ID: BC_AWS_GENERAL_128
Checkov Check ID: CKV_AWS_120
Severity: LOW

AWS API Gateway caching is disabled

Description

A cache cluster caches responses. With caching, you can reduce the number of calls made to your endpoint and also improve the latency of requests to your API.

Fix - Runtime

  1. Go to the API Gateway console.
  2. Select an API.
  3. Select Stages.
  4. In the Stages list for the API, select the required stage.
  5. Go to the Settings tab.
  6. Select Enable API cache.
  7. Wait until cache creation is complete.

Fix - Buildtime

Terraform

resource "aws_api_gateway_rest_api" "example" {
...
  + cache_cluster_enabled = true
...
}

CloudFormation

Resources:
  Prod:
    Type: AWS::ApiGateway::Stage
    Properties:
      ...
      + CacheClusterEnabled: True