This check determines whether Amazon API Gateway stages are properly configured to enable CloudWatch metrics by verifying that the metrics_enabled attribute is set to true within the settings block. If metrics_enabled is set to false or omitted, CloudWatch metrics will not capture API Gateway performance data, such as error rates, latency, or request counts. This lack of monitoring inhibits an organization’s ability to detect misuse, troubleshoot issues, or respond to anomalous behaviors in their API environments. Without timely visibility into API activity, misconfigurations or security incidents may go unnoticed, increasing operational and security risks.
Compliant Code Examples
#this code is a correct code for which the query should not find any result
resource"aws_api_gateway_method_settings""negative1"{rest_api_id=aws_api_gateway_rest_api.test.idstage_name=aws_api_gateway_stage.test.stage_namemethod_path="${aws_api_gateway_resource.test.path_part}/${aws_api_gateway_method.test.http_method}"settings{metrics_enabled=truelogging_level="INFO"}}
Non-Compliant Code Examples
#this is a problematic code where the query should report a result(s)
resource"aws_api_gateway_method_settings""positive1"{rest_api_id=aws_api_gateway_rest_api.test.idstage_name=aws_api_gateway_stage.test.stage_namemethod_path="${aws_api_gateway_resource.test.path_part}/${aws_api_gateway_method.test.http_method}"settings{metrics_enabled=falselogging_level="INFO"}}resource"aws_api_gateway_method_settings""positive2"{rest_api_id=aws_api_gateway_rest_api.test.idstage_name=aws_api_gateway_stage.test.stage_namemethod_path="${aws_api_gateway_resource.test.path_part}/${aws_api_gateway_method.test.http_method}"settings{logging_level="INFO"}}
1
2
rulesets:- Terraform / AWS # Rules to enforce / AWS.
맞춤형 데모 요청
Datadog 시작하기
Ask AI
AI-generated responses may be inaccurate. Verify important info.