API Gateway X-Ray disabled This product is not supported for your selected
Datadog site . (
).
Id: cloudformation-aws-api-gateway-xray-disabled
Provider: AWS
Platform: CloudFormation
Severity: Low
Category: Observability
Learn More Description Failing to enable AWS X-Ray tracing on API Gateway stages prevents collection of end-to-end request traces, which hinders latency analysis, root-cause investigation, and detection of suspicious cross-service behavior. The TracingEnabled property on AWS::ApiGateway::Stage resources must be defined and set to true. Resources that omit TracingEnabled or set it to false (boolean false or the string "false") will be flagged.
Secure configuration example:
MyStage :
Type : AWS::ApiGateway::Stage
Properties :
StageName : prod
RestApiId : !Ref MyApi
TracingEnabled : true
Compliant Code Examples AWSTemplateFormatVersion : "2010-09-09"
Description : "BatchJobDefinition"
Resources :
ProdNeg1 :
Type : AWS::ApiGateway::Stage
Properties :
StageName : Prod
Description : Prod Stage
RestApiId : !Ref MyRestApi
DeploymentId : !Ref TestDeployment
DocumentationVersion : !Ref MyDocumentationVersion
ClientCertificateId : !Ref ClientCertificate
TracingEnabled : true
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'
{
"AWSTemplateFormatVersion" : "2010-09-09" ,
"Resources" : {
"ProdNeg2" : {
"Type" : "AWS::ApiGateway::Stage" ,
"Properties" : {
"StageName" : "Prod" ,
"RestApiId" : {
"Ref" : "MyRestApi"
},
"DeploymentId" : {
"Ref" : "TestDeployment"
},
"DocumentationVersion" : {
"Ref" : "MyDocumentationVersion"
},
"ClientCertificateId" : {
"Ref" : "ClientCertificate"
},
"Variables" : {
"Stack" : "Prod"
},
"TracingEnabled" : "true" ,
"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 : "BatchJobDefinition"
Resources :
ProdPos3 :
Type : AWS::ApiGateway::Stage
Properties :
StageName : Prod
Description : Prod Stage
RestApiId : !Ref MyRestApi
DeploymentId : !Ref TestDeployment
DocumentationVersion : !Ref MyDocumentationVersion
ClientCertificateId : !Ref ClientCertificate
TracingEnabled : false
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'
AWSTemplateFormatVersion : "2010-09-09"
Description : "BatchJobDefinition"
Resources :
ProdPos4 :
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'
{
"AWSTemplateFormatVersion" : "2010-09-09" ,
"Resources" : {
"ProdPos1" : {
"Type" : "AWS::ApiGateway::Stage" ,
"Properties" : {
"StageName" : "Prod" ,
"RestApiId" : {
"Ref" : "MyRestApi"
},
"DeploymentId" : {
"Ref" : "TestDeployment"
},
"DocumentationVersion" : {
"Ref" : "MyDocumentationVersion"
},
"ClientCertificateId" : {
"Ref" : "ClientCertificate"
},
"Variables" : {
"Stack" : "Prod"
},
"TracingEnabled" : "false" ,
"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"
}
]
}
}
}
}