This documentation is for the developer preview release of the AWS CDK. Do not use this version of the AWS CDK in production. Subsequent releases of the AWS CDK will likely include breaking changes.

@aws-cdk/cdk

AWS Cloud Development Kit Core Library

This library includes the basic building blocks of the AWS Cloud Development Kit (AWS CDK).

Aspects

Aspects are a mechanism to extend the CDK without having to directly impact the class hierarchy. We have implemented aspects using the Visitor Pattern.

An aspect in the CDK is defined by this interface

Aspects can be applied to any construct. During the tree “prepare” phase the aspect will visit each construct in the tree once. Aspects are invoked in the order they were added to the construct. They traverse the construct tree in a breadth first order starting at the App ending at the leaf nodes (most commonly the CloudFormation Resource). Aspect authors implement the visit(IConstruct) function and can inspect the Construct for specific characteristics. Such as, is this construct a CloudFormation Resource?

Tagging

Tags are implemented using aspects.

Tags can be applied to any construct. Tags are inherited, based on the scope. If you tag construct A, and A contains construct B, construct B inherits the tag. The Tag API supports:

  • Tag add (apply) a tag, either to specific resources or all but specific resources
  • RemoveTag remove a tag, again either from specific resources or all but specific resources

A simple example, if you create a stack and want anything in the stack to receive a tag:

import cdk = require('@aws-cdk/cdk');

const app = new cdk.App();
const theBestStack = new cdk.Stack(app, 'MarketingSystem');
theBestStack.node.apply(new cdk.Tag('StackType', 'TheBest'));

// any resources added that support tags will get them
The goal was to enable the ability to define tags in one place and have them applied consistently for all resources that support tagging. In addition the developer should not have to know if the resource supports tags. The developer defines the tagging intents for all resources within a path. If the resources support tags they are added, else no action is taken.

Tag Example with ECS

We are going to use the ECS example as starting point.

For the purposes of example, this ECS cluster is for the Marketing Department. Marketing has two core groups Business to Business (B2B) and Business to Consumer (B2C). However, the Marketing team relies on the Platform team to help build the common components across businesses and separates costs to match. The goal here is tag the Platform team resources, the Marketing Department and then Marketing groups to enable proper cost allocations.

We have modified the example and the code is located: examples/cdk-examples-typescript/hello-cdk-ecs-tags

When the example is run the following tags are created:

We are omitting the default tags for VPC components.
Construct Path Tag Key Tag Value
MarketingSystem/MarketingVpc CostCenter Platform
MarketingSystem/MarketingVpc/PublicSubnet1 CostCenter Platform
MarketingSystem/MarketingVpc/PublicSubnet1/RouteTable CostCenter Platform
MarketingSystem/MarketingVpc/PublicSubnet1/NATGateway CostCenter Platform
MarketingSystem/MarketingVpc/PublicSubnet2 CostCenter Platform
MarketingSystem/MarketingVpc/PublicSubnet2/RouteTable CostCenter Platform
MarketingSystem/MarketingVpc/PublicSubnet2/NATGateway CostCenter Platform
MarketingSystem/MarketingVpc/PublicSubnet3 CostCenter Platform
MarketingSystem/MarketingVpc/PublicSubnet3/RouteTable CostCenter Platform
MarketingSystem/MarketingVpc/PublicSubnet3/NATGateway CostCenter Platform
MarketingSystem/MarketingVpc/PrivateSubnet1 CostCenter Platform
MarketingSystem/MarketingVpc/PrivateSubnet1/RouteTable CostCenter Platform
MarketingSystem/MarketingVpc/PrivateSubnet2 CostCenter Platform
MarketingSystem/MarketingVpc/PrivateSubnet2/RouteTable CostCenter Platform
MarketingSystem/MarketingVpc/PrivateSubnet3 CostCenter Platform
MarketingSystem/MarketingVpc/PrivateSubnet3/RouteTable CostCenter Platform
MarketingSystem/MarketingVpc/IGW CostCenter Platform
MarketingSystem/B2BService/Service/SecurityGroup/Resource CostCenter Marketing
MarketingSystem/B2BService/LB/Resource CostCenter Marketing
MarketingSystem/B2BService/LB/SecurityGroup/Resource CostCenter Marketing
MarketingSystem/B2BService/LB/PublicListener/ECSGroup/Resource CostCenter Marketing
MarketingSystem/B2CService/Service/SecurityGroup/Resource CostCenter Marketing
MarketingSystem/B2CService/LB/Resource CostCenter Marketing
MarketingSystem/B2CService/LB/SecurityGroup/Resource CostCenter Marketing
MarketingSystem/B2CService/LB/PublicListener/ECSGroup/Resource CostCenter Marketing

As you can see many tags are generated with only a few intent based directives. The CDK does default some additional tags for suggested Name keys. If you want to remove those tags you can do so by using the RemoveTag aspect, see below:

// snip //
const vpc = new ec2.VpcNetwork(marketingStack, 'MarketingVpc', {
  maxAZs: 3 // Default is all AZs in region
  });
// override the VPC tags with Platform
// this will tag the VPC, Subnets, Route Tables, IGW, and NatGWs
vpc.node.apply(new cdk.Tag(COST_CENTER_KEY, 'Platform'));
vpc.node.apply(new cdk.RemoveTag('Name'));
// snip //

This will remove the name tags from the VPC, subnets, route tables and NAT gateways. If you’ve been following closely, this may lead you to ask how does remove work when the tag is actually applied closer to the resource? The Tag API has a few features that are covered later to explain how this works.

API

In order to enable additional controls a Tags can specifically include or exclude a CloudFormation Resource Type, propagate tags for an autoscaling group, and use priority to override the default precedence. See the TagProps interface for more details.

applyToLaunchedInstances

This property is a boolean that defaults to true. When true and the aspect visits an AutoScalingGroup resource the PropagateAtLaunch property is set to true. If false the property is set accordingly.

// ... snip
const vpc = new ec2.VpcNetwork(this, 'MyVpc', { ... });
vpc.node.apply(new cdk.Tag('MyKey', 'MyValue', { applyToLaunchedInstances: false }));
// ... snip

includeResourceTypes

Include is an array property that contains strings of CloudFormation Resource Types. As the aspect visits nodes it only takes action if node is one of the resource types in the array. By default the array is empty and an empty array is interpreted as apply to any resource type.

// ... snip
const vpc = new ec2.VpcNetwork(this, 'MyVpc', { ... });
vpc.node.apply(new cdk.Tag('MyKey', 'MyValue', { includeResourceTypes: ['AWS::EC2::Subnet']}));
// ... snip

excludeResourceTypes

Exclude is the inverse of include. Exclude is also an array of CloudFormation Resource Types. As the aspect visit nodes it will not take action if the node is one of the resource types in the array. By default the array is empty and an empty array is interpreted to match no resource type. Exclude takes precedence over include in the event of a collision.

// ... snip
const vpc = new ec2.VpcNetwork(this, 'MyVpc', { ... });
vpc.node.apply(new cdk.Tag('MyKey', 'MyValue', { exludeResourceTypes: ['AWS::EC2::Subnet']}));
// ... snip

priority

Priority is used to control precedence when the default pattern does not work. In general users should try to avoid using priority, but in some situations it is required. In the example above, this is how RemoveTag works. The default setting for removing tags uses a higher priority than the standard tag.

// ... snip
const vpc = new ec2.VpcNetwork(this, 'MyVpc', { ... });
vpc.node.apply(new cdk.Tag('MyKey', 'MyValue', { priority: 2 }));
// ... snip

Reference

View in Nuget

csproj:

<PackageReference Include="Amazon.CDK" Version="0.25.3" />

dotnet:

dotnet add package Amazon.CDK --version 0.25.3

packages.config:

<package id="Amazon.CDK" version="0.25.3" />

View in Maven Central

Apache Buildr:

'software.amazon.awscdk:cdk:jar:0.25.3'

Apache Ivy:

<dependency groupId="software.amazon.awscdk" name="cdk" rev="0.25.3"/>

Apache Maven:

<dependency>
  <groupId>software.amazon.awscdk</groupId>
  <artifactId>cdk</artifactId>
  <version>0.25.3</version>
</dependency>

Gradle / Grails:

compile 'software.amazon.awscdk:cdk:0.25.3'

Groovy Grape:

@Grapes(
@Grab(group='software.amazon.awscdk', module='cdk', version='0.25.3')
)

View in NPM

npm:

$ npm i @aws-cdk/cdk@0.25.3

package.json:

{
  "@aws-cdk/cdk": "^0.25.3"
}

yarn:

$ yarn add @aws-cdk/cdk@0.25.3

View in NPM

npm:

$ npm i @aws-cdk/cdk@0.25.3

package.json:

{
  "@aws-cdk/cdk": "^0.25.3"
}

yarn:

$ yarn add @aws-cdk/cdk@0.25.3

App

class @aws-cdk/cdk.App([context])

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.App;
const { App } = require('@aws-cdk/cdk');
import { App } from '@aws-cdk/cdk';

Represents a CDK program.

Extends:Root
Parameters:context (string => string (optional)) –
run() → @aws-cdk/cdk.ISynthesisSession

Runs the program. Output is written to output directory as specified in the request.

Return type:ISynthesisSession
synthesizeStack(stackName) → @aws-cdk/cx-api.SynthesizedStack

Synthesize and validate a single stack.

Parameters:stackName (string) – The name of the stack to synthesize
Return type:@aws-cdk/cx-api.SynthesizedStack
synthesizeStacks(stackNames) → @aws-cdk/cx-api.SynthesizedStack[]

Synthesizes multiple stacks

Parameters:stackNames (string[]) –
Return type:@aws-cdk/cx-api.SynthesizedStack[]
prepare()

Inherited from @aws-cdk/cdk.Construct

Perform final modifications before synthesis

This method can be implemented by derived constructs in order to perform

final changes before synthesis. prepare() will be called after child

constructs have been prepared.

This is an advanced framework feature. Only use this if you

understand the implications.

Protected method

toString() → string

Inherited from @aws-cdk/cdk.Construct

Returns a string representation of this construct.

Return type:string
validate() → string[]

Inherited from @aws-cdk/cdk.Construct

Validate the current construct.

This method can be implemented by derived constructs in order to perform

validation logic. It is called on all constructs before synthesis.

Protected method

Returns:An array of validation error messages, or an empty array if there the construct is valid.
Return type:string[]
dependencyRoots

Inherited from @aws-cdk/cdk.Construct

The set of constructs that form the root of this dependable

All resources under all returned constructs are included in the ordering

dependency.

Type:IConstruct[] (readonly)
node

Inherited from @aws-cdk/cdk.Construct

Construct node.

Type:ConstructNode (readonly)

ArnComponents (interface)

class @aws-cdk/cdk.ArnComponents

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.ArnComponents;
// ArnComponents is an interface
import { ArnComponents } from '@aws-cdk/cdk';
resource

Resource type (e.g. “table”, “autoScalingGroup”, “certificate”).

For some resource types, e.g. S3 buckets, this field defines the bucket name.

Type:string
service

The service namespace that identifies the AWS product (for example,

‘s3’, ‘iam’, ‘codepipline’).

Type:string
account

The ID of the AWS account that owns the resource, without the hyphens.

For example, 123456789012. Note that the ARNs for some resources don’t

require an account number, so this component might be omitted.

Type:string (optional)
Default:The account the stack is deployed to.
partition

The partition that the resource is in. For standard AWS regions, the

partition is aws. If you have resources in other partitions, the

partition is aws-partitionname. For example, the partition for resources

in the China (Beijing) region is aws-cn.

Type:string (optional)
Default:The AWS partition the stack is deployed to.
region

The region the resource resides in. Note that the ARNs for some resources

do not require a region, so this component might be omitted.

Type:string (optional)
Default:The region the stack is deployed to.
resourceName

Resource name or path within the resource (i.e. S3 bucket object key) or

a wildcard such as "*". This is service-dependent.

Type:string (optional)
sep

Separator between resource type and the resource.

Can be either ‘/’, ‘:’ or an empty string. Will only be used if resourceName is defined.

Type:string (optional)
Default:‘/’

AutoScalingCreationPolicy (interface)

class @aws-cdk/cdk.AutoScalingCreationPolicy

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.AutoScalingCreationPolicy;
// AutoScalingCreationPolicy is an interface
import { AutoScalingCreationPolicy } from '@aws-cdk/cdk';

For an Auto Scaling group replacement update, specifies how many instances must signal success for the

update to succeed.

minSuccessfulInstancesPercent

Specifies the percentage of instances in an Auto Scaling replacement update that must signal success for the

update to succeed. You can specify a value from 0 to 100. AWS CloudFormation rounds to the nearest tenth of a percent.

For example, if you update five instances with a minimum successful percentage of 50, three instances must signal success.

If an instance doesn’t send a signal within the time specified by the Timeout property, AWS CloudFormation assumes that the

instance wasn’t created.

Type:number (optional)

AutoScalingReplacingUpdate (interface)

class @aws-cdk/cdk.AutoScalingReplacingUpdate

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.AutoScalingReplacingUpdate;
// AutoScalingReplacingUpdate is an interface
import { AutoScalingReplacingUpdate } from '@aws-cdk/cdk';

Specifies whether an Auto Scaling group and the instances it contains are replaced during an update. During replacement,

AWS CloudFormation retains the old group until it finishes creating the new one. If the update fails, AWS CloudFormation

can roll back to the old Auto Scaling group and delete the new Auto Scaling group.

While AWS CloudFormation creates the new group, it doesn’t detach or attach any instances. After successfully creating

the new Auto Scaling group, AWS CloudFormation deletes the old Auto Scaling group during the cleanup process.

When you set the WillReplace parameter, remember to specify a matching CreationPolicy. If the minimum number of

instances (specified by the MinSuccessfulInstancesPercent property) don’t signal success within the Timeout period

(specified in the CreationPolicy policy), the replacement update fails and AWS CloudFormation rolls back to the old

Auto Scaling group.

willReplace
Type:boolean (optional)

AutoScalingRollingUpdate (interface)

class @aws-cdk/cdk.AutoScalingRollingUpdate

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.AutoScalingRollingUpdate;
// AutoScalingRollingUpdate is an interface
import { AutoScalingRollingUpdate } from '@aws-cdk/cdk';

To specify how AWS CloudFormation handles rolling updates for an Auto Scaling group, use the AutoScalingRollingUpdate

policy. Rolling updates enable you to specify whether AWS CloudFormation updates instances that are in an Auto Scaling

group in batches or all at once.

maxBatchSize

Specifies the maximum number of instances that AWS CloudFormation updates.

Type:number (optional)
minInstancesInService

Specifies the minimum number of instances that must be in service within the Auto Scaling group while AWS

CloudFormation updates old instances.

Type:number (optional)
minSuccessfulInstancesPercent

Specifies the percentage of instances in an Auto Scaling rolling update that must signal success for an update to succeed.

You can specify a value from 0 to 100. AWS CloudFormation rounds to the nearest tenth of a percent. For example, if you

update five instances with a minimum successful percentage of 50, three instances must signal success.

If an instance doesn’t send a signal within the time specified in the PauseTime property, AWS CloudFormation assumes

that the instance wasn’t updated.

If you specify this property, you must also enable the WaitOnResourceSignals and PauseTime properties.

Type:number (optional)
pauseTime

The amount of time that AWS CloudFormation pauses after making a change to a batch of instances to give those instances

time to start software applications. For example, you might need to specify PauseTime when scaling up the number of

instances in an Auto Scaling group.

If you enable the WaitOnResourceSignals property, PauseTime is the amount of time that AWS CloudFormation should wait

for the Auto Scaling group to receive the required number of valid signals from added or replaced instances. If the

PauseTime is exceeded before the Auto Scaling group receives the required number of signals, the update fails. For best

results, specify a time period that gives your applications sufficient time to get started. If the update needs to be

rolled back, a short PauseTime can cause the rollback to fail.

Specify PauseTime in the ISO8601 duration format (in the format PT#H#M#S, where each # is the number of hours, minutes,

and seconds, respectively). The maximum PauseTime is one hour (PT1H).

Type:string (optional)
suspendProcesses

Specifies the Auto Scaling processes to suspend during a stack update. Suspending processes prevents Auto Scaling from

interfering with a stack update. For example, you can suspend alarming so that Auto Scaling doesn’t execute scaling

policies associated with an alarm. For valid values, see the ScalingProcesses.member.N parameter for the SuspendProcesses

action in the Auto Scaling API Reference.

Type:string[] (optional)
waitOnResourceSignals

Specifies whether the Auto Scaling group waits on signals from new instances during an update. Use this property to

