PropagateTags Class
Configuration for propagating tags to managed resources created by a capacity provider.
Use static factory methods to create instances:
propagateTags: lambda.PropagateTags.explicit({ env: 'prod', team: 'platform' })
| Source | aws-lambda/lib/capacity-provider.ts |
|---|---|
| Type last changed |
Example
ts
import * as ec2 from 'aws-cdk-lib/aws-ec2';
const vpc = new ec2.Vpc(this, 'MyVpc');
const securityGroup = new ec2.SecurityGroup(this, 'SecurityGroup', { vpc });
const capacityProvider = new lambda.CapacityProvider(this, 'MyCapacityProvider', {
subnets: vpc.privateSubnets,
securityGroups: [securityGroup],
propagateTags: lambda.PropagateTags.explicit({
CostCenter: 'Engineering',
Project: 'MyProject',
}),
});
python
import aws_cdk.aws_ec2 as ec2
vpc = ec2.Vpc(self, "MyVpc")
security_group = ec2.SecurityGroup(self, "SecurityGroup", vpc=vpc)
capacity_provider = lambda_.CapacityProvider(self, "MyCapacityProvider",
subnets=vpc.private_subnets,
security_groups=[security_group],
propagate_tags=lambda_.PropagateTags.explicit({
"CostCenter": "Engineering",
"Project": "MyProject"
})
)
java
import software.amazon.awscdk.services.ec2.*;
Vpc vpc = new Vpc(this, "MyVpc");
SecurityGroup securityGroup = SecurityGroup.Builder.create(this, "SecurityGroup").vpc(vpc).build();
CapacityProvider capacityProvider = CapacityProvider.Builder.create(this, "MyCapacityProvider")
.subnets(vpc.getPrivateSubnets())
.securityGroups(List.of(securityGroup))
.propagateTags(PropagateTags.explicit(Map.of(
"CostCenter", "Engineering",
"Project", "MyProject")))
.build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
using Amazon.CDK.AWS.EC2;
var vpc = new Vpc(this, "MyVpc");
var securityGroup = new SecurityGroup(this, "SecurityGroup", new SecurityGroupProps { Vpc = vpc });
var capacityProvider = new CapacityProvider(this, "MyCapacityProvider", new CapacityProviderProps {
Subnets = vpc.PrivateSubnets,
SecurityGroups = new [] { securityGroup },
PropagateTags = PropagateTags.Explicit(new Dictionary<string, string> {
{ "CostCenter", "Engineering" },
{ "Project", "MyProject" }
})
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
import "github.com/aws/aws-cdk-go/awscdk"
vpc := ec2.NewVpc(this, jsii.String("MyVpc"))
securityGroup := ec2.NewSecurityGroup(this, jsii.String("SecurityGroup"), &SecurityGroupProps{
Vpc: Vpc,
})
capacityProvider := lambda.NewCapacityProvider(this, jsii.String("MyCapacityProvider"), &CapacityProviderProps{
Subnets: vpc.PrivateSubnets,
SecurityGroups: []ISecurityGroup{
securityGroup,
},
PropagateTags: lambda.PropagateTags_Explicit(map[string]*string{
"CostCenter": jsii.String("Engineering"),
"Project": jsii.String("MyProject"),
}),
})
Properties
explicitTagsmay be undefined{ [key: string]: string }explicit_tagsmay be undefinedtyping.Mapping[str, str]explicitTagsmay be undefinedMap<String, String>ExplicitTagsmay be undefinedIDictionary<string, string>ExplicitTagsmay be undefined*map[string]*string #The explicit tags to propagate (only for Explicit mode).
The propagation mode.
Methods
explicit(tags: { [key: string]: string }): PropagateTags // chainable@staticmethod def explicit(tags: typing.Mapping[str, str]) -> PropagateTagspublic static PropagateTags explicit(Map<String, String> tags)public static PropagateTags Explicit(IDictionary<string, string> tags)func Explicit(Tags *map[string]*string) PropagateTags static #Propagate the specified tags to all managed resources.
1 parameter
Parameters
tagstagstagstagsTags— A map of tag keys to values to propagate.
none(): PropagateTags // chainable@staticmethod def none() -> PropagateTagspublic static PropagateTags none()public static PropagateTags None()func None() PropagateTags static #No tag propagation to managed resources.