aws-cdk-lib.Tags

class Tags

LanguageType name
.NETAmazon.CDK.Tags
Gogithub.com/aws/aws-cdk-go/awscdk/v2#Tags
Javasoftware.amazon.awscdk.Tags
Pythonaws_cdk.Tags
TypeScript (source)aws-cdk-lib » Tags

Manages AWS tags for all resources within a construct scope.

Example

declare const mesh: appmesh.Mesh;
declare const service: cloudmap.Service;

const node = new appmesh.VirtualNode(this, 'node', {
  mesh,
  serviceDiscovery: appmesh.ServiceDiscovery.cloudMap(service),
  listeners: [appmesh.VirtualNodeListener.http({
    port: 8080,
    healthCheck: appmesh.HealthCheck.http({
      healthyThreshold: 3,
      interval: Duration.seconds(5),
      path: '/ping',
      timeout: Duration.seconds(2),
      unhealthyThreshold: 2,
    }),
    timeout: {
      idle: Duration.seconds(5),
    },
  })],
  backendDefaults: {
    tlsClientPolicy: {
      validation: {
        trust: appmesh.TlsValidationTrust.file('/keys/local_cert_chain.pem'),
      },
    },
  },
  accessLog: appmesh.AccessLog.fromFilePath('/dev/stdout'),
});

cdk.Tags.of(node).add('Environment', 'Dev');

Methods

NameDescription
add(key, value, props?)add tags to the node of a construct and all its the taggable children.
remove(key, props?)remove tags to the node of a construct and all its the taggable children.
static of(scope)Returns the tags API for this scope.

add(key, value, props?)

public add(key: string, value: string, props?: TagProps): void

Parameters

  • key string
  • value string
  • props TagProps

add tags to the node of a construct and all its the taggable children.


remove(key, props?)

public remove(key: string, props?: TagProps): void

Parameters

  • key string
  • props TagProps

remove tags to the node of a construct and all its the taggable children.


static of(scope)

public static of(scope: IConstruct): Tags

Parameters

  • scope IConstruct — The scope.

Returns

  • Tags

Returns the tags API for this scope.