Skip to content

AWS API Gateway method settings do not enable caching

Description

Enabling caching for API Gateway helps improve your API's performance by allowing clients to retrieve responses from a cache instead of making a request to the backend service. This can reduce the load on your backend service and improve the overall responsiveness of your API. It can reduce the cost of using your API by reducing the number of requests your backend service needs to handle. It can also improve the reliability of your API by allowing it to continue functioning even if the backend service is unavailable or experiencing problems.

Code Example

go
resource "aws_api_gateway_method_settings" "pass" {
  rest_api_id = aws_api_gateway_rest_api.fail.id
  stage_name  = aws_api_gateway_stage.fail.stage_name
  method_path = "path1/GET"

  settings {
    caching_enabled      = true
    metrics_enabled      = false
    logging_level        = "INFO"
    cache_data_encrypted = true
    data_trace_enabled   = false
  }
}

Remediation

Terraform

Rule Details

FieldValue
IDIAC-0273
SeverityLOW
IaC TypeTerraform
FrameworksTerraform
Checkov IDCKV_AWS_225

References