Lambda functions must be tagged so resources can be reliably identified, assigned ownership, and included in incident response, access reviews, and automated security workflows. The Tags property on AWS::Lambda::Function resources must be defined and contain tag objects (Key and Value pairs). Resources missing the Tags property will be flagged. Tags should be provided as an array of objects with Key and Value fields.
AWSTemplateFormatVersion:'2010-09-09'Description:VPC function.Resources:Function:Type:AWS::Lambda::FunctionProperties:Handler:index.handlerRole:arn:aws:iam::123456789012:role/lambda-roleCode:S3Bucket:my-bucketS3Key:function.zipRuntime:nodejs12.xTimeout:5TracingConfig:Mode:ActiveVpcConfig:SecurityGroupIds:- sg-085912345678492fbSubnetIds:- subnet-071f712345678e7c8- subnet-07fd123456788a036Tags:- Key:DescriptionValue:VPC Function- Key:TypeValue:AWS Lambda Function
Non-Compliant Code Examples
AWSTemplateFormatVersion:'2010-09-09'Parameters:ExistingSecurityGroups:Type:List<AWS::EC2::SecurityGroup::Id>ExistingVPC:Type:AWS::EC2::VPC::IdDescription:The VPC ID that includes the security groups in the ExistingSecurityGroupsparameter.InstanceType:Type:StringDefault:t2.microAllowedValues:- t2.micro- m1.smallMappings:AWSInstanceType2Arch:t2.micro:Arch:HVM64m1.small:Arch:HVM64AWSRegionArch2AMI:us-east-1:HVM64:ami-0ff8a91507f77f867HVMG2:ami-0a584ac55a7631c0cResources:SecurityGroup:Type:AWS::EC2::SecurityGroupProperties:GroupDescription:Allow HTTP traffic to the hostVpcId:Ref:ExistingVPCSecurityGroupIngress:- IpProtocol:tcpFromPort:'80'ToPort:'80'CidrIp:0.0.0.0/0SecurityGroupEgress:- IpProtocol:tcpFromPort:'80'ToPort:'80'CidrIp:0.0.0.0/0AllSecurityGroups:Type:Custom::SplitProperties:ServiceToken:!GetAtt AppendItemToListFunction.ArnList:Ref:ExistingSecurityGroupsAppendedItem:Ref:SecurityGroupAppendItemToListFunction:Type:AWS::Lambda::FunctionProperties:Handler:index.handlerRole:!GetAtt LambdaExecutionRole.ArnCode:ZipFile:!Sub |var response = require('cfn-response');exports.handler = function(event, context) {var responseData = {Value: event.ResourceProperties.List};responseData.Value.push(event.ResourceProperties.AppendedItem);response.send(event, context, response.SUCCESS, responseData);};Runtime:nodejs8.10MyEC2Instance:Type:AWS::EC2::InstanceProperties:ImageId:Fn::FindInMap:- AWSRegionArch2AMI- Ref:AWS::Region- Fn::FindInMap:- AWSInstanceType2Arch- Ref:InstanceType- ArchSecurityGroupIds:!GetAtt AllSecurityGroups.ValueInstanceType:Ref:InstanceTypeLambdaExecutionRole:Type:AWS::IAM::RoleProperties:AssumeRolePolicyDocument:Version:'2012-10-17'Statement:- Effect:AllowPrincipal:Service:- lambda.amazonaws.comAction:- sts:AssumeRolePath:"/"Policies:- PolicyName:rootPolicyDocument:Version:'2012-10-17'Statement:- Effect:AllowAction:- logs:*Resource:arn:aws:logs:*:*:*Outputs:AllSecurityGroups:Description:Security Groups that are associated with the EC2 instanceValue:Fn::Join:- ", "- Fn::GetAtt:- AllSecurityGroups- Value
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.