AWS Lambda function with X-Ray

X-Ray → AWS Lambda

Create a Lambda function using Lambda layers to enable X-Ray.

This CDK example sets up AWS X-Ray for a Lambda function that uses Lambda Layers. The example demonstrates the use of the folder structure for a Lambda layer written in Python, and using constructs for deploying and using the layer and X-Ray.

< Back to all patterns

GitHub icon Download this pattern (.zip)

GitHub icon View this pattern on GitHub


Clone repo

git clone https://github.com/aws-samples/serverless-patterns/cd lambda_layer_x_ray_stack

Deploy

cdk deploy


Testing

See the GitHub repo for testing instructions.

Cleanup

1. Delete the stack: npx cdk destroy.
2. Confirm the stack has been deleted: aws cloudformation list-stacks --query "StackSummaries[?contains(StackName,'STACK_NAME')].StackStatus".
3. You see a message confirming DELETE_COMPLETE.

Created by:

Emmanuel Saliu

Emmanuel Saliu

I am a Associate Consultant with AWS Professional Services.

Mark Lyon

Mark Lyon

I am a DevOps Consultant with AWS Professional Services.