ensure that instances have completed installing and configuring applications before the Auto Scaling group update proceeds.

AWS CloudFormation suspends the update of an Auto Scaling group after new EC2 instances are launched into the group.

AWS CloudFormation must receive a signal from each new instance within the specified PauseTime before continuing the update.

To signal the Auto Scaling group, use the cfn-signal helper script or SignalResource API.

To have instances wait for an Elastic Load Balancing health check before they signal success, add a health-check

verification by using the cfn-init helper script. For an example, see the verify_instance_health command in the Auto Scaling

rolling updates sample template.

Type:boolean (optional)

AutoScalingScheduledAction (interface)

class @aws-cdk/cdk.AutoScalingScheduledAction

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.AutoScalingScheduledAction;
// AutoScalingScheduledAction is an interface
import { AutoScalingScheduledAction } from '@aws-cdk/cdk';

With scheduled actions, the group size properties of an Auto Scaling group can change at any time. When you update a

stack with an Auto Scaling group and scheduled action, AWS CloudFormation always sets the group size property values of

your Auto Scaling group to the values that are defined in the AWS::AutoScaling::AutoScalingGroup resource of your template,

even if a scheduled action is in effect.

If you do not want AWS CloudFormation to change any of the group size property values when you have a scheduled action in

effect, use the AutoScalingScheduledAction update policy to prevent AWS CloudFormation from changing the MinSize, MaxSize,

or DesiredCapacity properties unless you have modified these values in your template.

ignoreUnmodifiedGroupSizeProperties
Type:boolean (optional)

AvailabilityZoneProvider

class @aws-cdk/cdk.AvailabilityZoneProvider(context)

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.AvailabilityZoneProvider;
const { AvailabilityZoneProvider } = require('@aws-cdk/cdk');
import { AvailabilityZoneProvider } from '@aws-cdk/cdk';

Context provider that will return the availability zones for the current account and region

Parameters:context (Construct) –
availabilityZones

Return the list of AZs for the current account and region

Type:string[] (readonly)

Aws

class @aws-cdk/cdk.Aws

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.Aws;
const { Aws } = require('@aws-cdk/cdk');
import { Aws } from '@aws-cdk/cdk';

Accessor for pseudo parameters

Since pseudo parameters need to be anchored to a stack somewhere in the

construct tree, this class takes an scope parameter; the pseudo parameter

values can be obtained as properties from an scoped object.

accountId
Type:string (readonly) (static)
notificationArns
Type:string[] (readonly) (static)
noValue
Type:string (readonly) (static)
partition
Type:string (readonly) (static)
region
Type:string (readonly) (static)
stackId
Type:string (readonly) (static)
stackName
Type:string (readonly) (static)
urlSuffix
Type:string (readonly) (static)

AwsNoValue

class @aws-cdk/cdk.AwsNoValue

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.AwsNoValue;
const { AwsNoValue } = require('@aws-cdk/cdk');
import { AwsNoValue } from '@aws-cdk/cdk';
Extends:Token
resolve(_context) → any

Inherited from @aws-cdk/cdk.Token

Parameters:_context (ResolveContext) –
Returns:The resolved value for this token.
Return type:any
toJSON() → any

Inherited from @aws-cdk/cdk.Token

Turn this Token into JSON

This gets called by JSON.stringify(). We want to prohibit this, because

it’s not possible to do this properly, so we just throw an error here.

Return type:any
toList() → string[]

Inherited from @aws-cdk/cdk.Token

Return a string list representation of this token

Call this if the Token intrinsically evaluates to a list of strings.

If so, you can represent the Token in a similar way in the type

system.

Note that even though the Token is represented as a list of strings, you

still cannot do any operations on it such as concatenation, indexing,

or taking its length. The only useful operations you can do to these lists

is constructing a FnJoin or a FnSelect on it.

Return type:string[]
toString() → string

Inherited from @aws-cdk/cdk.Token

Return a reversible string representation of this token

If the Token is initialized with a literal, the stringified value of the

literal is returned. Otherwise, a special quoted string representation

of the Token is returned that can be embedded into other strings.

Strings with quoted Tokens in them can be restored back into

complex values with the Tokens restored by calling resolve()

on the string.

Return type:string
displayName

Inherited from @aws-cdk/cdk.Token

A human-readable display hint for this Token

Type:string (optional) (readonly)
isReference

Inherited from @aws-cdk/cdk.Token

Indicate whether this Token represent a “reference”

The Construct tree can be queried for the Reference Tokens that

are used in it.

Type:boolean (optional) (readonly)
valueOrFunction

Inherited from @aws-cdk/cdk.Token

What this token will evaluate to, literal or function.

Type:any (optional) (readonly)

CfnReference

class @aws-cdk/cdk.CfnReference(value[, displayName[, scope]])

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.CfnReference;
const { CfnReference } = require('@aws-cdk/cdk');
import { CfnReference } from '@aws-cdk/cdk';

A Token that represents a CloudFormation reference to another resource

If these references are used in a different stack from where they are

defined, appropriate CloudFormation `Export`s and `Fn::ImportValue`s will be

synthesized automatically instead of the regular CloudFormation references.

Additionally, the dependency between the stacks will be recorded, and the toolkit

will make sure to deploy producing stack before the consuming stack.

This magic happens in the prepare() phase, where consuming stacks will call

consumeFromStack on these Tokens and if they happen to be exported by a different

Stack, we’ll register the dependency.

Extends:

Token

Parameters:
  • value (any) –
  • displayName (string (optional)) –
  • scope (Construct (optional)) –
static isCfnReference(x) → boolean

Check whether this is actually a CfnReference

Parameters:x (Token) –
Return type:boolean
consumeFromStack(consumingStack)

Register a stack this references is being consumed from.

Parameters:consumingStack (Stack) –
resolve(context) → any

Overrides @aws-cdk/cdk.Token.resolve()

Parameters:context (ResolveContext) –
Return type:any
isReference

Overrides @aws-cdk/cdk.Token.isReference

Indicate whether this Token represent a “reference”

The Construct tree can be queried for the Reference Tokens that

are used in it.

Type:boolean (optional) (readonly)
toJSON() → any

Inherited from @aws-cdk/cdk.Token

Turn this Token into JSON

This gets called by JSON.stringify(). We want to prohibit this, because

it’s not possible to do this properly, so we just throw an error here.

Return type:any
toList() → string[]

Inherited from @aws-cdk/cdk.Token

Return a string list representation of this token

Call this if the Token intrinsically evaluates to a list of strings.

If so, you can represent the Token in a similar way in the type

system.

Note that even though the Token is represented as a list of strings, you

still cannot do any operations on it such as concatenation, indexing,

or taking its length. The only useful operations you can do to these lists

is constructing a FnJoin or a FnSelect on it.

Return type:string[]
toString() → string

Inherited from @aws-cdk/cdk.Token

Return a reversible string representation of this token

If the Token is initialized with a literal, the stringified value of the

literal is returned. Otherwise, a special quoted string representation

of the Token is returned that can be embedded into other strings.

Strings with quoted Tokens in them can be restored back into

complex values with the Tokens restored by calling resolve()

on the string.

Return type:string
displayName

Inherited from @aws-cdk/cdk.Token

A human-readable display hint for this Token

Type:string (optional) (readonly)
valueOrFunction

Inherited from @aws-cdk/cdk.Token

What this token will evaluate to, literal or function.

Type:any (optional) (readonly)

CfnTag (interface)

class @aws-cdk/cdk.CfnTag

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.CfnTag;
// CfnTag is an interface
import { CfnTag } from '@aws-cdk/cdk';
key
Type:string
value
Type:string

CloudFormationJSON

class @aws-cdk/cdk.CloudFormationJSON

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.CloudFormationJSON;
const { CloudFormationJSON } = require('@aws-cdk/cdk');
import { CloudFormationJSON } from '@aws-cdk/cdk';

Class for JSON routines that are framework-aware

static stringify(obj, context) → string

Turn an arbitrary structure potentially containing Tokens into a JSON string.

Returns a Token which will evaluate to CloudFormation expression that

will be evaluated by CloudFormation to the JSON representation of the

input structure.

All Tokens substituted in this way must return strings, or the evaluation

in CloudFormation will fail.

Parameters:
  • obj (any) – The object to stringify
  • context (IConstruct) – The Construct from which to resolve any Tokens found in the object
Return type:

string

CodeDeployLambdaAliasUpdate (interface)

class @aws-cdk/cdk.CodeDeployLambdaAliasUpdate

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.CodeDeployLambdaAliasUpdate;
// CodeDeployLambdaAliasUpdate is an interface
import { CodeDeployLambdaAliasUpdate } from '@aws-cdk/cdk';

To perform an AWS CodeDeploy deployment when the version changes on an AWS::Lambda::Alias resource,

use the CodeDeployLambdaAliasUpdate update policy.

applicationName

The name of the AWS CodeDeploy application.

Type:string
deploymentGroupName

The name of the AWS CodeDeploy deployment group. This is where the traffic-shifting policy is set.

Type:string
afterAllowTrafficHook

The name of the Lambda function to run after traffic routing completes.

Type:string (optional)
beforeAllowTrafficHook

The name of the Lambda function to run before traffic routing starts.

Type:string (optional)

ConcreteDependable

class @aws-cdk/cdk.ConcreteDependable

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.ConcreteDependable;
const { ConcreteDependable } = require('@aws-cdk/cdk');
import { ConcreteDependable } from '@aws-cdk/cdk';

A set of constructs to be used as a dependable

This class can be used when a set of constructs which are disjoint in the

construct tree needs to be combined to be used as a single dependable.

Implements:IDependable
add(construct)

Add a construct to the dependency roots

Parameters:construct (IConstruct) –
dependencyRoots

Implements @aws-cdk/cdk.IDependable.dependencyRoots()

Retrieve the current set of dependency roots

Type:IConstruct[] (readonly)

Condition

class @aws-cdk/cdk.Condition(scope, id[, props])

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.Condition;
const { Condition } = require('@aws-cdk/cdk');
import { Condition } from '@aws-cdk/cdk';

Represents a CloudFormation condition, for resources which must be conditionally created and

the determination must be made at deploy time.

Extends:

Referenceable

Implements:

IConditionExpression

Parameters:
resolve(_context) → any

Implements @aws-cdk/cdk.IConditionExpression.resolve()

Synthesizes the condition.

Parameters:_context (ResolveContext) –
Return type:any
toCloudFormation() → json

Implements @aws-cdk/cdk.StackElement.toCloudFormation()

Returns the CloudFormation ‘snippet’ for this entity. The snippet will only be merged

at the root level to ensure there are no identity conflicts.

For example, a Resource class will return something like:

{

Resources: {

[this.logicalId]: {

Type: this.resourceType,

Properties: this.props,

Condition: this.condition

}

}

}

Return type:json
expression

The condition statement.

Type:IConditionExpression (optional)
toString() → string

Inherited from @aws-cdk/cdk.Construct

Returns a string representation of this construct.

Return type:string
validate() → string[]

Inherited from @aws-cdk/cdk.Construct

Validate the current construct.

This method can be implemented by derived constructs in order to perform

validation logic. It is called on all constructs before synthesis.

Protected method

Returns:An array of validation error messages, or an empty array if there the construct is valid.
Return type:string[]
dependencyRoots

Inherited from @aws-cdk/cdk.Construct

The set of constructs that form the root of this dependable

All resources under all returned constructs are included in the ordering

dependency.

Type:IConstruct[] (readonly)
node

Inherited from @aws-cdk/cdk.Construct

Construct node.

Type:ConstructNode (readonly)
ref

Inherited from @aws-cdk/cdk.Referenceable

Returns a token to a CloudFormation { Ref } that references this entity based on it’s logical ID.

Type:string (readonly)
overrideLogicalId(newLogicalId)

Inherited from @aws-cdk/cdk.StackElement

Overrides the auto-generated logical ID with a specific ID.

Parameters:newLogicalId (string) – The new logical ID to use for this stack element.
prepare()

Inherited from @aws-cdk/cdk.StackElement

Automatically detect references in this StackElement

Protected method

creationStackTrace

Inherited from @aws-cdk/cdk.StackElement

Type:string[] (readonly)
logicalId

Inherited from @aws-cdk/cdk.StackElement

The logical ID for this CloudFormation stack element. The logical ID of the element

is calculated from the path of the resource node in the construct tree.

To override this value, use overrideLogicalId(newLogicalId).

Type:string (readonly)
stackPath

Inherited from @aws-cdk/cdk.StackElement

Return the path with respect to the stack

Type:string (readonly)

ConditionProps (interface)

class @aws-cdk/cdk.ConditionProps

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.ConditionProps;
// ConditionProps is an interface
import { ConditionProps } from '@aws-cdk/cdk';
expression
Type:IConditionExpression (optional)

Construct

class @aws-cdk/cdk.Construct(scope, id)

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.Construct;
const { Construct } = require('@aws-cdk/cdk');
import { Construct } from '@aws-cdk/cdk';

Represents the building block of the construct graph.

All constructs besides the root construct must be created within the scope of

another construct.

Implements:

IConstruct

Parameters:
  • scope (Construct) – The scope in which to define this construct
  • id (string) – The scoped construct ID. Must be unique amongst siblings. If the ID includes a path separator (/), then it will be replaced by double dash .
static isConstruct(x) → boolean

Return whether the given object is a Construct

Parameters:x (IConstruct) –
Return type:boolean
prepare()

Perform final modifications before synthesis

This method can be implemented by derived constructs in order to perform

final changes before synthesis. prepare() will be called after child

constructs have been prepared.

This is an advanced framework feature. Only use this if you

understand the implications.

Protected method

toString() → string

Returns a string representation of this construct.

Return type:string
validate() → string[]

Validate the current construct.

This method can be implemented by derived constructs in order to perform

validation logic. It is called on all constructs before synthesis.

Protected method

Returns:An array of validation error messages, or an empty array if there the construct is valid.
Return type:string[]
dependencyRoots

Implements @aws-cdk/cdk.IDependable.dependencyRoots()

The set of constructs that form the root of this dependable

All resources under all returned constructs are included in the ordering

dependency.

Type:IConstruct[] (readonly)
node

Implements @aws-cdk/cdk.IConstruct.node()

Construct node.

Type:ConstructNode (readonly)

ConstructNode

class @aws-cdk/cdk.ConstructNode(host, scope, id)

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.ConstructNode;
const { ConstructNode } = require('@aws-cdk/cdk');
import { ConstructNode } from '@aws-cdk/cdk';

Represents the construct node in the scope tree.

Parameters:
addChild(child, childName)

Adds a child construct to this node.

Parameters:
  • child (IConstruct) – The child construct
  • childName (string) –
Returns:

The resolved path part name of the child

addDependency(*dependencies)

Add an ordering dependency on another Construct.

All constructs in the dependency’s scope will be deployed before any

construct in this construct’s scope.

Parameters:*dependencies (IDependable) –
addError(message)

Adds an { error: <message> } metadata entry to this construct.

The toolkit will fail synthesis when errors are reported.

Parameters:message (string) – The error message.
addInfo(message)

Adds a { “aws:cdk:info”: <message> } metadata entry to this construct.

The toolkit will display the info message when apps are synthesized.

Parameters:message (string) – The info message.
addMetadata(type, data[, from])

Adds a metadata entry to this construct.

Entries are arbitrary values and will also include a stack trace to allow tracing back to

the code location for when the entry was added. It can be used, for example, to include source

mapping in CloudFormation templates to improve diagnostics.

Parameters:
  • type (string) – a string denoting the type of metadata
  • data (any) – the value of the metadata (can be a Token). If null/undefined, metadata will not be added.
  • from (any (optional)) – a function under which to restrict the metadata entry’s stack trace (defaults to this.addMetadata)
addWarning(message)

Adds a { warning: <message> } metadata entry to this construct.

The toolkit will display the warning when an app is synthesized, or fail

if run in –strict mode.

Parameters:message (string) – The warning message.
ancestors([upTo]) → @aws-cdk/cdk.IConstruct[]

Return the ancestors (including self) of this Construct up until and excluding the indicated component

Parameters:upTo (Construct (optional)) –
Return type:IConstruct[]
apply(aspect)

Applies the aspect to this Constructs node

Parameters:aspect (IAspect) –
findAll([order]) → @aws-cdk/cdk.IConstruct[]

Return this construct and all of its children in the given order

Parameters:order (ConstructOrder (optional)) –
Return type:IConstruct[]
findChild(path) → @aws-cdk/cdk.IConstruct

Return a descendant by path

Throws an exception if the descendant is not found.

Note that if the original ID of the construct you are looking for contained

