CloudWatch metrics disabled This product is not supported for your selected
Datadog site . (
).
Id: cloudformation-aws-cloudwatch-metrics-disabled
Provider: AWS
Platform: CloudFormation
Severity: Medium
Category: Observability
Learn More Description API Gateway stages must enable CloudWatch metrics for their method settings to provide visibility into request volume, latency, and errors and to support alerting and incident response.
In CloudFormation, check resources of type AWS::ApiGateway::Stage: the Properties.MethodSettings array must include MethodSetting objects with MetricsEnabled set to true.
Resources missing MethodSettings or where MethodSettings[].MetricsEnabled is missing or set to false will be flagged as a security/operational risk.
Secure configuration example:
MyStage :
Type : AWS::ApiGateway::Stage
Properties :
StageName : prod
RestApiId : !Ref MyApi
MethodSettings :
- ResourcePath : "/*"
HttpMethod : "*"
MetricsEnabled : true
Compliant Code Examples AWSTemplateFormatVersion : 2010-09-09
Description : Creating TestDeployment
Resources :
Prod :
Type : AWS::ApiGateway::Stage
Properties :
StageName : Prod
Description : Prod Stage
RestApiId : !Ref MyRestApi
DeploymentId : !Ref TestDeployment
DocumentationVersion : !Ref MyDocumentationVersion
ClientCertificateId : !Ref ClientCertificate
Variables :
Stack : Prod
MethodSettings :
- ResourcePath : /
HttpMethod : GET
MetricsEnabled : 'true'
DataTraceEnabled : 'false'
- ResourcePath : /stack
HttpMethod : POST
MetricsEnabled : 'true'
DataTraceEnabled : 'false'
ThrottlingBurstLimit : '999'
- ResourcePath : /stack
HttpMethod : GET
MetricsEnabled : 'true'
DataTraceEnabled : 'false'
ThrottlingBurstLimit : '555'
{
"Resources" : {
"Prod" : {
"Type" : "AWS::ApiGateway::Stage" ,
"Properties" : {
"StageName" : "Prod" ,
"Description" : "Prod Stage" ,
"RestApiId" : {
"Ref" : "MyRestApi"
},
"DeploymentId" : {
"Ref" : "TestDeployment"
},
"DocumentationVersion" : {
"Ref" : "MyDocumentationVersion"
},
"ClientCertificateId" : {
"Ref" : "ClientCertificate"
},
"Variables" : {
"Stack" : "Prod"
},
"MethodSettings" : [
{
"ResourcePath" : "/" ,
"HttpMethod" : "GET" ,
"MetricsEnabled" : "true" ,
"DataTraceEnabled" : "false"
},
{
"ResourcePath" : "/stack" ,
"HttpMethod" : "POST" ,
"MetricsEnabled" : "true" ,
"DataTraceEnabled" : "false" ,
"ThrottlingBurstLimit" : "999"
},
{
"ResourcePath" : "/stack" ,
"HttpMethod" : "GET" ,
"MetricsEnabled" : "true" ,
"DataTraceEnabled" : "false" ,
"ThrottlingBurstLimit" : "555"
}
]
}
}
}
}
Non-Compliant Code Examples AWSTemplateFormatVersion : 2010-09-09
Description : Creating TestDeployment
Resources :
Prod :
Type : AWS::ApiGateway::Stage
Properties :
StageName : Prod
Description : Prod Stage
RestApiId : !Ref MyRestApi
DeploymentId : !Ref TestDeployment
DocumentationVersion : !Ref MyDocumentationVersion
ClientCertificateId : !Ref ClientCertificate
Variables :
Stack : Prod
MethodSettings :
- ResourcePath : /
HttpMethod : GET
MetricsEnabled : 'false'
DataTraceEnabled : 'false'
- ResourcePath : /stack
HttpMethod : POST
DataTraceEnabled : 'false'
ThrottlingBurstLimit : '999'
- ResourcePath : /stack
HttpMethod : GET
MetricsEnabled : 'true'
DataTraceEnabled : 'false'
ThrottlingBurstLimit : '555'
{
"Resources" : {
"Prod" : {
"Type" : "AWS::ApiGateway::Stage" ,
"Properties" : {
"StageName" : "Prod" ,
"Description" : "Prod Stage" ,
"RestApiId" : {
"Ref" : "MyRestApi"
},
"DeploymentId" : {
"Ref" : "TestDeployment"
},
"DocumentationVersion" : {
"Ref" : "MyDocumentationVersion"
},
"ClientCertificateId" : {
"Ref" : "ClientCertificate"
},
"Variables" : {
"Stack" : "Prod"
},
"MethodSettings" : [
{
"ResourcePath" : "/" ,
"HttpMethod" : "GET" ,
"DataTraceEnabled" : "false"
},
{
"ResourcePath" : "/stack" ,
"HttpMethod" : "POST" ,
"MetricsEnabled" : "false" ,
"DataTraceEnabled" : "false" ,
"ThrottlingBurstLimit" : "999"
},
{
"ResourcePath" : "/stack" ,
"HttpMethod" : "GET" ,
"MetricsEnabled" : "true" ,
"DataTraceEnabled" : "false" ,
"ThrottlingBurstLimit" : "555"
}
]
}
}
}
}
AWSTemplateFormatVersion : 2010-09-09
Description : Creating TestDeployment
Resources :
Prod :
Type : AWS::ApiGateway::Stage
Properties :
StageName : Prod
Description : Prod Stage
RestApiId : !Ref MyRestApi
DeploymentId : !Ref TestDeployment
DocumentationVersion : !Ref MyDocumentationVersion
ClientCertificateId : !Ref ClientCertificate
Variables :
Stack : Prod