X-Ray tracing disabled for a SAM REST API

Enable X-Ray tracing when a SAM REST API needs request-flow analysis.

Description

With active tracing, an API Gateway REST API stage starts X-Ray traces for sampled requests. A passive stage can still participate in a trace started upstream.

Potential impact

A missing trace can make it harder to locate a slow or failing service.

Remediation

Set TracingEnabled: true where you need traces. Enable tracing in Lambda or other backends to follow calls beyond the API, and grant investigators access to the traces. Use access logs for per-request records.

Examples

The example enables tracing on the prod stage.

Before

yaml
Resources:
  ApiGatewayApi:
    Type: AWS::Serverless::Api
    Properties:
      StageName: prod
      TracingEnabled: false

After

yaml
Resources:
  ApiGatewayApi:
    Type: AWS::Serverless::Api
    Properties:
      StageName: prod
      TracingEnabled: true

References