a ‘/’, then it would have been replaced by ‘–’.

Parameters:path (string) –
Returns:Child with the given path.
Return type:IConstruct
findDependencies() → @aws-cdk/cdk.Dependency[]

Return all dependencies registered on this node or any of its children

Return type:Dependency[]
findReferences() → @aws-cdk/cdk.Token[]

Return all references of the given type originating from this node or any of its children

Return type:Token[]
getContext(key) → any

Retrieves a value from tree context.

Context is usually initialized at the root, but can be overridden at any point in the tree.

Parameters:key (string) – The context key
Returns:The context value or undefined
Return type:any
lock()

Locks this construct from allowing more children to be added. After this

call, no more children can be added to this construct or to any children.

prepareTree()

Run ‘prepare()’ on all constructs in the tree

recordReference(*refs)

Record a reference originating from this construct node

Parameters:*refs (Token) –
requireContext(key) → any

Retrieve a value from tree-global context

It is an error if the context object is not available.

Parameters:key (string) –
Return type:any
required(props, name) → any

Throws if the props bag doesn’t include the property name.

In the future we can add some type-checking here, maybe even auto-generate during compilation.

Parameters:
  • props (any) – The props bag.
  • name (string) – The name of the required property.
Return type:

any

resolve(obj) → any

Resolve a tokenized value in the context of the current Construct

Parameters:obj (any) –
Return type:any
setContext(key, value)

This can be used to set contextual values.

Context must be set before any children are added, since children may consult context info during construction.

If the key already exists, it will be overridden.

Parameters:
  • key (string) – The context key
  • value (any) – The context value
stringifyJson(obj) → string

Convert an object, potentially containing tokens, to a JSON string

Parameters:obj (any) –
Return type:string
toTreeString([depth]) → string

Returns a string with a tree representation of this construct and it’s children.

Parameters:depth (number (optional)) –
Return type:string
tryFindChild(path) → @aws-cdk/cdk.IConstruct

Return a descendant by path, or undefined

Note that if the original ID of the construct you are looking for contained

a ‘/’, then it would have been replaced by ‘–’.

Parameters:path (string) –
Returns:a child by path or undefined if not found.
Return type:IConstruct (optional)
unlock()

Unlocks this costruct and allows mutations (adding children).

validateTree() → @aws-cdk/cdk.ValidationError[]

Invokes ‘validate’ on all child constructs and then on this construct (depth-first).

Returns:A list of validation errors. If the list is empty, all constructs are valid.
Return type:ValidationError[]
aspects

An array of aspects applied to this node

Type:IAspect[] (readonly)
children

All direct children of this construct.

Type:IConstruct[] (readonly)
host
Type:Construct (readonly)
id

The scoped construct ID

This ID is unique amongst all constructs defined in the same scope.

To obtain a global unique id for this construct, use uniqueId.

Type:string (readonly)
locked

Returns true if this construct or the scopes in which it is defined are

locked.

Type:boolean (readonly)
metadata

An array of metadata objects associated with this construct.

This can be used, for example, to implement support for deprecation notices, source mapping, etc.

Type:MetadataEntry[] (readonly)
path

The full path of this construct in the tree.

Components are separated by ‘/’.

Type:string (readonly)
stack

The stack the construct is a part of.

Type:Stack (readonly)
typename
Type:string (readonly)
uniqueId

A tree-global unique alphanumeric identifier for this construct.

Includes all components of the tree.

Type:string (readonly)
scope

Returns the scope in which this construct is defined.

Type:IConstruct (optional) (readonly)

ConstructOrder (enum)

class @aws-cdk/cdk.ConstructOrder

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.ConstructOrder;
const { ConstructOrder } = require('@aws-cdk/cdk');
import { ConstructOrder } from '@aws-cdk/cdk';

In what order to return constructs

PreOrder

Depth-first, pre-order

PostOrder

Depth-first, post-order (leaf nodes first)

ContextProvider

class @aws-cdk/cdk.ContextProvider(context, provider[, props])

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.ContextProvider;
const { ContextProvider } = require('@aws-cdk/cdk');
import { ContextProvider } from '@aws-cdk/cdk';

Base class for the model side of context providers

Instances of this class communicate with context provider plugins in the ‘cdk

toolkit’ via context variables (input), outputting specialized queries for

more context variables (output).

ContextProvider needs access to a Construct to hook into the context mechanism.

Parameters:
  • context (Construct) –
  • provider (string) –
  • props (string => any (optional)) –
getStringListValue(defaultValue) → string[]

Read a provider value, verifying it’s a list

Parameters:defaultValue (string[]) – The value to return if there is no value defined for this context key
Return type:string[]
getStringValue(defaultValue) → string

Read a provider value, verifying it’s a string

Parameters:defaultValue (string) – The value to return if there is no value defined for this context key
Return type:string
getValue(defaultValue) → any

Read a provider value and verify it is not null

Parameters:defaultValue (any) –
Return type:any
context
Type:Construct (readonly)
key
Type:string (readonly)
provider
Type:string (readonly)

CreationPolicy (interface)

class @aws-cdk/cdk.CreationPolicy

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.CreationPolicy;
// CreationPolicy is an interface
import { CreationPolicy } from '@aws-cdk/cdk';

Associate the CreationPolicy attribute with a resource to prevent its status from reaching create complete until

AWS CloudFormation receives a specified number of success signals or the timeout period is exceeded. To signal a

resource, you can use the cfn-signal helper script or SignalResource API. AWS CloudFormation publishes valid signals

to the stack events so that you track the number of signals sent.

The creation policy is invoked only when AWS CloudFormation creates the associated resource. Currently, the only

AWS CloudFormation resources that support creation policies are AWS::AutoScaling::AutoScalingGroup, AWS::EC2::Instance,

and AWS::CloudFormation::WaitCondition.

Use the CreationPolicy attribute when you want to wait on resource configuration actions before stack creation proceeds.

For example, if you install and configure software applications on an EC2 instance, you might want those applications to

be running before proceeding. In such cases, you can add a CreationPolicy attribute to the instance, and then send a success

signal to the instance after the applications are installed and configured. For a detailed example, see Deploying Applications

on Amazon EC2 with AWS CloudFormation.

autoScalingCreationPolicy

For an Auto Scaling group replacement update, specifies how many instances must signal success for the

update to succeed.

Type:AutoScalingCreationPolicy (optional)
resourceSignal

When AWS CloudFormation creates the associated resource, configures the number of required success signals and

the length of time that AWS CloudFormation waits for those signals.

Type:ResourceSignal (optional)

DeletionPolicy (enum)

class @aws-cdk/cdk.DeletionPolicy

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.DeletionPolicy;
const { DeletionPolicy } = require('@aws-cdk/cdk');
import { DeletionPolicy } from '@aws-cdk/cdk';

With the DeletionPolicy attribute you can preserve or (in some cases) backup a resource when its stack is deleted.

You specify a DeletionPolicy attribute for each resource that you want to control. If a resource has no DeletionPolicy

attribute, AWS CloudFormation deletes the resource by default. Note that this capability also applies to update operations

that lead to resources being removed.

Delete

AWS CloudFormation deletes the resource and all its content if applicable during stack deletion. You can add this

deletion policy to any resource type. By default, if you don’t specify a DeletionPolicy, AWS CloudFormation deletes

your resources. However, be aware of the following considerations:

Retain

AWS CloudFormation keeps the resource without deleting the resource or its contents when its stack is deleted.

You can add this deletion policy to any resource type. Note that when AWS CloudFormation completes the stack deletion,

the stack will be in Delete_Complete state; however, resources that are retained continue to exist and continue to incur

applicable charges until you delete those resources.

Snapshot

For resources that support snapshots (AWS::EC2::Volume, AWS::ElastiCache::CacheCluster, AWS::ElastiCache::ReplicationGroup,

AWS::RDS::DBInstance, AWS::RDS::DBCluster, and AWS::Redshift::Cluster), AWS CloudFormation creates a snapshot for the

resource before deleting it. Note that when AWS CloudFormation completes the stack deletion, the stack will be in the

Delete_Complete state; however, the snapshots that are created with this policy continue to exist and continue to

incur applicable charges until you delete those snapshots.

Dependency (interface)

class @aws-cdk/cdk.Dependency

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.Dependency;
// Dependency is an interface
import { Dependency } from '@aws-cdk/cdk';

A single dependency

A single dependency

source

Source the dependency

Source the dependency

Type:IConstruct
target

Target of the dependency

Target of the dependency

Type:IConstruct

DynamicReference

class @aws-cdk/cdk.DynamicReference(scope, id, props)

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.DynamicReference;
const { DynamicReference } = require('@aws-cdk/cdk');
import { DynamicReference } from '@aws-cdk/cdk';

References a dynamically retrieved value

This is a Construct so that subclasses will (eventually) be able to attach

metadata to themselves without having to change call signatures.

Extends:

Construct

Parameters:
makeResolveValue(service, referenceKey) → string

Make a dynamic reference Token value

This is a value (similar to CDK Tokens) that will be substituted by

CloudFormation before executing the changeset.

Protected method

Parameters:
Return type:

string

stringValue

The value of this dynamic reference

Type:string (readonly)
prepare()

Inherited from @aws-cdk/cdk.Construct

Perform final modifications before synthesis

This method can be implemented by derived constructs in order to perform

final changes before synthesis. prepare() will be called after child

constructs have been prepared.

This is an advanced framework feature. Only use this if you

understand the implications.

Protected method

toString() → string

Inherited from @aws-cdk/cdk.Construct

Returns a string representation of this construct.

Return type:string
validate() → string[]

Inherited from @aws-cdk/cdk.Construct

Validate the current construct.

This method can be implemented by derived constructs in order to perform

validation logic. It is called on all constructs before synthesis.

Protected method

Returns:An array of validation error messages, or an empty array if there the construct is valid.
Return type:string[]
dependencyRoots

Inherited from @aws-cdk/cdk.Construct

The set of constructs that form the root of this dependable

All resources under all returned constructs are included in the ordering

dependency.

Type:IConstruct[] (readonly)
node

Inherited from @aws-cdk/cdk.Construct

Construct node.

Type:ConstructNode (readonly)

DynamicReferenceProps (interface)

class @aws-cdk/cdk.DynamicReferenceProps

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.DynamicReferenceProps;
// DynamicReferenceProps is an interface
import { DynamicReferenceProps } from '@aws-cdk/cdk';

Properties for a Dynamic Reference

referenceKey

The reference key of the dynamic reference

Type:string
service

The service to retrieve the dynamic reference from

Type:DynamicReferenceService

DynamicReferenceService (enum)

class @aws-cdk/cdk.DynamicReferenceService

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.DynamicReferenceService;
const { DynamicReferenceService } = require('@aws-cdk/cdk');
import { DynamicReferenceService } from '@aws-cdk/cdk';

The service to retrieve the dynamic reference from

Ssm

Plaintext value stored in AWS Systems Manager Parameter Store

SsmSecure

Secure string stored in AWS Systems Manager Parameter Store

SecretsManager

Secret stored in AWS Secrets Manager

Environment (interface)

class @aws-cdk/cdk.Environment

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.Environment;
// Environment is an interface
import { Environment } from '@aws-cdk/cdk';

The deployment environment for a stack.

account

The AWS account ID for this environment.

If not specified, the context parameter default-account is used.

Type:string (optional)
region

The AWS region for this environment.

If not specified, the context parameter default-region is used.

Type:string (optional)

FileSystemStore

class @aws-cdk/cdk.FileSystemStore(options)

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.FileSystemStore;
const { FileSystemStore } = require('@aws-cdk/cdk');
import { FileSystemStore } from '@aws-cdk/cdk';

Can be used to prepare and emit synthesis artifacts into an output directory.

Implements:ISessionStore
Parameters:options (FileSystemStoreOptions) –
exists(name) → boolean

Implements @aws-cdk/cdk.ISessionStore.exists()

Parameters:name (string) –
Return type:boolean
finalize()

Implements @aws-cdk/cdk.ISessionStore.finalize()

Do not allow further writes into the store.

list() → string[]

Implements @aws-cdk/cdk.ISessionStore.list()

List all top-level files that were emitted to the store.

Return type:string[]
mkdir(directoryName) → string

Implements @aws-cdk/cdk.ISessionStore.mkdir()

Creates a directory and returns it’s full path.

Parameters:directoryName (string) –
Return type:string
readdir(directoryName) → string[]

Implements @aws-cdk/cdk.ISessionStore.readdir()

Returns the list of files in a directory.

Parameters:directoryName (string) –
Return type:string[]
readFile(fileName) → any

Implements @aws-cdk/cdk.ISessionStore.readFile()

Reads a file from the store.

Parameters:fileName (string) –
Return type:any
readJson(fileName) → any

Implements @aws-cdk/cdk.ISessionStore.readJson()

Reads a JSON object from the store.

Parameters:fileName (string) –
Return type:any
writeFile(fileName, data)

Implements @aws-cdk/cdk.ISessionStore.writeFile()

Writes a file into the store.

Parameters:
  • fileName (string) –
  • data (any) –
writeJson(fileName, json)

Implements @aws-cdk/cdk.ISessionStore.writeJson()

Writes a formatted JSON output file to the store

Parameters:
  • fileName (string) –
  • json (any) –

FileSystemStoreOptions (interface)

class @aws-cdk/cdk.FileSystemStoreOptions

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.FileSystemStoreOptions;
// FileSystemStoreOptions is an interface
import { FileSystemStoreOptions } from '@aws-cdk/cdk';
outdir

The output directory for synthesis artifacts

Type:string

Fn

class @aws-cdk/cdk.Fn

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.Fn;
const { Fn } = require('@aws-cdk/cdk');
import { Fn } from '@aws-cdk/cdk';

CloudFormation intrinsic functions.

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference.html

static base64(data) → string

The intrinsic function Fn::Base64 returns the Base64 representation of

the input string. This function is typically used to pass encoded data to

Amazon EC2 instances by way of the UserData property.

Parameters:data (string) – The string value you want to convert to Base64.
Returns:a token represented as a string
Return type:string
static cidr(ipBlock, count[, sizeMask]) → string

The intrinsic function Fn::Cidr returns the specified Cidr address block.

Parameters:
  • ipBlock (string) – The user-specified default Cidr address block.
  • count (number) – The number of subnets’ Cidr block wanted. Count can be 1 to 256.
  • sizeMask (string (optional)) – The digit covered in the subnet.
Returns:

a token represented as a string

Return type:

string

static conditionAnd(*conditions) → @aws-cdk/cdk.IConditionExpression

Returns true if all the specified conditions evaluate to true, or returns

false if any one of the conditions evaluates to false. Fn::And acts as

an AND operator. The minimum number of conditions that you can include is

2, and the maximum is 10.

Parameters:*conditions (IConditionExpression) – conditions to AND
Returns:an FnCondition token
Return type:IConditionExpression
static conditionContains(listOfStrings, value) → @aws-cdk/cdk.IConditionExpression

Returns true if a specified string matches at least one value in a list of

strings.

Parameters:
  • listOfStrings (string[]) – A list of strings, such as “A”, “B”, “C”.
  • value (string) – A string, such as “A”, that you want to compare against a list of strings.
Returns:

an FnCondition token

Return type:

IConditionExpression

static conditionEquals(lhs, rhs) → @aws-cdk/cdk.IConditionExpression

Compares if two values are equal. Returns true if the two values are equal

or false if they aren’t.

Parameters:
  • lhs (any) – A value of any type that you want to compare.
  • rhs (any) – A value of any type that you want to compare.
Returns:

an FnCondition token

Return type:

IConditionExpression

static conditionIf(conditionId, valueIfTrue, valueIfFalse) → @aws-cdk/cdk.IConditionExpression

Returns one value if the specified condition evaluates to true and another

value if the specified condition evaluates to false. Currently, AWS

CloudFormation supports the Fn::If intrinsic function in the metadata

attribute, update policy attribute, and property values in the Resources

section and Outputs sections of a template. You can use the AWS::NoValue

pseudo parameter as a return value to remove the corresponding property.

Parameters:
  • conditionId (string) –
  • valueIfTrue (any) – A value to be returned if the specified condition evaluates to true.
  • valueIfFalse (any) – A value to be returned if the specified condition evaluates to false.
Returns:

an FnCondition token

Return type:

IConditionExpression

static conditionNot(condition) → @aws-cdk/cdk.IConditionExpression

Returns true for a condition that evaluates to false or returns false for a

condition that evaluates to true. Fn::Not acts as a NOT operator.

Parameters:condition (IConditionExpression) – A condition such as Fn::Equals that evaluates to true or false.
Returns:an FnCondition token
Return type:IConditionExpression
static conditionOr(*conditions) → @aws-cdk/cdk.IConditionExpression

