Class Tags
Manages AWS tags for all resources within a construct scope.
Namespace: Amazon.CDK
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class Tags : DeputyBase
Syntax (vb)
Public Class Tags Inherits DeputyBase
Remarks
ExampleMetadata: infused
Examples
Mesh mesh;
Service service;
var node = new VirtualNode(this, "node", new VirtualNodeProps {
Mesh = mesh,
ServiceDiscovery = ServiceDiscovery.CloudMap(service),
Listeners = new [] { VirtualNodeListener.Http(new HttpVirtualNodeListenerOptions {
Port = 8080,
HealthCheck = HealthCheck.Http(new HttpHealthCheckOptions {
HealthyThreshold = 3,
Interval = Duration.Seconds(5),
Path = "/ping",
Timeout = Duration.Seconds(2),
UnhealthyThreshold = 2
}),
Timeout = new HttpTimeout {
Idle = Duration.Seconds(5)
}
}) },
BackendDefaults = new BackendDefaults {
TlsClientPolicy = new TlsClientPolicy {
Validation = new TlsValidation {
Trust = TlsValidationTrust.File("/keys/local_cert_chain.pem")
}
}
},
AccessLog = AccessLog.FromFilePath("/dev/stdout")
});
Tags.Of(node).Add("Environment", "Dev");
Synopsis
Methods
| Add(string, string, ITagProps?) | Add tags to the node of a construct and all its the taggable children. |
| Of(IConstruct) | Returns the tags API for this scope. |
| Remove(string, ITagProps?) | remove tags to the node of a construct and all its the taggable children. |
Methods
Add(string, string, ITagProps?)
Add tags to the node of a construct and all its the taggable children.
public virtual void Add(string key, string value, ITagProps? props = null)
Parameters
Remarks
Tagging and CloudFormation Stacks
If the feature flag @aws-cdk/core:explicitStackTags is set to true
(recommended modern behavior), Stacks will not automatically be tagged.
Stack tags should be configured on Stacks directly (preferred), or
you must explicitly include the resource type aws:cdk:stack in the
includeResourceTypes array.
If the feature flag is set to false (legacy behavior) then both Stacks
and resources in the indicated scope will both be tagged by default, which
leads to tags being applied twice (once in the template, and then once
again automatically by CloudFormation as part of the stack deployment).
That behavior leads to loss of control as excludeResourceTypes will
prevent tags from appearing in the template, but they will still be
applied to the Stack and hence CloudFormation will still apply them
to the resource.
Of(IConstruct)
Returns the tags API for this scope.
public static Tags Of(IConstruct scope)
Parameters
- scope IConstruct
The scope.
Returns
Remarks
ExampleMetadata: infused