Search code examples
amazon-web-servicesaws-lambdaaws-amplifyaws-xray

Enable XRAY on a lambda function using AWS Amplify


What is the recommended way to do enable XRAY on a Lambda function using AWS Amplify?

  • Edit the CloudFormation that Amplify generates?
  • Use CDK somehow to edit the function after it's been deployed? How?
  • Some other way?

Solution

  • Edit the CloudFormation that Amplify generates

    1. Set TracingConfig's mode to 'Active` in the AWS::Lambda::Function.

    2. Make sure your Lambda's role has permissions for X-Ray

    "xray:PutTraceSegments",
    "xray:PutTelemetryRecords"