Posted On: May 4, 2022
Now you can use the AWS Serverless Application Model (AWS SAM) CLI to enable AWS X-Ray tracing in your AWS SAM templates automatically, without manually authoring your AWS SAM templates. This makes it easier to centrally manage AWS X-Ray tracing across your Lambda functions in your serverless application.
The AWS SAM CLI is a developer tool that makes it easier to initialize, build, package, test on local and cloud, and deploy serverless applications. AWS X-Ray helps you analyze and debug your distributed applications, such as those built using a microservices architecture. AWS X-Ray provides an end-to-end view of requests as they travel through your application, making it easier to monitor and troubleshoot complex serverless architectures. Enabling tracing through the AWS SAM CLI reduces the complexity of setting up tracing on each of your Lambda functions.
To enable tracing through the AWS SAM CLI, simply add --tracing flag to the sam init command invocation to activate tracing. You can enable tracing across all Lambda functions in your AWS SAM application, or for specific functions. For more information, see the AWS SAM CLI documentation.
The AWS SAM CLI supports enabling tracing for serverless applications in all AWS regions where AWS SAM CLI and AWS X-Ray are supported. You can install the AWS SAM CLI by following the instructions in the documentation.