Returns true if any one of the specified conditions evaluate to true, or

returns false if all of the conditions evaluates to false. Fn::Or acts

as an OR operator. The minimum number of conditions that you can include is

2, and the maximum is 10.

Parameters:*conditions (IConditionExpression) – conditions that evaluates to true or false.
Returns:an FnCondition token
Return type:IConditionExpression
static findInMap(mapName, topLevelKey, secondLevelKey) → string

The intrinsic function Fn::FindInMap returns the value corresponding to

keys in a two-level map that is declared in the Mappings section.

Parameters:
  • mapName (string) –
  • topLevelKey (string) –
  • secondLevelKey (string) –
Returns:

a token represented as a string

Return type:

string

static getAtt(logicalNameOfResource, attributeName) → @aws-cdk/cdk.Token

The Fn::GetAtt intrinsic function returns the value of an attribute

from a resource in the template.

Parameters:
  • logicalNameOfResource (string) – The logical name (also called logical ID) of the resource that contains the attribute that you want.
  • attributeName (string) – The name of the resource-specific attribute whose value you want. See the resource’s reference page for details about the attributes available for that resource type.
Returns:

a CloudFormationToken object

Return type:

Token

static getAZs([region]) → string[]

The intrinsic function Fn::GetAZs returns an array that lists

Availability Zones for a specified region. Because customers have access to

different Availability Zones, the intrinsic function Fn::GetAZs enables

template authors to write templates that adapt to the calling user’s

access. That way you don’t have to hard-code a full list of Availability

Zones for a specified region.

Parameters:region (string (optional)) – The name of the region for which you want to get the Availability Zones. You can use the AWS::Region pseudo parameter to specify the region in which the stack is created. Specifying an empty string is equivalent to specifying AWS::Region.
Returns:a token represented as a string array
Return type:string[]
static importValue(sharedValueToImport) → string

The intrinsic function Fn::ImportValue returns the value of an output

exported by another stack. You typically use this function to create

cross-stack references. In the following example template snippets, Stack A

exports VPC security group values and Stack B imports them.

Parameters:sharedValueToImport (string) – The stack output value that you want to import.
Returns:a token represented as a string
Return type:string
static join(delimiter, listOfValues) → string

The intrinsic function Fn::Join appends a set of values into a single

value, separated by the specified delimiter. If a delimiter is the empty

string, the set of values are concatenated with no delimiter.

Parameters:
  • delimiter (string) – The value you want to occur between fragments. The delimiter will occur between fragments only. It will not terminate the final value.
  • listOfValues (string[]) – The list of values you want combined.
Returns:

a token represented as a string

Return type:

string

static select(index, array) → string

The intrinsic function Fn::Select returns a single object from a list of objects by index.

Parameters:
  • index (number) – The index of the object to retrieve. This must be a value from zero to N-1, where N represents the number of elements in the array.
  • array (string[]) – The list of objects to select from. This list must not be null, nor can it have null entries.
Returns:

a token represented as a string

Return type:

string

static split(delimiter, source) → string[]

To split a string into a list of string values so that you can select an element from the

resulting string list, use the Fn::Split intrinsic function. Specify the location of splits

with a delimiter, such as , (a comma). After you split a string, use the Fn::Select function

to pick a specific element.

Parameters:
  • delimiter (string) – A string value that determines where the source string is divided.
  • source (string) – The string value that you want to split.
Returns:

a token represented as a string array

Return type:

string[]

static sub(body[, variables]) → string

The intrinsic function Fn::Sub substitutes variables in an input string

with values that you specify. In your templates, you can use this function

to construct commands or outputs that include values that aren’t available

until you create or update a stack.

Parameters:
  • body (string) – A string with variables that AWS CloudFormation substitutes with their associated values at runtime. Write variables as ${MyVarName}. Variables can be template parameter names, resource logical IDs, resource attributes, or a variable in a key-value map. If you specify only template parameter names, resource logical IDs, and resource attributes, don’t specify a key-value map.
  • variables (string => string (optional)) – The name of a variable that you included in the String parameter. The value that AWS CloudFormation substitutes for the associated variable name at runtime.
Returns:

a token represented as a string

Return type:

string

conditionEachMemberEquals(listOfStrings, value) → @aws-cdk/cdk.IConditionExpression

Returns true if a specified string matches all values in a list.

Parameters:
  • listOfStrings (string[]) – A list of strings, such as “A”, “B”, “C”.
  • value (string) – A string, such as “A”, that you want to compare against a list of strings.
Returns:

an FnCondition token

Return type:

IConditionExpression

conditionEachMemberIn(stringsToCheck, stringsToMatch) → @aws-cdk/cdk.IConditionExpression

Returns true if each member in a list of strings matches at least one value

in a second list of strings.

Parameters:
  • stringsToCheck (string[]) – A list of strings, such as “A”, “B”, “C”. AWS CloudFormation checks whether each member in the strings_to_check parameter is in the strings_to_match parameter.
  • stringsToMatch (string) – A list of strings, such as “A”, “B”, “C”. Each member in the strings_to_match parameter is compared against the members of the strings_to_check parameter.
Returns:

an FnCondition token

Return type:

IConditionExpression

refAll(parameterType) → string[]

Returns all values for a specified parameter type.

Parameters:parameterType (string) – An AWS-specific parameter type, such as AWS::EC2::SecurityGroup::Id or AWS::EC2::VPC::Id. For more information, see Parameters in the AWS CloudFormation User Guide.
Returns:a token represented as a string array
Return type:string[]
valueOf(parameterOrLogicalId, attribute) → string

Returns an attribute value or list of values for a specific parameter and

attribute.

Parameters:
  • parameterOrLogicalId (string) – The name of a parameter for which you want to retrieve attribute values. The parameter must be declared in the Parameters section of the template.
  • attribute (string) – The name of an attribute from which you want to retrieve a value.
Returns:

a token represented as a string

Return type:

string

valueOfAll(parameterType, attribute) → string[]

Returns a list of all attribute values for a given parameter type and

attribute.

Parameters:
  • parameterType (string) – An AWS-specific parameter type, such as AWS::EC2::SecurityGroup::Id or AWS::EC2::VPC::Id. For more information, see Parameters in the AWS CloudFormation User Guide.
  • attribute (string) – The name of an attribute from which you want to retrieve a value. For more information about attributes, see Supported Attributes.
Returns:

a token represented as a string array

Return type:

string[]

HashedAddressingScheme

class @aws-cdk/cdk.HashedAddressingScheme

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.HashedAddressingScheme;
const { HashedAddressingScheme } = require('@aws-cdk/cdk');
import { HashedAddressingScheme } from '@aws-cdk/cdk';

Renders a hashed ID for a resource.

In order to make sure logical IDs are unique and stable, we hash the resource

construct tree path (i.e. toplevel/secondlevel/…/myresource) and add it as

a suffix to the path components joined without a separator (CloudFormation

IDs only allow alphanumeric characters).

The result will be:

