For AI agents: A markdown version of this page is available at https://docs.datadoghq.com/security/code_security/iac_security/iac_rules/cloudformation-aws-serverless-function-without-x-ray-tracing.md.
A documentation index is available at /llms.txt.
Serverless functions must have AWS X-Ray tracing enabled so execution paths, errors, and latency are observable for incident response and performance troubleshooting. For AWS Serverless Application Model functions (AWS::Serverless::Function), the Properties.Tracing attribute must be defined and set to Active. Resources missing the Tracing property or with Tracing set to any other value will be flagged.
AWSTemplateFormatVersion:'2010-09-09'Transform:AWS::Serverless-2016-10-31Description:AWS SAM template with a simple API definitionResources:Function3:Type:AWS::Serverless::FunctionProperties:PackageType:ImageImageUri:account-id.dkr.ecr.region.amazonaws.com/ecr-repo-name:image-nameImageConfig:Command:- "app.lambda_handler"EntryPoint:- "entrypoint1"WorkingDirectory:"workDir"Tags:- Key:TypeValue:AWS Serverless FunctionTracing:Active
Non-Compliant Code Examples
AWSTemplateFormatVersion:'2010-09-09'Transform:AWS::Serverless-2016-10-31Description:AWS SAM template with a simple API definitionResources:Function1:Type:AWS::Serverless::FunctionProperties:PackageType:ImageImageUri:account-id.dkr.ecr.region.amazonaws.com/ecr-repo-name:image-nameImageConfig:Command:- "app.lambda_handler"EntryPoint:- "entrypoint1"WorkingDirectory:"workDir"Tags:- Key:TypeValue:AWS Serverless Function
AWSTemplateFormatVersion:'2010-09-09'Transform:AWS::Serverless-2016-10-31Description:AWS SAM template with a simple API definitionResources:Function2:Type:AWS::Serverless::FunctionProperties:PackageType:ImageImageUri:account-id.dkr.ecr.region.amazonaws.com/ecr-repo-name:image-nameImageConfig:Command:- "app.lambda_handler"EntryPoint:- "entrypoint1"WorkingDirectory:"workDir"Tags:- Key:TypeValue:AWS Serverless FunctionTracing:PassThrough
1
2
rulesets:- CloudFormation / AWS # Rules to enforce / AWS.
Request a personalized demo
Get Started with Datadog
Ask AI
AI-generated responses may be inaccurate. Verify important info.