Skip to content

AWS API Gateway caching is disabled

Description

This checks that all methods in an Amazon API Gateway stage to ensure that they have caching enabled. As AWS puts it "With caching, you can reduce the number of calls made to your endpoint and also improve the latency of requests to your API" and so if you need to minimise those, this will help. See the AWS docs for more information: https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-caching.html

Code Example

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

Remediation

To configure API caching for a given stage:

  • Go to the API Gateway console.
  • Choose the API.
  • Choose Stages.
  • In the Stages list for the API, choose the stage.
  • Choose the Settings tab.
  • Choose Enable API cache. Wait for the cache creation to complete. === Fix - Buildtime

Cloudformation

  • Resource: AWS::ApiGateway::Stage
  • Arguments: CacheClusterEnabled

Rule Details

FieldValue
IDIAC-0173
SeverityLOW
IaC TypeCloudformation
FrameworksTerraform, CloudFormation
Checkov IDCKV_AWS_120

References