<path.join(‘’)><md5(path.join(‘/’)>

“human” “hash”

If the “human” part of the ID exceeds 240 characters, we simply trim it so

the total ID doesn’t exceed CloudFormation’s 255 character limit.

We only take 8 characters from the md5 hash (0.000005 chance of collision).

Special cases:

  • If the path only contains a single component (i.e. it’s a top-level

    resource), we won’t add the hash to it. The hash is not needed for

    disamiguation and also, it allows for a more straightforward migration an

    existing CloudFormation template to a CDK stack without logical ID changes

    (or renames).

  • For aesthetic reasons, if the last components of the path are the same

    (i.e. L1/L2/Pipeline/Pipeline), they will be de-duplicated to make the

    resulting human portion of the ID more pleasing: L1L2Pipeline<HASH>

    instead of L1L2PipelinePipeline<HASH>

  • If a component is named “Default” it will be omitted from the path. This

    allows refactoring higher level abstractions around constructs without affecting

    the IDs of already deployed resources.

  • If a component is named “Resource” it will be omitted from the user-visible

    path, but included in the hash. This reduces visual noise in the human readable

    part of the identifier.

Implements:IAddressingScheme
allocateAddress(addressComponents) → string

Implements @aws-cdk/cdk.IAddressingScheme.allocateAddress()

Return the logical ID for the given list of Construct names on the path.

Parameters:addressComponents (string[]) –
Return type:string

IAddressingScheme (interface)

class @aws-cdk/cdk.IAddressingScheme

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.IAddressingScheme;
// IAddressingScheme is an interface
import { IAddressingScheme } from '@aws-cdk/cdk';

Interface for classes that implementation logical ID assignment strategies

allocateAddress(addressComponents) → string

Return the logical ID for the given list of Construct names on the path.

Parameters:addressComponents (string[]) –
Return type:string
Abstract:Yes

IAspect (interface)

class @aws-cdk/cdk.IAspect

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.IAspect;
// IAspect is an interface
import { IAspect } from '@aws-cdk/cdk';

Represents an Aspect

visit(node)

All aspects can visit an IConstruct

Parameters:node (IConstruct) –
Abstract:Yes

IConditionExpression (interface)

class @aws-cdk/cdk.IConditionExpression

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.IConditionExpression;
// IConditionExpression is an interface
import { IConditionExpression } from '@aws-cdk/cdk';

Represents a CloudFormation element that can be used within a Condition.

You can use intrinsic functions, such as Fn.conditionIf,

Fn.conditionEquals, and Fn.conditionNot, to conditionally create

stack resources. These conditions are evaluated based on input parameters

that you declare when you create or update a stack. After you define all your

conditions, you can associate them with resources or resource properties in

the Resources and Outputs sections of a template.

You define all conditions in the Conditions section of a template except for

Fn.conditionIf conditions. You can use the Fn.conditionIf condition

in the metadata attribute, update policy attribute, and property values in

the Resources section and Outputs sections of a template.

You might use conditions when you want to reuse a template that can create

resources in different contexts, such as a test environment versus a

production environment. In your template, you can add an EnvironmentType

input parameter, which accepts either prod or test as inputs. For the

production environment, you might include Amazon EC2 instances with certain

capabilities; however, for the test environment, you want to use less

capabilities to save costs. With conditions, you can define which resources

are created and how they’re configured for each environment type.

resolve(context) → any

Returns a JSON node that represents this condition expression

Parameters:context (ResolveContext) –
Return type:any
Abstract:Yes

IConstruct (interface)

class @aws-cdk/cdk.IConstruct

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.IConstruct;
// IConstruct is an interface
import { IConstruct } from '@aws-cdk/cdk';

Represents a construct.

Extends:IDependable
node

The construct node in the scope tree.

Type:ConstructNode (readonly)
dependencyRoots

Inherited from @aws-cdk/cdk.IDependable

The set of constructs that form the root of this dependable

All resources under all returned constructs are included in the ordering

dependency.

Type:IConstruct[] (readonly)

IDependable (interface)

class @aws-cdk/cdk.IDependable

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.IDependable;
// IDependable is an interface
import { IDependable } from '@aws-cdk/cdk';

A set of constructs that can be depended upon

This interface can be used to take an (ordering) dependency on a set of

constructs. An ordering dependency implies that the resources represented by

those constructs are deployed before the resources depending ON them are

deployed.

dependencyRoots

The set of constructs that form the root of this dependable

All resources under all returned constructs are included in the ordering

dependency.

Type:IConstruct[] (readonly)

IResolvedValuePostProcessor (interface)

class @aws-cdk/cdk.IResolvedValuePostProcessor

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.IResolvedValuePostProcessor;
// IResolvedValuePostProcessor is an interface
import { IResolvedValuePostProcessor } from '@aws-cdk/cdk';

A Token that can post-process the complete resolved value, after resolve() has recursed over it

postProcess(input, context) → any

Process the completely resolved value, after full recursion/resolution has happened

Parameters:
Return type:

any

Abstract:

Yes

ISessionStore (interface)

class @aws-cdk/cdk.ISessionStore

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.ISessionStore;
// ISessionStore is an interface
import { ISessionStore } from '@aws-cdk/cdk';
exists(name) → boolean
Parameters:name (string) – The name of the file or directory to look up.
Returns:true if the file fileName exists in the store.
Return type:boolean
Abstract:Yes
finalize()

Do not allow further writes into the store.

Abstract:Yes
list() → string[]

List all top-level files that were emitted to the store.

Return type:string[]
Abstract:Yes
mkdir(directoryName) → string

Creates a directory and returns it’s full path.

Parameters:directoryName (string) – The name of the directory to create.
Return type:string
Abstract:Yes
readdir(directoryName) → string[]

Returns the list of files in a directory.

Parameters:directoryName (string) – The name of the artifact
Return type:string[]
Abstract:Yes
readFile(fileName) → any

Reads a file from the store.

Parameters:fileName (string) – The name of the file.
Return type:any
Abstract:Yes
readJson(fileName) → any

Reads a JSON object from the store.

Parameters:fileName (string) –
Return type:any
Abstract:Yes
writeFile(artifactName, data)

Writes a file into the store.

Parameters:
  • artifactName (string) – The name of the file.
  • data (any) – The contents of the file.
Abstract:

Yes

writeJson(artifactName, json)

Writes a formatted JSON output file to the store

Parameters:
  • artifactName (string) – the name of the artifact
  • json (any) – the JSON object
Abstract:

Yes

ISynthesisSession (interface)

class @aws-cdk/cdk.ISynthesisSession

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.ISynthesisSession;
// ISynthesisSession is an interface
import { ISynthesisSession } from '@aws-cdk/cdk';
manifest
Type:@aws-cdk/cx-api.AssemblyManifest (readonly)
store
Type:ISessionStore (readonly)
addArtifact(id, droplet)
Parameters:
Abstract:

Yes

addBuildStep(id, step)
Parameters:
Abstract:

Yes

tryGetArtifact(id) → @aws-cdk/cx-api.Artifact
Parameters:id (string) –
Return type:@aws-cdk/cx-api.Artifact (optional)
Abstract:Yes

ISynthesizable (interface)

class @aws-cdk/cdk.ISynthesizable

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.ISynthesizable;
// ISynthesizable is an interface
import { ISynthesizable } from '@aws-cdk/cdk';
synthesize(session)
Parameters:session (ISynthesisSession) –
Abstract:Yes

ITaggable (interface)

class @aws-cdk/cdk.ITaggable

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.ITaggable;
// ITaggable is an interface
import { ITaggable } from '@aws-cdk/cdk';
tags

TagManager to set, remove and format tags

Type:TagManager (readonly)

InMemoryStore

class @aws-cdk/cdk.InMemoryStore

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.InMemoryStore;
const { InMemoryStore } = require('@aws-cdk/cdk');
import { InMemoryStore } from '@aws-cdk/cdk';
Implements:ISessionStore
exists(name) → boolean

Implements @aws-cdk/cdk.ISessionStore.exists()

Parameters:name (string) –
Return type:boolean
finalize()

Implements @aws-cdk/cdk.ISessionStore.finalize()

Do not allow further writes into the store.

list() → string[]

Implements @aws-cdk/cdk.ISessionStore.list()

List all top-level files that were emitted to the store.

Return type:string[]
mkdir(directoryName) → string

Implements @aws-cdk/cdk.ISessionStore.mkdir()

Creates a directory and returns it’s full path.

Parameters:directoryName (string) –
Return type:string
readdir(directoryName) → string[]

Implements @aws-cdk/cdk.ISessionStore.readdir()

Returns the list of files in a directory.

Parameters:directoryName (string) –
Return type:string[]
readFile(fileName) → any

Implements @aws-cdk/cdk.ISessionStore.readFile()

Reads a file from the store.

Parameters:fileName (string) –
Return type:any
readJson(fileName) → any

Implements @aws-cdk/cdk.ISessionStore.readJson()

Reads a JSON object from the store.

Parameters:fileName (string) –
Return type:any
writeFile(fileName, data)

Implements @aws-cdk/cdk.ISessionStore.writeFile()

Writes a file into the store.

Parameters:
  • fileName (string) –
  • data (any) –
writeJson(fileName, json)

Implements @aws-cdk/cdk.ISessionStore.writeJson()

Writes a formatted JSON output file to the store

Parameters:
  • fileName (string) –
  • json (any) –

Include

class @aws-cdk/cdk.Include(scope, id, props)

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.Include;
const { Include } = require('@aws-cdk/cdk');
import { Include } from '@aws-cdk/cdk';

Includes a CloudFormation template into a stack. All elements of the template will be merged into

the current stack, together with any elements created programmatically.

Extends:

StackElement

Parameters:
toCloudFormation() → json

Implements @aws-cdk/cdk.StackElement.toCloudFormation()

Returns the CloudFormation ‘snippet’ for this entity. The snippet will only be merged

at the root level to ensure there are no identity conflicts.

For example, a Resource class will return something like:

{

Resources: {

[this.logicalId]: {

Type: this.resourceType,

Properties: this.props,

Condition: this.condition

}

}

}

Return type:json
template

The included template.

Type:json (readonly)
toString() → string

Inherited from @aws-cdk/cdk.Construct

Returns a string representation of this construct.

Return type:string
validate() → string[]

Inherited from @aws-cdk/cdk.Construct

Validate the current construct.

This method can be implemented by derived constructs in order to perform

validation logic. It is called on all constructs before synthesis.

Protected method

Returns:An array of validation error messages, or an empty array if there the construct is valid.
Return type:string[]
dependencyRoots

Inherited from @aws-cdk/cdk.Construct

The set of constructs that form the root of this dependable

All resources under all returned constructs are included in the ordering

dependency.

Type:IConstruct[] (readonly)
node

Inherited from @aws-cdk/cdk.Construct

Construct node.

Type:ConstructNode (readonly)
overrideLogicalId(newLogicalId)

Inherited from @aws-cdk/cdk.StackElement

Overrides the auto-generated logical ID with a specific ID.

Parameters:newLogicalId (string) – The new logical ID to use for this stack element.
prepare()

Inherited from @aws-cdk/cdk.StackElement

Automatically detect references in this StackElement

Protected method

creationStackTrace

Inherited from @aws-cdk/cdk.StackElement

Type:string[] (readonly)
logicalId

Inherited from @aws-cdk/cdk.StackElement

The logical ID for this CloudFormation stack element. The logical ID of the element

is calculated from the path of the resource node in the construct tree.

To override this value, use overrideLogicalId(newLogicalId).

Type:string (readonly)
stackPath

Inherited from @aws-cdk/cdk.StackElement

Return the path with respect to the stack

Type:string (readonly)

IncludeProps (interface)

class @aws-cdk/cdk.IncludeProps

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.IncludeProps;
// IncludeProps is an interface
import { IncludeProps } from '@aws-cdk/cdk';
template

The CloudFormation template to include in the stack (as is).

Type:json

LogicalIDs

class @aws-cdk/cdk.LogicalIDs(namingScheme)

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.LogicalIDs;
const { LogicalIDs } = require('@aws-cdk/cdk');
import { LogicalIDs } from '@aws-cdk/cdk';

Class that keeps track of the logical IDs that are assigned to resources

Supports renaming the generated IDs.

Parameters:namingScheme (IAddressingScheme) –
assertAllRenamesApplied()

Throw an error if not all renames have been used

This is to assure that users didn’t make typoes when registering renames.

getLogicalId(stackElement) → string

Return the logical ID for the given stack element

Parameters:stackElement (StackElement) –
Return type:string
renameLogical(oldId, newId)

Rename a logical ID from an old ID to a new ID

Parameters:
  • oldId (string) –
  • newId (string) –
namingScheme
Type:IAddressingScheme (readonly)

Mapping

class @aws-cdk/cdk.Mapping(scope, id, props)

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.Mapping;
const { Mapping } = require('@aws-cdk/cdk');
import { Mapping } from '@aws-cdk/cdk';

Represents a CloudFormation mapping.

Extends:

Referenceable

Parameters:
findInMap(key1, key2) → string
Parameters:
  • key1 (string) –
  • key2 (string) –
Returns:

A reference to a value in the map based on the two keys.

Return type:

string

setValue(key1, key2, value)

Sets a value in the map based on the two keys.

Parameters:
  • key1 (string) –
  • key2 (string) –
  • value (any) –
toCloudFormation() → json

Implements @aws-cdk/cdk.StackElement.toCloudFormation()

Returns the CloudFormation ‘snippet’ for this entity. The snippet will only be merged

at the root level to ensure there are no identity conflicts.

For example, a Resource class will return something like:

{

Resources: {

[this.logicalId]: {

Type: this.resourceType,

Properties: this.props,

Condition: this.condition

}

}

}

Return type:json
toString() → string

Inherited from @aws-cdk/cdk.Construct

Returns a string representation of this construct.

Return type:string
validate() → string[]

Inherited from @aws-cdk/cdk.Construct

Validate the current construct.

This method can be implemented by derived constructs in order to perform

validation logic. It is called on all constructs before synthesis.

Protected method

Returns:An array of validation error messages, or an empty array if there the construct is valid.
Return type:string[]
dependencyRoots

Inherited from @aws-cdk/cdk.Construct

The set of constructs that form the root of this dependable

All resources under all returned constructs are included in the ordering

dependency.

Type:IConstruct[] (readonly)
node

Inherited from @aws-cdk/cdk.Construct

Construct node.

Type:ConstructNode (readonly)
ref

Inherited from @aws-cdk/cdk.Referenceable

Returns a token to a CloudFormation { Ref } that references this entity based on it’s logical ID.

Type:string (readonly)
overrideLogicalId(newLogicalId)

Inherited from @aws-cdk/cdk.StackElement

Overrides the auto-generated logical ID with a specific ID.

Parameters:newLogicalId (string) – The new logical ID to use for this stack element.
prepare()

Inherited from @aws-cdk/cdk.StackElement

Automatically detect references in this StackElement

Protected method

creationStackTrace

Inherited from @aws-cdk/cdk.StackElement

Type:string[] (readonly)
logicalId

Inherited from @aws-cdk/cdk.StackElement

The logical ID for this CloudFormation stack element. The logical ID of the element

is calculated from the path of the resource node in the construct tree.

To override this value, use overrideLogicalId(newLogicalId).

Type:string (readonly)
stackPath

Inherited from @aws-cdk/cdk.StackElement

Return the path with respect to the stack

Type:string (readonly)

MappingProps (interface)

class @aws-cdk/cdk.MappingProps

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.MappingProps;
// MappingProps is an interface
import { MappingProps } from '@aws-cdk/cdk';
mapping
Type:string => string => any (optional)

MetadataEntry (interface)

class @aws-cdk/cdk.MetadataEntry

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.MetadataEntry;
// MetadataEntry is an interface
import { MetadataEntry } from '@aws-cdk/cdk';

An metadata entry in the construct.

trace

A stack trace for when the entry was created.

Type:string[]
type

The type of the metadata entry.

Type:string
data

The data.

Type:any (optional)

Output

class @aws-cdk/cdk.Output(scope, id[, props])

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.Output;
const { Output } = require('@aws-cdk/cdk');
import { Output } from '@aws-cdk/cdk';
Extends:

StackElement

Parameters:
makeImportValue() → any

Returns an FnImportValue bound to this export name.

Return type:any
obtainExportName() → string

Allocate an export name for this Output if not already done.

Return type:string
toCloudFormation() → json

Implements @aws-cdk/cdk.StackElement.toCloudFormation()

Returns the CloudFormation ‘snippet’ for this entity. The snippet will only be merged

at the root level to ensure there are no identity conflicts.

For example, a Resource class will return something like:

{

Resources: {

[this.logicalId]: {

Type: this.resourceType,

Properties: this.props,

Condition: this.condition

}

}

}

Return type:json
ref
Type:string (readonly)
value

The value of the property returned by the aws cloudformation describe-stacks command.

The value of an output can include literals, parameter references, pseudo-parameters,

a mapping value, or intrinsic functions.

Type:any (readonly)
condition

A condition from the “Conditions” section to associate with this output

value. If the condition evaluates to false, this output value will not

be included in the stack.

Type:Condition (optional) (readonly)
description

A String type that describes the output value.

The description can be a maximum of 4 K in length.

Type:string (optional) (readonly)
export

The name of the resource output to be exported for a cross-stack reference.

By default, the logical ID of the Output element is used as it’s export name.

May be undefined if the Output hasn’t been exported yet.

Type:string (optional)
toString() → string

Inherited from @aws-cdk/cdk.Construct

Returns a string representation of this construct.

Return type:string
validate() → string[]

Inherited from @aws-cdk/cdk.Construct

Validate the current construct.

This method can be implemented by derived constructs in order to perform

validation logic. It is called on all constructs before synthesis.

Protected method

Returns:An array of validation error messages, or an empty array if there the construct is valid.
Return type:string[]
dependencyRoots

Inherited from @aws-cdk/cdk.Construct

The set of constructs that form the root of this dependable

All resources under all returned constructs are included in the ordering

dependency.

Type:IConstruct[] (readonly)
node

Inherited from @aws-cdk/cdk.Construct

Construct node.

Type:ConstructNode (readonly)
overrideLogicalId(newLogicalId)

Inherited from @aws-cdk/cdk.StackElement

Overrides the auto-generated logical ID with a specific ID.

Parameters:newLogicalId (string) – The new logical ID to use for this stack element.
prepare()

Inherited from @aws-cdk/cdk.StackElement

Automatically detect references in this StackElement

Protected method

creationStackTrace

Inherited from @aws-cdk/cdk.StackElement

Type:string[] (readonly)
logicalId

Inherited from @aws-cdk/cdk.StackElement

The logical ID for this CloudFormation stack element. The logical ID of the element

is calculated from the path of the resource node in the construct tree.

To override this value, use overrideLogicalId(newLogicalId).

Type:string (readonly)
stackPath

Inherited from @aws-cdk/cdk.StackElement

Return the path with respect to the stack

Type:string (readonly)

OutputProps (interface)

class @aws-cdk/cdk.OutputProps

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.OutputProps;
// OutputProps is an interface
import { OutputProps } from '@aws-cdk/cdk';
condition

A condition from the “Conditions” section to associate with this output

value. If the condition evaluates to false, this output value will not

be included in the stack.

Type:Condition (optional)
description

A String type that describes the output value.

The description can be a maximum of 4 K in length.

Type:string (optional)
disableExport

Disables the automatic allocation of an export name for this output.

This prohibits exporting this value, either by specifying export or

by calling makeImportValue().

Type:boolean (optional)
Default:false
export

The name used to export the value of this output across stacks.

To import the value from another stack, use FnImportValue(export). You

can create an import value token by calling output.makeImportValue().

Type:string (optional)
Default:Automatically allocate a name when makeImportValue() is

called.

@aws-cdk/cdk.value

The value of the property returned by the aws cloudformation describe-stacks command.

The value of an output can include literals, parameter references, pseudo-parameters,

a mapping value, or intrinsic functions.

Type:any (optional)

Parameter

class @aws-cdk/cdk.Parameter(scope, id, props)

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.Parameter;
const { Parameter } = require('@aws-cdk/cdk');
import { Parameter } from '@aws-cdk/cdk';

Use the optional Parameters section to customize your templates.

Parameters enable you to input custom values to your template each time you create or

update a stack.

Extends:

Referenceable

Parameters:
resolve() → any

Allows using parameters as tokens without the need to dereference them.

This implicitly implements Token, until we make it an interface.

Return type:any
toCloudFormation() → json

Implements @aws-cdk/cdk.StackElement.toCloudFormation()

Returns the CloudFormation ‘snippet’ for this entity. The snippet will only be merged

at the root level to ensure there are no identity conflicts.

For example, a Resource class will return something like:

{

Resources: {

[this.logicalId]: {

Type: this.resourceType,

Properties: this.props,

Condition: this.condition

}

}

}

Return type:json
stringListValue

The parameter value token represented as a string array.

Type:string[]
stringValue

The parameter value token represented as a string.

Type:string
value

A token that represents the actual value of this parameter.

Type:Token
toString() → string

Inherited from @aws-cdk/cdk.Construct

Returns a string representation of this construct.

Return type:string
validate() → string[]

Inherited from @aws-cdk/cdk.Construct

Validate the current construct.

This method can be implemented by derived constructs in order to perform

validation logic. It is called on all constructs before synthesis.

Protected method

Returns:An array of validation error messages, or an empty array if there the construct is valid.
Return type:string[]
dependencyRoots

Inherited from @aws-cdk/cdk.Construct

The set of constructs that form the root of this dependable

All resources under all returned constructs are included in the ordering

dependency.

Type:IConstruct[] (readonly)
node

Inherited from @aws-cdk/cdk.Construct

Construct node.

Type:ConstructNode (readonly)
ref

Inherited from @aws-cdk/cdk.Referenceable

Returns a token to a CloudFormation { Ref } that references this entity based on it’s logical ID.

Type:string (readonly)
overrideLogicalId(newLogicalId)

Inherited from @aws-cdk/cdk.StackElement

Overrides the auto-generated logical ID with a specific ID.

Parameters:newLogicalId (string) – The new logical ID to use for this stack element.
prepare()

Inherited from @aws-cdk/cdk.StackElement

Automatically detect references in this StackElement

Protected method

creationStackTrace

Inherited from @aws-cdk/cdk.StackElement

Type:string[] (readonly)
logicalId

Inherited from @aws-cdk/cdk.StackElement

The logical ID for this CloudFormation stack element. The logical ID of the element

is calculated from the path of the resource node in the construct tree.

To override this value, use overrideLogicalId(newLogicalId).

Type:string (readonly)
stackPath

Inherited from @aws-cdk/cdk.StackElement

Return the path with respect to the stack

Type:string (readonly)

ParameterProps (interface)

class @aws-cdk/cdk.ParameterProps

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.ParameterProps;
// ParameterProps is an interface
import { ParameterProps } from '@aws-cdk/cdk';
type

The data type for the parameter (DataType).

Type:string
allowedPattern

A regular expression that represents the patterns to allow for String types.

Type:string (optional)
allowedValues

An array containing the list of values allowed for the parameter.

Type:string[] (optional)
constraintDescription

A string that explains a constraint when the constraint is violated.

For example, without a constraint description, a parameter that has an allowed

pattern of [A-Za-z0-9]+ displays the following error message when the user specifies

an invalid value:

Type:string (optional)
default

A value of the appropriate type for the template to use if no value is specified

when a stack is created. If you define constraints for the parameter, you must specify

a value that adheres to those constraints.

Type:any (optional)
description

A string of up to 4000 characters that describes the parameter.

Type:string (optional)
maxLength

An integer value that determines the largest number of characters you want to allow for String types.

Type:number (optional)
maxValue

A numeric value that determines the largest numeric value you want to allow for Number types.

Type:number (optional)
minLength

An integer value that determines the smallest number of characters you want to allow for String types.

Type:number (optional)
minValue

A numeric value that determines the smallest numeric value you want to allow for Number types.

Type:number (optional)
noEcho

Whether to mask the parameter value when anyone makes a call that describes the stack.

If you set the value to true, the parameter value is masked with asterisks (*****).

Type:boolean (optional)

Ref

class @aws-cdk/cdk.Ref(element)

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.Ref;
const { Ref } = require('@aws-cdk/cdk');
import { Ref } from '@aws-cdk/cdk';

A generic, untyped reference to a Stack Element

Extends:CfnReference
Parameters:element (StackElement) –
consumeFromStack(consumingStack)

Inherited from @aws-cdk/cdk.CfnReference

Register a stack this references is being consumed from.

Parameters:consumingStack (Stack) –
resolve(context) → any

Inherited from @aws-cdk/cdk.CfnReference

Parameters:context (ResolveContext) –
Return type:any
isReference

Inherited from @aws-cdk/cdk.CfnReference

Indicate whether this Token represent a “reference”

The Construct tree can be queried for the Reference Tokens that

are used in it.

Type:boolean (optional) (readonly)
toJSON() → any

Inherited from @aws-cdk/cdk.Token

Turn this Token into JSON

This gets called by JSON.stringify(). We want to prohibit this, because

it’s not possible to do this properly, so we just throw an error here.

Return type:any
toList() → string[]

Inherited from @aws-cdk/cdk.Token

Return a string list representation of this token

Call this if the Token intrinsically evaluates to a list of strings.

If so, you can represent the Token in a similar way in the type

system.

Note that even though the Token is represented as a list of strings, you

still cannot do any operations on it such as concatenation, indexing,

or taking its length. The only useful operations you can do to these lists

is constructing a FnJoin or a FnSelect on it.

Return type:string[]
toString() → string

Inherited from @aws-cdk/cdk.Token

Return a reversible string representation of this token

If the Token is initialized with a literal, the stringified value of the

literal is returned. Otherwise, a special quoted string representation

of the Token is returned that can be embedded into other strings.

Strings with quoted Tokens in them can be restored back into

complex values with the Tokens restored by calling resolve()

on the string.

Return type:string
displayName

Inherited from @aws-cdk/cdk.Token

A human-readable display hint for this Token

Type:string (optional) (readonly)
valueOrFunction

Inherited from @aws-cdk/cdk.Token

What this token will evaluate to, literal or function.

Type:any (optional) (readonly)

Referenceable

class @aws-cdk/cdk.Referenceable(scope, id)

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.Referenceable;
const { Referenceable } = require('@aws-cdk/cdk');
import { Referenceable } from '@aws-cdk/cdk';

Base class for referenceable CloudFormation constructs which are not Resources

These constructs are things like Conditions and Parameters, can be

referenced by taking the .ref attribute.

Resource constructs do not inherit from Referenceable because they have their

own, more specific types returned from the .ref attribute. Also, some

resources aren’t referenceable at all (such as BucketPolicies or GatewayAttachments).

Extends:

StackElement

Abstract:

Yes

Parameters:
ref

Returns a token to a CloudFormation { Ref } that references this entity based on it’s logical ID.

Type:string (readonly)
toString() → string

Inherited from @aws-cdk/cdk.Construct

Returns a string representation of this construct.

Return type:string
validate() → string[]

Inherited from @aws-cdk/cdk.Construct

Validate the current construct.

This method can be implemented by derived constructs in order to perform

validation logic. It is called on all constructs before synthesis.

Protected method

Returns:An array of validation error messages, or an empty array if there the construct is valid.
Return type:string[]
dependencyRoots

Inherited from @aws-cdk/cdk.Construct

The set of constructs that form the root of this dependable

All resources under all returned constructs are included in the ordering

dependency.

Type:IConstruct[] (readonly)
node

Inherited from @aws-cdk/cdk.Construct

Construct node.

Type:ConstructNode (readonly)
overrideLogicalId(newLogicalId)

Inherited from @aws-cdk/cdk.StackElement

Overrides the auto-generated logical ID with a specific ID.

Parameters:newLogicalId (string) – The new logical ID to use for this stack element.
prepare()

Inherited from @aws-cdk/cdk.StackElement

Automatically detect references in this StackElement

Protected method

toCloudFormation() → json

Inherited from @aws-cdk/cdk.StackElement

Returns the CloudFormation ‘snippet’ for this entity. The snippet will only be merged

at the root level to ensure there are no identity conflicts.

For example, a Resource class will return something like:

{

Resources: {

[this.logicalId]: {

Type: this.resourceType,

Properties: this.props,

Condition: this.condition

}

}

}

Return type:json
Abstract:Yes
creationStackTrace

Inherited from @aws-cdk/cdk.StackElement

Type:string[] (readonly)
logicalId

Inherited from @aws-cdk/cdk.StackElement

The logical ID for this CloudFormation stack element. The logical ID of the element

is calculated from the path of the resource node in the construct tree.

To override this value, use overrideLogicalId(newLogicalId).

Type:string (readonly)
stackPath

Inherited from @aws-cdk/cdk.StackElement

Return the path with respect to the stack

Type:string (readonly)

RemovalPolicy (enum)

class @aws-cdk/cdk.RemovalPolicy

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.RemovalPolicy;
const { RemovalPolicy } = require('@aws-cdk/cdk');
import { RemovalPolicy } from '@aws-cdk/cdk';
Destroy

This is the default removal policy for most resources. It means that when the resource

is removed from the app, it will be physically destroyed.

Orphan

This uses the ‘Retain’ DeletionPolicy, which will cause the resource to be retained

in the account, but orphaned from the stack.

Forbid

This will apply the ‘Retain’ DeletionPolicy and also add metadata for the toolkit

to apply a CloudFormation stack policy which forbids the deletion of resource.

RemoveTag

class @aws-cdk/cdk.RemoveTag(key[, props])

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.RemoveTag;
const { RemoveTag } = require('@aws-cdk/cdk');
import { RemoveTag } from '@aws-cdk/cdk';

The RemoveTag Aspect will handle removing tags from this node and children

Extends:

TagBase

Parameters:
  • key (string) –
  • props (TagProps (optional)) –
applyTag(resource)

Implements @aws-cdk/cdk.TagBase.applyTag()

Protected method

Parameters:resource (ITaggable) –
visit(construct)

Inherited from @aws-cdk/cdk.TagBase

All aspects can visit an IConstruct

Parameters:construct (IConstruct) –
key

Inherited from @aws-cdk/cdk.TagBase

The string key for the tag

Type:string (readonly)
props

Inherited from @aws-cdk/cdk.TagBase

Protected property

Type:TagProps (readonly)

ResolveContext (interface)

class @aws-cdk/cdk.ResolveContext

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.ResolveContext;
// ResolveContext is an interface
import { ResolveContext } from '@aws-cdk/cdk';

Current resolution context for tokens

prefix
Type:string[]
scope
Type:IConstruct

Resource

class @aws-cdk/cdk.Resource(scope, id, props)

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.Resource;
const { Resource } = require('@aws-cdk/cdk');
import { Resource } from '@aws-cdk/cdk';

Represents a CloudFormation resource.

Extends:

Referenceable

Parameters:
static attribute([customName]) → any

A decoration used to create a CloudFormation attribute property.

Parameters:customName (string (optional)) – Custom name for the attribute (default is the name of the property) NOTE: we return “any” here to satistfy jsii, which doesn’t support lambdas.
Return type:any
static isResource(construct) → boolean

Check whether the given construct is a Resource

Parameters:construct (IConstruct) –
Return type:boolean
static isTaggable(construct) → boolean

Check whether the given construct is Taggable

Parameters:construct (any) –
Return type:boolean
addDeletionOverride(path)

Syntactic sugar for addOverride(path, undefined).

Parameters:path (string) – The path of the value to delete
addDependsOn(resource)

Indicates that this resource depends on another resource and cannot be provisioned

unless the other resource has been successfully provisioned.

Parameters:resource (Resource) –
addOverride(path, value)

Adds an override to the synthesized CloudFormation resource. To add a

property override, either use addPropertyOverride or prefix path with

“Properties.” (i.e. Properties.TopicName).

Parameters:
  • path (string) – The path of the property, you can use dot notation to override values in complex types. Any intermdediate keys will be created as needed.
  • value (any) – The value. Could be primitive or complex.
addPropertyDeletionOverride(propertyPath)

Adds an override that deletes the value of a property from the resource definition.

Parameters:propertyPath (string) – The path to the property.
addPropertyOverride(propertyPath, value)

Adds an override to a resource property.

Syntactic sugar for addOverride(“Properties.<…>”, value).

Parameters:
  • propertyPath (string) – The path of the property
  • value (any) – The value
getAtt(attributeName) → @aws-cdk/cdk.CfnReference

Returns a token for an runtime attribute of this resource.

Ideally, use generated attribute accessors (e.g. resource.arn), but this can be used for future compatibility

in case there is no generated attribute.

Parameters:attributeName (string) – The name of the attribute.
Return type:CfnReference
renderProperties(properties) → string => any

Protected method

Parameters:properties (any) –
Return type:string => any
toCloudFormation() → json

Implements @aws-cdk/cdk.StackElement.toCloudFormation()

Emits CloudFormation for this resource.

Return type:json
options

Options for this resource, such as condition, update policy etc.

Type:ResourceOptions (readonly)
properties

AWS resource properties.

This object is rendered via a call to “renderProperties(this.properties)”.

Protected property

Type:any (readonly)
resourceType

AWS resource type.

Type:string (readonly)
untypedPropertyOverrides

AWS resource property overrides.

During synthesis, the method “renderProperties(this.overrides)” is called

with this object, and merged on top of the output of

“renderProperties(this.properties)”.

Derived classes should expose a strongly-typed version of this object as

a public property called propertyOverrides.

Protected property

Type:any (readonly)
toString() → string

Inherited from @aws-cdk/cdk.Construct

Returns a string representation of this construct.

Return type:string
validate() → string[]

Inherited from @aws-cdk/cdk.Construct

Validate the current construct.

This method can be implemented by derived constructs in order to perform

validation logic. It is called on all constructs before synthesis.

Protected method

Returns:An array of validation error messages, or an empty array if there the construct is valid.
Return type:string[]
dependencyRoots

Inherited from @aws-cdk/cdk.Construct

The set of constructs that form the root of this dependable

All resources under all returned constructs are included in the ordering

dependency.

Type:IConstruct[] (readonly)
node

Inherited from @aws-cdk/cdk.Construct

Construct node.

Type:ConstructNode (readonly)
ref

Inherited from @aws-cdk/cdk.Referenceable

Returns a token to a CloudFormation { Ref } that references this entity based on it’s logical ID.

Type:string (readonly)
overrideLogicalId(newLogicalId)

Inherited from @aws-cdk/cdk.StackElement

Overrides the auto-generated logical ID with a specific ID.

Parameters:newLogicalId (string) – The new logical ID to use for this stack element.
prepare()

Inherited from @aws-cdk/cdk.StackElement

Automatically detect references in this StackElement

Protected method

creationStackTrace

Inherited from @aws-cdk/cdk.StackElement

Type:string[] (readonly)
logicalId

Inherited from @aws-cdk/cdk.StackElement

The logical ID for this CloudFormation stack element. The logical ID of the element

is calculated from the path of the resource node in the construct tree.

To override this value, use overrideLogicalId(newLogicalId).

Type:string (readonly)
stackPath

Inherited from @aws-cdk/cdk.StackElement

Return the path with respect to the stack

Type:string (readonly)

ResourceOptions (interface)

class @aws-cdk/cdk.ResourceOptions

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.ResourceOptions;
// ResourceOptions is an interface
import { ResourceOptions } from '@aws-cdk/cdk';
condition

A condition to associate with this resource. This means that only if the condition evaluates to ‘true’ when the stack

is deployed, the resource will be included. This is provided to allow CDK projects to produce legacy templates, but noramlly

there is no need to use it in CDK projects.

Type:Condition (optional)
creationPolicy

Associate the CreationPolicy attribute with a resource to prevent its status from reaching create complete until

AWS CloudFormation receives a specified number of success signals or the timeout period is exceeded. To signal a

resource, you can use the cfn-signal helper script or SignalResource API. AWS CloudFormation publishes valid signals

to the stack events so that you track the number of signals sent.

Type:CreationPolicy (optional)
deletionPolicy

With the DeletionPolicy attribute you can preserve or (in some cases) backup a resource when its stack is deleted.

You specify a DeletionPolicy attribute for each resource that you want to control. If a resource has no DeletionPolicy

attribute, AWS CloudFormation deletes the resource by default. Note that this capability also applies to update operations

that lead to resources being removed.

Type:DeletionPolicy (optional)
metadata

Metadata associated with the CloudFormation resource. This is not the same as the construct metadata which can be added

using construct.addMetadata(), but would not appear in the CloudFormation template automatically.

Type:string => any (optional)
updatePolicy

Use the UpdatePolicy attribute to specify how AWS CloudFormation handles updates to the AWS::AutoScaling::AutoScalingGroup

resource. AWS CloudFormation invokes one of three update policies depending on the type of change you make or whether a

scheduled action is associated with the Auto Scaling group.

Type:UpdatePolicy (optional)
updateReplacePolicy

Use the UpdateReplacePolicy attribute to retain or (in some cases) backup the existing physical instance of a resource

when it is replaced during a stack update operation.

Type:DeletionPolicy (optional)

ResourceProps (interface)

class @aws-cdk/cdk.ResourceProps

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.ResourceProps;
// ResourceProps is an interface
import { ResourceProps } from '@aws-cdk/cdk';
type

CloudFormation resource type.

Type:string
properties

CloudFormation properties.

Type:any (optional)

ResourceSignal (interface)

class @aws-cdk/cdk.ResourceSignal

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.ResourceSignal;
// ResourceSignal is an interface
import { ResourceSignal } from '@aws-cdk/cdk';

When AWS CloudFormation creates the associated resource, configures the number of required success signals and

the length of time that AWS CloudFormation waits for those signals.

count

The number of success signals AWS CloudFormation must receive before it sets the resource status as CREATE_COMPLETE.

If the resource receives a failure signal or doesn’t receive the specified number of signals before the timeout period

expires, the resource creation fails and AWS CloudFormation rolls the stack back.

Type:number (optional)
timeout

The length of time that AWS CloudFormation waits for the number of signals that was specified in the Count property.

The timeout period starts after AWS CloudFormation starts creating the resource, and the timeout expires no sooner

than the time you specify but can occur shortly thereafter. The maximum time that you can specify is 12 hours.

Type:string (optional)

Root

class @aws-cdk/cdk.Root

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.Root;
const { Root } = require('@aws-cdk/cdk');
import { Root } from '@aws-cdk/cdk';

Represents the root of a construct tree.

No scope and no name.

Extends:Construct
prepare()

Inherited from @aws-cdk/cdk.Construct

Perform final modifications before synthesis

This method can be implemented by derived constructs in order to perform

final changes before synthesis. prepare() will be called after child

constructs have been prepared.

This is an advanced framework feature. Only use this if you

understand the implications.

Protected method

toString() → string

Inherited from @aws-cdk/cdk.Construct

Returns a string representation of this construct.

Return type:string
validate() → string[]

Inherited from @aws-cdk/cdk.Construct

Validate the current construct.

This method can be implemented by derived constructs in order to perform

validation logic. It is called on all constructs before synthesis.

Protected method

Returns:An array of validation error messages, or an empty array if there the construct is valid.
Return type:string[]
dependencyRoots

Inherited from @aws-cdk/cdk.Construct

The set of constructs that form the root of this dependable

All resources under all returned constructs are included in the ordering

dependency.

Type:IConstruct[] (readonly)
node

Inherited from @aws-cdk/cdk.Construct

Construct node.

Type:ConstructNode (readonly)

Rule

class @aws-cdk/cdk.Rule(scope, id[, props])

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.Rule;
const { Rule } = require('@aws-cdk/cdk');
import { Rule } from '@aws-cdk/cdk';

The Rules that define template constraints in an AWS Service Catalog portfolio describe when

end users can use the template and which values they can specify for parameters that are declared

in the AWS CloudFormation template used to create the product they are attempting to use. Rules

are useful for preventing end users from inadvertently specifying an incorrect value.

For example, you can add a rule to verify whether end users specified a valid subnet in a

given VPC or used m1.small instance types for test environments. AWS CloudFormation uses

rules to validate parameter values before it creates the resources for the product.

A rule can include a RuleCondition property and must include an Assertions property.

For each rule, you can define only one rule condition; you can define one or more asserts within the Assertions property.

You define a rule condition and assertions by using rule-specific intrinsic functions.

https://docs.aws.amazon.com/servicecatalog/latest/adminguide/reference-template_constraint_rules.html

Extends:

Referenceable

Parameters:
addAssertion(condition, description)

Adds an assertion to the rule.

Parameters:
  • condition (IConditionExpression) – The expression to evaluation.
  • description (string) – The description of the assertion.
toCloudFormation() → json

Implements @aws-cdk/cdk.StackElement.toCloudFormation()

Returns the CloudFormation ‘snippet’ for this entity. The snippet will only be merged

at the root level to ensure there are no identity conflicts.

For example, a Resource class will return something like:

{

Resources: {

[this.logicalId]: {

Type: this.resourceType,

Properties: this.props,

Condition: this.condition

}

}

}

Return type:json
assertions

Assertions which define the rule.

Type:RuleAssertion[] (optional)
ruleCondition

If the rule condition evaluates to false, the rule doesn’t take effect.

If the function in the rule condition evaluates to true, expressions in each assert are evaluated and applied.

Type:IConditionExpression (optional)
toString() → string

Inherited from @aws-cdk/cdk.Construct

Returns a string representation of this construct.

Return type:string
validate() → string[]

Inherited from @aws-cdk/cdk.Construct

Validate the current construct.

This method can be implemented by derived constructs in order to perform

validation logic. It is called on all constructs before synthesis.

Protected method

Returns:An array of validation error messages, or an empty array if there the construct is valid.
Return type:string[]
dependencyRoots

Inherited from @aws-cdk/cdk.Construct

The set of constructs that form the root of this dependable

All resources under all returned constructs are included in the ordering

dependency.

Type:IConstruct[] (readonly)
node

Inherited from @aws-cdk/cdk.Construct

Construct node.

Type:ConstructNode (readonly)
ref

Inherited from @aws-cdk/cdk.Referenceable

Returns a token to a CloudFormation { Ref } that references this entity based on it’s logical ID.

Type:string (readonly)
overrideLogicalId(newLogicalId)

Inherited from @aws-cdk/cdk.StackElement

Overrides the auto-generated logical ID with a specific ID.

Parameters:newLogicalId (string) – The new logical ID to use for this stack element.
prepare()

Inherited from @aws-cdk/cdk.StackElement

Automatically detect references in this StackElement

Protected method

creationStackTrace

Inherited from @aws-cdk/cdk.StackElement

Type:string[] (readonly)
logicalId

Inherited from @aws-cdk/cdk.StackElement

The logical ID for this CloudFormation stack element. The logical ID of the element

is calculated from the path of the resource node in the construct tree.

To override this value, use overrideLogicalId(newLogicalId).

Type:string (readonly)
stackPath

Inherited from @aws-cdk/cdk.StackElement

Return the path with respect to the stack

Type:string (readonly)

RuleAssertion (interface)

class @aws-cdk/cdk.RuleAssertion

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.RuleAssertion;
// RuleAssertion is an interface
import { RuleAssertion } from '@aws-cdk/cdk';

A rule assertion.

assert

The assertion.

Type:IConditionExpression
assertDescription

The assertion description.

Type:string

RuleProps (interface)

class @aws-cdk/cdk.RuleProps

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.RuleProps;
// RuleProps is an interface
import { RuleProps } from '@aws-cdk/cdk';

A rule can include a RuleCondition property and must include an Assertions property.

For each rule, you can define only one rule condition; you can define one or more asserts within the Assertions property.

You define a rule condition and assertions by using rule-specific intrinsic functions.

You can use the following rule-specific intrinsic functions to define rule conditions and assertions:

Fn::And

Fn::Contains

Fn::EachMemberEquals

Fn::EachMemberIn

Fn::Equals

Fn::If

Fn::Not

Fn::Or

Fn::RefAll

Fn::ValueOf

Fn::ValueOfAll

https://docs.aws.amazon.com/servicecatalog/latest/adminguide/reference-template_constraint_rules.html

assertions

Assertions which define the rule.

Type:RuleAssertion[] (optional)
ruleCondition

If the rule condition evaluates to false, the rule doesn’t take effect.

If the function in the rule condition evaluates to true, expressions in each assert are evaluated and applied.

Type:IConditionExpression (optional)

SSMParameterProvider

class @aws-cdk/cdk.SSMParameterProvider(context, props)

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.SSMParameterProvider;
const { SSMParameterProvider } = require('@aws-cdk/cdk');
import { SSMParameterProvider } from '@aws-cdk/cdk';

Context provider that will read values from the SSM parameter store in the indicated account and region

Parameters:
parameterValue([defaultValue]) → any

Return the SSM parameter string with the indicated key

Parameters:defaultValue (string (optional)) –
Return type:any

SSMParameterProviderProps (interface)

class @aws-cdk/cdk.SSMParameterProviderProps

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.SSMParameterProviderProps;
// SSMParameterProviderProps is an interface
import { SSMParameterProviderProps } from '@aws-cdk/cdk';
parameterName

The name of the parameter to lookup

Type:string

ScopedAws

class @aws-cdk/cdk.ScopedAws([scope])

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.ScopedAws;
const { ScopedAws } = require('@aws-cdk/cdk');
import { ScopedAws } from '@aws-cdk/cdk';

Accessor for scoped pseudo parameters

These pseudo parameters are anchored to a stack somewhere in the construct

tree, and their values will be exported automatically.

Parameters:scope (Construct (optional)) –
accountId
Type:string (readonly)
notificationArns
Type:string[] (readonly)
partition
Type:string (readonly)
region
Type:string (readonly)
stackId
Type:string (readonly)
stackName
Type:string (readonly)
urlSuffix
Type:string (readonly)
scope
Type:Construct (optional) (readonly)

Secret

class @aws-cdk/cdk.Secret([valueOrFunction[, displayName]])

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.Secret;
const { Secret } = require('@aws-cdk/cdk');
import { Secret } from '@aws-cdk/cdk';

A token that represents a value that’s expected to be a secret, like

passwords and keys.

It is recommended to use the SecretParameter construct in order to import

secret values from the SSM Parameter Store instead of storing them in your

code.

However, you can also just pass in values, like any other token: new Secret(‘bla’)

Extends:

Token

Parameters:
  • valueOrFunction (any (optional)) – What this token will evaluate to, literal or function.
  • displayName (string (optional)) – A human-readable display hint for this Token
resolve(_context) → any

Inherited from @aws-cdk/cdk.Token

Parameters:_context (ResolveContext) –
Returns:The resolved value for this token.
Return type:any
toJSON() → any

Inherited from @aws-cdk/cdk.Token

Turn this Token into JSON

This gets called by JSON.stringify(). We want to prohibit this, because

it’s not possible to do this properly, so we just throw an error here.

Return type:any
toList() → string[]

Inherited from @aws-cdk/cdk.Token

Return a string list representation of this token

Call this if the Token intrinsically evaluates to a list of strings.

If so, you can represent the Token in a similar way in the type

system.

Note that even though the Token is represented as a list of strings, you

still cannot do any operations on it such as concatenation, indexing,

or taking its length. The only useful operations you can do to these lists

is constructing a FnJoin or a FnSelect on it.

Return type:string[]
toString() → string

Inherited from @aws-cdk/cdk.Token

Return a reversible string representation of this token

If the Token is initialized with a literal, the stringified value of the

literal is returned. Otherwise, a special quoted string representation

of the Token is returned that can be embedded into other strings.

Strings with quoted Tokens in them can be restored back into

complex values with the Tokens restored by calling resolve()

on the string.

Return type:string
displayName

Inherited from @aws-cdk/cdk.Token

A human-readable display hint for this Token

Type:string (optional) (readonly)
isReference

Inherited from @aws-cdk/cdk.Token

Indicate whether this Token represent a “reference”

The Construct tree can be queried for the Reference Tokens that

are used in it.

Type:boolean (optional) (readonly)
valueOrFunction

Inherited from @aws-cdk/cdk.Token

What this token will evaluate to, literal or function.

Type:any (optional) (readonly)

SecretParameter

class @aws-cdk/cdk.SecretParameter(scope, id, props)

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.SecretParameter;
const { SecretParameter } = require('@aws-cdk/cdk');
import { SecretParameter } from '@aws-cdk/cdk';

Defines a secret value resolved from the Systems Manager (SSM) Parameter

Store during deployment. This is useful for referencing values that you do

not wish to include in your code base, such as secrets, passwords and keys.

This construct will add a CloudFormation parameter to your template bound to

an SSM parameter (of type “AWS::SSM::Parameter::Value<String>”). Deployment

will fail if the value doesn’t exist in the target environment.

Important: For values other than secrets, prefer to use the

SSMParameterProvider which resolves SSM parameter in design-time, and

ensures that stack deployments are deterministic.

Extends:

Construct

Parameters:
value

The value of the secret parameter.

Type:Secret
prepare()

Inherited from @aws-cdk/cdk.Construct

Perform final modifications before synthesis

This method can be implemented by derived constructs in order to perform

final changes before synthesis. prepare() will be called after child

constructs have been prepared.

This is an advanced framework feature. Only use this if you

understand the implications.

Protected method

toString() → string

Inherited from @aws-cdk/cdk.Construct

Returns a string representation of this construct.

Return type:string
validate() → string[]

Inherited from @aws-cdk/cdk.Construct

Validate the current construct.

This method can be implemented by derived constructs in order to perform

validation logic. It is called on all constructs before synthesis.

Protected method

Returns:An array of validation error messages, or an empty array if there the construct is valid.
Return type:string[]
dependencyRoots

Inherited from @aws-cdk/cdk.Construct

The set of constructs that form the root of this dependable

All resources under all returned constructs are included in the ordering

dependency.

Type:IConstruct[] (readonly)
node

Inherited from @aws-cdk/cdk.Construct

Construct node.

Type:ConstructNode (readonly)

SecretParameterProps (interface)

class @aws-cdk/cdk.SecretParameterProps

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.SecretParameterProps;
// SecretParameterProps is an interface
import { SecretParameterProps } from '@aws-cdk/cdk';
ssmParameter

The name of the SSM parameter where the secret value is stored.

Type:string
allowedPattern

A regular expression that represents the patterns to allow for String types.

Type:string (optional)
allowedValues

An array containing the list of values allowed for the parameter.

Type:string[] (optional)
constraintDescription

A string that explains a constraint when the constraint is violated.

For example, without a constraint description, a parameter that has an allowed

pattern of [A-Za-z0-9]+ displays the following error message when the user specifies

an invalid value:

Type:string (optional)
description

A string of up to 4000 characters that describes the parameter.

Type:string (optional)
Default:No description
maxLength

An integer value that determines the largest number of characters you want to allow for String types.

Type:number (optional)
minLength

An integer value that determines the smallest number of characters you want to allow for String types.

Type:number (optional)

Stack

class @aws-cdk/cdk.Stack([scope[, name[, props]]])

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.Stack;
const { Stack } = require('@aws-cdk/cdk');
import { Stack } from '@aws-cdk/cdk';

A root construct which represents a single CloudFormation stack.

Extends:

Construct

Parameters:
  • scope (App (optional)) – Parent of this stack, usually a Program instance.
  • name (string (optional)) – The name of the CloudFormation stack. Defaults to “Stack”.
  • props (StackProps (optional)) – Stack properties.
static annotatePhysicalName(construct[, physicalName])

Adds a metadata annotation “aws:cdk:physical-name” to the construct if physicalName

is non-null. This can be used later by tools and aspects to determine if resources

have been created with physical names.

Parameters:
  • construct (Construct) –
  • physicalName (string (optional)) –
static isStack(construct) → boolean

Return whether the given object is a Stack.

We do attribute detection since we can’t reliably use ‘instanceof’.

Parameters:construct (IConstruct) –
Return type:boolean
addDependency(stack)

Add a dependency between this stack and another stack

Parameters:stack (Stack) –
dependencies() → @aws-cdk/cdk.Stack[]

Return the stacks this stack depends on

Return type:Stack[]
findResource(path) → @aws-cdk/cdk.Resource

Looks up a resource by path.

Parameters:path (string) –
Returns:The Resource or undefined if not found
Return type:Resource (optional)
formatArn(components) → string

Creates an ARN from components.

If partition, region or account are not specified, the stack’s

partition, region and account will be used.

If any component is the empty string, an empty string will be inserted

into the generated ARN at the location that component corresponds to.

The ARN will be formatted as follows:

arn:{partition}:{service}:{region}:{account}:{resource}{sep}}{resource-name}

