API Gateway caching is not enabled for REST APIs Affecting API Gateway (REST APIs) service in AWS


Severity

0.0
medium
0
10
Severity Framework
Snyk CCSS
Rule category
Availability/ Usage

Is your environment affected by this misconfiguration?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
Frameworks
  • Snyk IDSNYK-CC-00773
  • creditSnyk Research Team

Description

API Gateway caching can mitigate the risk of high latency and potential denial of service (DoS) attacks by reducing the number of calls made to the backend services. It also helps improve the response time for end users by storing cacheable responses. Not utilizing caching features can lead to unnecessary load on the backend services, which may result in performance bottlenecks or increased latency.

How to fix?

Set the settings.caching_enabled attribute to true in the aws_api_gateway_method_settings resource.

Example Configuration

resource "aws_api_gateway_method_settings" "allow" {
  rest_api_id = "abcdef123"
  stage_name  = "dev"
  method_path = "path1/GET"

  settings {
   caching_enabled = true
  }
}