X-Ray tracing disabled for a SAM REST API

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

Description

Enabling TracingEnabled on a SAM REST API provides X-Ray traces of sampled requests and their latency. Disabling it prevents collection of that API’s trace data.

Potential impact

It can become harder to locate errors or delays across distributed calls.

Remediation

Set TracingEnabled: true. Configure Lambda and other backends for tracing when the full call path is needed. Traces are sampled and do not replace audit records for every request.

Examples

The excerpts only enable tracing for the REST API stage. Configure backend instrumentation and access to trace data separately.

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