The required ARN pieces that are omitted will be taken from the stack that

the ‘scope’ is attached to. If all ARN pieces are supplied, the supplied scope

can be ‘undefined’.

Parameters:components (ArnComponents) –
Return type:string
parentApp() → @aws-cdk/cdk.App
Return type:App (optional)
parseArn(arn[, sepIfToken[, hasName]]) → @aws-cdk/cdk.ArnComponents

Given an ARN, parses it and returns components.

If the ARN is a concrete string, it will be parsed and validated. The

separator (sep) will be set to ‘/’ if the 6th component includes a ‘/’,

in which case, resource will be set to the value before the ‘/’ and

resourceName will be the rest. In case there is no ‘/’, resource will

be set to the 6th components and resourceName will be set to the rest

of the string.

If the ARN includes tokens (or is a token), the ARN cannot be validated,

since we don’t have the actual value yet at the time of this function

call. You will have to know the separator and the type of ARN. The

resulting ArnComponents object will contain tokens for the

subexpressions of the ARN, not string literals. In this case this

function cannot properly parse the complete final resourceName (path) out

of ARNs that use ‘/’ to both separate the ‘resource’ from the

‘resourceName’ AND to subdivide the resourceName further. For example, in

S3 ARNs:

arn:aws:s3:::my_corporate_bucket/path/to/exampleobject.png

