For AI agents: A markdown version of this page is available at https://docs.datadoghq.com/security/code_security/iac_security/iac_rules/terraform-aws-api-gateway-stage-without-api-gateway-usage-plan-associated.md.
A documentation index is available at /llms.txt.
API Gateway stages should always be associated with an API Gateway UsagePlan, which enforces throttling and quota limits for clients accessing your APIs. Without a defined aws_api_gateway_usage_plan resource and its association via the api_stages block, as shown below, the API stage can be accessed without usage restrictions, leading to potential misuse, abuse, or denial of service due to unlimited traffic.
Configuring a UsagePlan, such as the one in the example below, helps mitigate these risks by controlling consumption through quotas and throttling, protecting backend resources and maintaining predictable API performance.
resource "aws_api_gateway_usage_plan" "example" {
name = "my-usage-plan"
description = "usage plan description"
api_stages {
api_id = "some rest api id"
stage = "development"
}
}