After parsing the resourceName will not contain

‘path/to/exampleobject.png’ but simply ‘path’. This is a limitation

because there is no slicing functionality in CloudFormation templates.

Parameters:
  • arn (string) –
  • sepIfToken (string (optional)) –
  • hasName (boolean (optional)) – Whether there is a name component in the ARN at all. For example, SNS Topics ARNs have the ‘resource’ component contain the topic name, and no ‘resourceName’ component.
Returns:

an ArnComponents object which allows access to the various components of the ARN.

Return type:

ArnComponents

prepare()

Overrides @aws-cdk/cdk.Construct.prepare()

Prepare stack

Find all CloudFormation references and tell them we’re consuming them.

Find all dependencies as well and add the appropriate DependsOn fields.

Protected method

renameLogical(oldId, newId)

Rename a generated logical identities

Parameters:
  • oldId (string) –
  • newId (string) –
reportMissingContext(key, details)

Indicate that a context key was expected

Contains instructions on how the key should be supplied.

Parameters:
  • key (string) – Key that uniquely identifies this missing context.
  • details (@aws-cdk/cx-api.MissingContext) – The set of parameters needed to obtain the context (specific to context provider).
requireAccountId([why]) → string

Returns the AWS account ID of this Stack,

or throws an exception if the account ID is not set in the environment.

Parameters:why (string (optional)) – more information about why is the account ID required
Returns:the AWS account ID of this Stack
Return type:string
requireRegion([why]) → string
Parameters:why (string (optional)) – more information about why region is required.
Returns:The region in which this stack is deployed. Throws if region is not defined.
Return type:string
setParameterValue(parameter, value)

Sets the value of a CloudFormation parameter.

Parameters:
  • parameter (Parameter) – The parameter to set the value for
  • value (string) – The value, can use ${} notation to reference other assembly block attributes.
synthesize(session)

Protected method

Parameters:session (ISynthesisSession) –
toCloudFormation() → any

Returns the CloudFormation template for this stack by traversing

the tree and invoking toCloudFormation() on all Entity objects.

Return type:any
accountId

The account in which this stack is defined

Either returns the literal account for this stack if it was specified

literally upon Stack construction, or a symbolic value that will evaluate

to the correct account at deployment time.

Type:string (readonly)
env

The environment in which this stack is deployed.

Type:Environment (readonly)
environment

Returns the environment specification for this stack (aws://account/region).

Type:string (readonly)
logicalIds

Logical ID generation strategy

Type:LogicalIDs (readonly)
missingContext

Lists all missing contextual information.

This is returned when the stack is synthesized under the ‘missing’ attribute

and allows tooling to obtain the context and re-synthesize.

Type:string => @aws-cdk/cx-api.MissingContext (readonly)
name

The CloudFormation stack name.

Type:string (readonly)
notificationArns

Returns the list of notification Amazon Resource Names (ARNs) for the current stack.

Type:string[] (readonly)
partition

The partition in which this stack is defined

Type:string (readonly)
region

The region in which this stack is defined

Either returns the literal region for this stack if it was specified

literally upon Stack construction, or a symbolic value that will evaluate

to the correct region at deployment time.

Type:string (readonly)
stackId

The ID of the stack

Type:string (readonly)
stackName

The name of the stack currently being deployed

Only available at deployment time.

Type:string (readonly)
templateOptions

Options for CloudFormation template (like version, transform, description).

Type:TemplateOptions (readonly)
urlSuffix

The Amazon domain suffix for the region in which this stack is defined

Type:string (readonly)
props

Stack properties.

Type:StackProps (optional) (readonly)
toString() → string

Inherited from @aws-cdk/cdk.Construct

Returns a string representation of this construct.

Return type:string
validate() → string[]

Inherited from @aws-cdk/cdk.Construct

Validate the current construct.

This method can be implemented by derived constructs in order to perform

validation logic. It is called on all constructs before synthesis.

Protected method

Returns:An array of validation error messages, or an empty array if there the construct is valid.
Return type:string[]
dependencyRoots

Inherited from @aws-cdk/cdk.Construct

The set of constructs that form the root of this dependable

All resources under all returned constructs are included in the ordering

dependency.

Type:IConstruct[] (readonly)
node

Inherited from @aws-cdk/cdk.Construct

Construct node.

Type:ConstructNode (readonly)

StackElement

class @aws-cdk/cdk.StackElement(scope, id)

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.StackElement;
const { StackElement } = require('@aws-cdk/cdk');
import { StackElement } from '@aws-cdk/cdk';

An element of a CloudFormation stack.

Extends:

Construct

Abstract:

Yes

Parameters:
static isStackElement(construct) → boolean

Returns true if a construct is a stack element (i.e. part of the

synthesized cloudformation template).

Uses duck-typing instead of instanceof to allow stack elements from different

versions of this library to be included in the same stack.

Parameters:construct (IConstruct) –
Returns:The construct as a stack element or undefined if it is not a stack element.
Return type:boolean
overrideLogicalId(newLogicalId)

Overrides the auto-generated logical ID with a specific ID.

Parameters:newLogicalId (string) – The new logical ID to use for this stack element.
prepare()

Overrides @aws-cdk/cdk.Construct.prepare()

Automatically detect references in this StackElement

Protected method

toCloudFormation() → json

Returns the CloudFormation ‘snippet’ for this entity. The snippet will only be merged

at the root level to ensure there are no identity conflicts.

For example, a Resource class will return something like:

{

Resources: {

[this.logicalId]: {

Type: this.resourceType,

Properties: this.props,

Condition: this.condition

}

}

}

Return type:json
Abstract:Yes
creationStackTrace
Type:string[] (readonly)
logicalId

The logical ID for this CloudFormation stack element. The logical ID of the element

is calculated from the path of the resource node in the construct tree.

To override this value, use overrideLogicalId(newLogicalId).

Type:string (readonly)
stackPath

Return the path with respect to the stack

Type:string (readonly)
toString() → string

Inherited from @aws-cdk/cdk.Construct

Returns a string representation of this construct.

Return type:string
validate() → string[]

Inherited from @aws-cdk/cdk.Construct

Validate the current construct.

This method can be implemented by derived constructs in order to perform

validation logic. It is called on all constructs before synthesis.

Protected method

Returns:An array of validation error messages, or an empty array if there the construct is valid.
Return type:string[]
dependencyRoots

Inherited from @aws-cdk/cdk.Construct

The set of constructs that form the root of this dependable

All resources under all returned constructs are included in the ordering

dependency.

Type:IConstruct[] (readonly)
node

Inherited from @aws-cdk/cdk.Construct

Construct node.

Type:ConstructNode (readonly)

StackProps (interface)

class @aws-cdk/cdk.StackProps

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.StackProps;
// StackProps is an interface
import { StackProps } from '@aws-cdk/cdk';
env

The AWS environment (account/region) where this stack will be deployed.

If not supplied, the default-account and default-region context parameters will be

used. If they are undefined, it will not be possible to deploy the stack.

Type:Environment (optional)
namingScheme

Strategy for logical ID generation

Optional. If not supplied, the HashedNamingScheme will be used.

Type:IAddressingScheme (optional)

StringListOutput

class @aws-cdk/cdk.StringListOutput(scope, id, props)

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.StringListOutput;
const { StringListOutput } = require('@aws-cdk/cdk');
import { StringListOutput } from '@aws-cdk/cdk';

An output for a list of strings.

Exports a list of Tokens via an Output variable, and return a list of Tokens

that selects the imported values for them.

Extends:

Construct

Parameters:
makeImportValues() → string[]

Return an array of imported values for this Output

Return type:string[]
length

Number of elements in the stringlist

Type:number (readonly)
prepare()

Inherited from @aws-cdk/cdk.Construct

Perform final modifications before synthesis

This method can be implemented by derived constructs in order to perform

final changes before synthesis. prepare() will be called after child

constructs have been prepared.

This is an advanced framework feature. Only use this if you

understand the implications.

Protected method

toString() → string

Inherited from @aws-cdk/cdk.Construct

Returns a string representation of this construct.

Return type:string
validate() → string[]

Inherited from @aws-cdk/cdk.Construct

Validate the current construct.

This method can be implemented by derived constructs in order to perform

validation logic. It is called on all constructs before synthesis.

Protected method

Returns:An array of validation error messages, or an empty array if there the construct is valid.
Return type:string[]
dependencyRoots

Inherited from @aws-cdk/cdk.Construct

The set of constructs that form the root of this dependable

All resources under all returned constructs are included in the ordering

dependency.

Type:IConstruct[] (readonly)
node

Inherited from @aws-cdk/cdk.Construct

Construct node.

Type:ConstructNode (readonly)

StringListOutputProps (interface)

class @aws-cdk/cdk.StringListOutputProps

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.StringListOutputProps;
// StringListOutputProps is an interface
import { StringListOutputProps } from '@aws-cdk/cdk';

Properties for ListOutput

values

The list of primitives to export

Type:any[] (readonly)
condition

A condition from the “Conditions” section to associate with this output

value. If the condition evaluates to false, this output value will not

be included in the stack.

Type:Condition (optional) (readonly)
description

A String type that describes the output value.

The description can be a maximum of 4 K in length.

Type:string (optional) (readonly)
disableExport

Disables the automatic allocation of an export name for this output.

Type:boolean (optional) (readonly)
Default:false, which means that an export name is either explicitly

specified or allocated based on the output’s logical ID and stack name.

@aws-cdk/cdk.export

The name used to export the value of this output across stacks. To import

the value from another stack, use FnImportValue(export). You can create

an import value token by calling output.makeImportValue().

Type:string (optional) (readonly)
Default:The default behavior is to automatically allocate an export name

for outputs based on the stack name and the output’s logical ID. To create an output without an export, set disableExport: true.

@aws-cdk/cdk.separator

The separator to use to separate stringified values

Type:string (optional) (readonly)
Default:“,”

SynthesisSession

class @aws-cdk/cdk.SynthesisSession(options)

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.SynthesisSession;
const { SynthesisSession } = require('@aws-cdk/cdk');
import { SynthesisSession } from '@aws-cdk/cdk';
Implements:ISynthesisSession
Parameters:options (SynthesisSessionOptions) –
static isSynthesizable(obj) → boolean
Parameters:obj (any) –
Returns:true if obj implements ISynthesizable.
Return type:boolean
addArtifact(id, artifact)

Implements @aws-cdk/cdk.ISynthesisSession.addArtifact()

Parameters:
addBuildStep(id, step)

Implements @aws-cdk/cdk.ISynthesisSession.addBuildStep()

Parameters:
close() → @aws-cdk/cx-api.AssemblyManifest
Return type:@aws-cdk/cx-api.AssemblyManifest
tryGetArtifact(id) → @aws-cdk/cx-api.Artifact

Implements @aws-cdk/cdk.ISynthesisSession.tryGetArtifact()

Parameters:id (string) –
Return type:@aws-cdk/cx-api.Artifact (optional)
manifest

Implements @aws-cdk/cdk.ISynthesisSession.manifest()

Type:@aws-cdk/cx-api.AssemblyManifest (readonly)
store

Implements @aws-cdk/cdk.ISynthesisSession.store()

Type:ISessionStore (readonly)

SynthesisSessionOptions (interface)

class @aws-cdk/cdk.SynthesisSessionOptions

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.SynthesisSessionOptions;
// SynthesisSessionOptions is an interface
import { SynthesisSessionOptions } from '@aws-cdk/cdk';
store

The file store used for this session.

Where to store the

Type:ISessionStore
legacyManifest

Emit the legacy manifest (cdk.out) when the session is closed (alongside manifest.json).

Type:boolean (optional)
Default:false
runtimeInformation

Include runtime information (module versions) in manifest.

Type:boolean (optional)
Default:true

Tag

class @aws-cdk/cdk.Tag(key, value[, props])

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.Tag;
const { Tag } = require('@aws-cdk/cdk');
import { Tag } from '@aws-cdk/cdk';

The Tag Aspect will handle adding a tag to this node and cascading tags to children

Extends:

TagBase

Parameters:
  • key (string) –
  • value (string) –
  • props (TagProps (optional)) –
applyTag(resource)

Implements @aws-cdk/cdk.TagBase.applyTag()

Protected method

Parameters:resource (ITaggable) –
value

The string value of the tag

Type:string (readonly)
visit(construct)

Inherited from @aws-cdk/cdk.TagBase

All aspects can visit an IConstruct

Parameters:construct (IConstruct) –
key

Inherited from @aws-cdk/cdk.TagBase

The string key for the tag

Type:string (readonly)
props

Inherited from @aws-cdk/cdk.TagBase

Protected property

Type:TagProps (readonly)

TagBase

class @aws-cdk/cdk.TagBase(key[, props])

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.TagBase;
const { TagBase } = require('@aws-cdk/cdk');
import { TagBase } from '@aws-cdk/cdk';

The common functionality for Tag and Remove Tag Aspects

Implements:

IAspect

Abstract:

Yes

Parameters:
  • key (string) –
  • props (TagProps (optional)) –
applyTag(resource)

Protected method

Parameters:resource (ITaggable) –
Abstract:Yes
visit(construct)

Implements @aws-cdk/cdk.IAspect.visit()

All aspects can visit an IConstruct

Parameters:construct (IConstruct) –
key

The string key for the tag

Type:string (readonly)
props

Protected property

Type:TagProps (readonly)

TagManager

class @aws-cdk/cdk.TagManager(tagType, resourceTypeName)

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.TagManager;
const { TagManager } = require('@aws-cdk/cdk');
import { TagManager } from '@aws-cdk/cdk';

TagManager facilitates a common implementation of tagging for Constructs.

Parameters:
  • tagType (TagType) –
  • resourceTypeName (string) –
removeTag(key[, props])

Removes the specified tag from the array if it exists

Parameters:
  • key (string) – The key of the tag to remove
  • props (TagProps (optional)) –
renderTags() → any

Renders tags into the proper format based on TagType

Return type:any
setTag(key, value[, props])

Adds the specified tag to the array of tags

Parameters:
  • key (string) – The key value of the tag
  • value (string) – The value value of the tag
  • props (TagProps (optional)) – A TagProps defaulted to applyToLaunchInstances true
resourceTypeName
Type:string (readonly)
tagType
Type:TagType (readonly)

TagProps (interface)

class @aws-cdk/cdk.TagProps

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.TagProps;
// TagProps is an interface
import { TagProps } from '@aws-cdk/cdk';

Properties for a tag

applyToLaunchedInstances

Handles AutoScalingGroup PropagateAtLaunch property

Type:boolean (optional)
excludeResourceTypes

An array of Resource Types that will not receive this tag

An empty array will allow this tag to be applied to all resources. A

non-empty array will apply this tag only if the Resource type is not in

this array.

Type:string[] (optional)
Default:[]
includeResourceTypes

An array of Resource Types that will receive this tag

An empty array will match any Resource. A non-empty array will apply this

tag only to Resource types that are included in this array.

Type:string[] (optional)
Default:[]
priority

Higher or equal priority tags will take precedence

Setting priority will enable the user to control tags when they need to not

follow the default precedence pattern of last applied and closest to the

construct in the tree.

Type:number (optional)
Default:0 for Tag 1 for RemoveTag

TagType (enum)

class @aws-cdk/cdk.TagType

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.TagType;
const { TagType } = require('@aws-cdk/cdk');
import { TagType } from '@aws-cdk/cdk';
Standard
AutoScalingGroup
Map
NotTaggable

TemplateOptions (interface)

class @aws-cdk/cdk.TemplateOptions

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.TemplateOptions;
// TemplateOptions is an interface
import { TemplateOptions } from '@aws-cdk/cdk';

CloudFormation template options for a stack.

description

Gets or sets the description of this stack.

If provided, it will be included in the CloudFormation template’s “Description” attribute.

Type:string (optional)
metadata

Metadata associated with the CloudFormation template.

Type:string => any (optional)
templateFormatVersion

Gets or sets the AWSTemplateFormatVersion field of the CloudFormation template.

Type:string (optional)
transform

Gets or sets the top-level template transform for this stack (e.g. “AWS::Serverless-2016-10-31”).

Type:string (optional)

Token

class @aws-cdk/cdk.Token([valueOrFunction[, displayName]])

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.Token;
const { Token } = require('@aws-cdk/cdk');
import { Token } from '@aws-cdk/cdk';

Represents a special or lazily-evaluated value.

Can be used to delay evaluation of a certain value in case, for example,

that it requires some context or late-bound data. Can also be used to

mark values that need special processing at document rendering time.

Tokens can be embedded into strings while retaining their original

semantics.

Parameters:
  • valueOrFunction (any (optional)) – What this token will evaluate to, literal or function.
  • displayName (string (optional)) – A human-readable display hint for this Token
resolve(_context) → any
Parameters:_context (ResolveContext) –
Returns:The resolved value for this token.
Return type:any
toJSON() → any

Turn this Token into JSON

This gets called by JSON.stringify(). We want to prohibit this, because

it’s not possible to do this properly, so we just throw an error here.

Return type:any
toList() → string[]

Return a string list representation of this token

Call this if the Token intrinsically evaluates to a list of strings.

If so, you can represent the Token in a similar way in the type

system.

Note that even though the Token is represented as a list of strings, you

still cannot do any operations on it such as concatenation, indexing,

or taking its length. The only useful operations you can do to these lists

is constructing a FnJoin or a FnSelect on it.

Return type:string[]
toString() → string

Return a reversible string representation of this token

If the Token is initialized with a literal, the stringified value of the

literal is returned. Otherwise, a special quoted string representation

of the Token is returned that can be embedded into other strings.

Strings with quoted Tokens in them can be restored back into

complex values with the Tokens restored by calling resolve()

on the string.

Return type:string
displayName

A human-readable display hint for this Token

Type:string (optional) (readonly)
isReference

Indicate whether this Token represent a “reference”

The Construct tree can be queried for the Reference Tokens that

are used in it.

Type:boolean (optional) (readonly)
valueOrFunction

What this token will evaluate to, literal or function.

Type:any (optional) (readonly)

UpdatePolicy (interface)

class @aws-cdk/cdk.UpdatePolicy

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.UpdatePolicy;
// UpdatePolicy is an interface
import { UpdatePolicy } from '@aws-cdk/cdk';

Use the UpdatePolicy attribute to specify how AWS CloudFormation handles updates to the AWS::AutoScaling::AutoScalingGroup

resource. AWS CloudFormation invokes one of three update policies depending on the type of change you make or whether a

scheduled action is associated with the Auto Scaling group.

autoScalingReplacingUpdate

Specifies whether an Auto Scaling group and the instances it contains are replaced during an update. During replacement,

AWS CloudFormation retains the old group until it finishes creating the new one. If the update fails, AWS CloudFormation

can roll back to the old Auto Scaling group and delete the new Auto Scaling group.

Type:AutoScalingReplacingUpdate (optional)
autoScalingRollingUpdate

To specify how AWS CloudFormation handles rolling updates for an Auto Scaling group, use the AutoScalingRollingUpdate

policy. Rolling updates enable you to specify whether AWS CloudFormation updates instances that are in an Auto Scaling

group in batches or all at once.

Type:AutoScalingRollingUpdate (optional)
autoScalingScheduledAction

To specify how AWS CloudFormation handles updates for the MinSize, MaxSize, and DesiredCapacity properties when

the AWS::AutoScaling::AutoScalingGroup resource has an associated scheduled action, use the AutoScalingScheduledAction

policy.

Type:AutoScalingScheduledAction (optional)
codeDeployLambdaAliasUpdate

To perform an AWS CodeDeploy deployment when the version changes on an AWS::Lambda::Alias resource,

use the CodeDeployLambdaAliasUpdate update policy.

Type:CodeDeployLambdaAliasUpdate (optional)
useOnlineResharding

To modify a replication group’s shards by adding or removing shards, rather than replacing the entire

AWS::ElastiCache::ReplicationGroup resource, use the UseOnlineResharding update policy.

Type:boolean (optional)

ValidationError

class @aws-cdk/cdk.ValidationError(source, message)

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.ValidationError;
const { ValidationError } = require('@aws-cdk/cdk');
import { ValidationError } from '@aws-cdk/cdk';
Parameters:
message
Type:string (readonly)
source
Type:IConstruct (readonly)

ValidationResult

class @aws-cdk/cdk.ValidationResult([errorMessage[, results]])

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.ValidationResult;
const { ValidationResult } = require('@aws-cdk/cdk');
import { ValidationResult } from '@aws-cdk/cdk';

Representation of validation results

Models a tree of validation errors so that we have as much information as possible

about the failure that occurred.

Parameters:
assertSuccess()

Turn a failed validation into an exception

errorTree() → string

Return a string rendering of the tree of validation failures

Return type:string
prefix(message) → @aws-cdk/cdk.ValidationResult

Wrap this result with an error message, if it concerns an error

Parameters:message (string) –
Return type:ValidationResult
errorMessage
Type:string (readonly)
isSuccess
Type:boolean (readonly)
results
Type:ValidationResults (readonly)

ValidationResults

class @aws-cdk/cdk.ValidationResults([results])

Language-specific names:

using Amazon.CDK;
import software.amazon.awscdk.ValidationResults;
const { ValidationResults } = require('@aws-cdk/cdk');
import { ValidationResults } from '@aws-cdk/cdk';

A collection of validation results

Parameters:results (ValidationResult[] (optional)) –
collect(result)
Parameters:result (ValidationResult) –
errorTreeList() → string
Return type:string
wrap(message) → @aws-cdk/cdk.ValidationResult

Wrap up all validation results into a single tree node

If there are failures in the collection, add a message, otherwise

return a success.

Parameters:message (string) –
Return type:ValidationResult
isSuccess
Type:boolean (readonly)
results
Type:ValidationResult[]