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).

Reference

View in Nuget

csproj:

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

dotnet:

dotnet add package Amazon.CDK --version 0.22.0

packages.config:

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

View in Maven Central

Apache Buildr:

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

Apache Ivy:

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

Apache Maven:

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

Gradle / Grails:

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

Groovy Grape:

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

View in NPM

npm:

$ npm i @aws-cdk/cdk@0.22.0

package.json:

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

yarn:

$ yarn add @aws-cdk/cdk@0.22.0

View in NPM

npm:

$ npm i @aws-cdk/cdk@0.22.0

package.json:

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

yarn:

$ yarn add @aws-cdk/cdk@0.22.0

App

class @aws-cdk/cdk.App

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
collectMetadata(stack) → string => @aws-cdk/cdk.MetadataEntry[]

Returns metadata for all constructs in the stack.

Parameters:stack (Stack) –
Return type:string => MetadataEntry[]
run()

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

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[]
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 ‘:’. Will only be used if path 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([scope])

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.

Parameters:scope (Construct (optional)) –
accountId
Type:string (readonly)
notificationArns
Type:string[] (readonly)
noValue
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)

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 isInstance(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)

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)

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[]
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)
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)
dependencyElements

Inherited from @aws-cdk/cdk.StackElement

Returns the set of all stack elements (resources, parameters, conditions)

that should be added when a resource “depends on” this construct.

Type:IDependable[] (readonly)
logicalId

Inherited from @aws-cdk/cdk.StackElement

The logical ID for this CloudFormation stack element

Type:string (readonly)
stackPath

Inherited from @aws-cdk/cdk.StackElement

Return the path with respect to the stack

Type:string (readonly)
stack

Inherited from @aws-cdk/cdk.StackElement

The stack this Construct has been made a part of

Protected property

Type:Stack

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 isInstance(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[]
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

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[]
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
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[]
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)
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

BreadthFirst

Breadth first

DepthFirst

Depth 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.

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

value

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[]
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)

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

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.

node

The construct node in the scope tree.

Type:ConstructNode (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';

Represents a construct that can be “depended on” via addDependency.

dependencyElements

Returns the set of all stack elements (resources, parameters, conditions)

that should be added when a resource “depends on” this construct.

Type:IDependable[] (readonly)

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';

ITaggable indicates a entity manages tags via the tags property

tags
Type:TagManager (readonly)

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[]
node

Inherited from @aws-cdk/cdk.Construct

Construct node.

Type:ConstructNode (readonly)
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)
dependencyElements

Inherited from @aws-cdk/cdk.StackElement

Returns the set of all stack elements (resources, parameters, conditions)

that should be added when a resource “depends on” this construct.

Type:IDependable[] (readonly)
logicalId

Inherited from @aws-cdk/cdk.StackElement

The logical ID for this CloudFormation stack element

Type:string (readonly)
stackPath

Inherited from @aws-cdk/cdk.StackElement

Return the path with respect to the stack

Type:string (readonly)
stack

Inherited from @aws-cdk/cdk.StackElement

The stack this Construct has been made a part of

Protected property

Type:Stack

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[]
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)
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)
dependencyElements

Inherited from @aws-cdk/cdk.StackElement

Returns the set of all stack elements (resources, parameters, conditions)

that should be added when a resource “depends on” this construct.

Type:IDependable[] (readonly)
logicalId

Inherited from @aws-cdk/cdk.StackElement

The logical ID for this CloudFormation stack element

Type:string (readonly)
stackPath

Inherited from @aws-cdk/cdk.StackElement

Return the path with respect to the stack

Type:string (readonly)
stack

Inherited from @aws-cdk/cdk.StackElement

The stack this Construct has been made a part of

Protected property

Type:Stack

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
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.

Type:string (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[]
node

Inherited from @aws-cdk/cdk.Construct

Construct node.

Type:ConstructNode (readonly)
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)
dependencyElements

Inherited from @aws-cdk/cdk.StackElement

Returns the set of all stack elements (resources, parameters, conditions)

that should be added when a resource “depends on” this construct.

Type:IDependable[] (readonly)
logicalId

Inherited from @aws-cdk/cdk.StackElement

The logical ID for this CloudFormation stack element

Type:string (readonly)
stackPath

Inherited from @aws-cdk/cdk.StackElement

Return the path with respect to the stack

Type:string (readonly)
stack

Inherited from @aws-cdk/cdk.StackElement

The stack this Construct has been made a part of

Protected property

Type:Stack

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.

Type:boolean (optional)
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)
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.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
value

A token that represents the actual value of this parameter.

Type:Token
valueAsList

The parameter value token represented as a string array.

Type:string[]
valueAsString

The parameter value token represented as a string.

Type:string
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[]
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)
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)
dependencyElements

Inherited from @aws-cdk/cdk.StackElement

Returns the set of all stack elements (resources, parameters, conditions)

that should be added when a resource “depends on” this construct.

Type:IDependable[] (readonly)
logicalId

Inherited from @aws-cdk/cdk.StackElement

The logical ID for this CloudFormation stack element

Type:string (readonly)
stackPath

Inherited from @aws-cdk/cdk.StackElement

Return the path with respect to the stack

Type:string (readonly)
stack

Inherited from @aws-cdk/cdk.StackElement

The stack this Construct has been made a part of

Protected property

Type:Stack

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[]
node

Inherited from @aws-cdk/cdk.Construct

Construct node.

Type:ConstructNode (readonly)
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)
dependencyElements

Inherited from @aws-cdk/cdk.StackElement

Returns the set of all stack elements (resources, parameters, conditions)

that should be added when a resource “depends on” this construct.

Type:IDependable[] (readonly)
logicalId

Inherited from @aws-cdk/cdk.StackElement

The logical ID for this CloudFormation stack element

Type:string (readonly)
stackPath

Inherited from @aws-cdk/cdk.StackElement

Return the path with respect to the stack

Type:string (readonly)
stack

Inherited from @aws-cdk/cdk.StackElement

The stack this Construct has been made a part of

Protected property

Type:Stack

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.

RemoveProps (interface)

class @aws-cdk/cdk.RemoveProps

Language-specific names:

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

Properties for removing tags

blockPropagate

If true prevent this tag form being set via propagation

Type:boolean (optional)
Default:true

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
addDeletionOverride(path)

Syntactic sugar for addOverride(path, undefined).

Parameters:path (string) – The path of the value to delete
addDependency(*other)

Adds a dependency on another resource.

Parameters:*other (IDependable) – The other 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[]
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)
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)
dependencyElements

Inherited from @aws-cdk/cdk.StackElement

Returns the set of all stack elements (resources, parameters, conditions)

that should be added when a resource “depends on” this construct.

Type:IDependable[] (readonly)
logicalId

Inherited from @aws-cdk/cdk.StackElement

The logical ID for this CloudFormation stack element

Type:string (readonly)
stackPath

Inherited from @aws-cdk/cdk.StackElement

Return the path with respect to the stack

Type:string (readonly)
stack

Inherited from @aws-cdk/cdk.StackElement

The stack this Construct has been made a part of

Protected property

Type:Stack

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)

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[]
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[]
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)
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)
dependencyElements

Inherited from @aws-cdk/cdk.StackElement

Returns the set of all stack elements (resources, parameters, conditions)

that should be added when a resource “depends on” this construct.

Type:IDependable[] (readonly)
logicalId

Inherited from @aws-cdk/cdk.StackElement

The logical ID for this CloudFormation stack element

Type:string (readonly)
stackPath

Inherited from @aws-cdk/cdk.StackElement

Return the path with respect to the stack

Type:string (readonly)
stack

Inherited from @aws-cdk/cdk.StackElement

The stack this Construct has been made a part of

Protected property

Type:Stack

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

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[]
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 find(scope) → @aws-cdk/cdk.Stack

Traverses the tree and looks up for the Stack root.

Parameters:scope (IConstruct) – A construct in the tree
Returns:The Stack object (throws if the node is not part of a Stack-rooted tree)
Return type:Stack
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.

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
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)
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[]
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

Implements:

IDependable

Abstract:

Yes

Parameters:
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)
dependencyElements

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

Returns the set of all stack elements (resources, parameters, conditions)

that should be added when a resource “depends on” this construct.

Type:IDependable[] (readonly)
logicalId

The logical ID for this CloudFormation stack element

Type:string (readonly)
stackPath

Return the path with respect to the stack

Type:string (readonly)
stack

The stack this Construct has been made a part of

Protected property

Type:Stack
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[]
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[]
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:“,”

Tag (interface)

class @aws-cdk/cdk.Tag

Language-specific names:

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

TagGroups (interface)

class @aws-cdk/cdk.TagGroups

Language-specific names:

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

This is the interface for arguments to tagFormatResolve to enable extensions

ancestorTags

Tags that are propagated from ancestors

Type:string => string
nonStickyTags

Tags that are overwritten by ancestor tags

Type:string => string
propagateTags

Tags with propagate true not from an ancestor

Type:string => string
stickyTags

Tags that overwrite ancestor tags

Type:string => string

TagManager

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

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.

Each construct that wants to support tags should implement the ITaggable

interface and properly pass tags to the Resources (Cloudformation) elements

the Construct creates. The TagManager extends Token the object can be

passed directly to Resources that support tag properties.

There are a few standard use cases the TagManager supports for managing

tags across the resources in your stack.

Propagation: If you tag a resource and it has children, by default those tags

will be propagated to the children. This is controlled by

TagProps.propagate.

Default a tag unless an ancestor has a value: There are situations where a

construct author might want to set a tag value, but choose to take a parents

value. For example, you might default {Key: “Compliance”, Value: “None”},

but if a parent has {Key: “Compliance”, Value: “PCI”} allow that parent to

override your tag. This is can be done by setting TagProps.sticky to false.

The default behavior is that child tags have precedence and TagProps.sticky

defaults to true to reflect this.

Overwrite: Construct authors have the need to set a tag, but only if one was

not provided by the consumer. The most common example is the Name tag.

Overwrite is for this purpose and is controlled by TagProps.overwrite. The

default is true.

Removing Tags: Tags can be removed from the local manager via removeTag. If

a parent also has a tag with the same name then it can be propagated to the

child (after removal). The user can control this RemoveProps.blockPropagate. By default

this is true and prevents a parent tag from propagating to the child after

the removeTag is invoked. However, if user wants the parent tag to

propagate, if it is provided by a parent this can be set to false.

Extends:

Token

Parameters:
static isTaggable(taggable) → boolean

Checks if the object implements the ITaggable interface

Parameters:taggable (any) –
Return type:boolean
removeTag(key[, props])

Removes the specified tag from the array if it exists

Parameters:
  • key (string) – The key of the tag to remove
  • props (RemoveProps (optional)) – The RemoveProps for the tag
resolve(_context) → any

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

Converts the tags to a Token for use in lazy evaluation

Parameters:_context (ResolveContext) –
Return type:any
setTag(key, value[, tagProps])

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
  • tagProps (TagProps (optional)) –
tagFormatResolve(tagGroups) → any

Handles returning the tags in the desired format

This function can be overridden to support another tag format. This was

specifically designed to enable AutoScalingGroup Tags that have an

additional CloudFormation key for PropagateAtLaunch

Protected method

Parameters:tagGroups (TagGroups) –
Return type:any
scope
Type:Construct (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)
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)

TagManagerProps (interface)

class @aws-cdk/cdk.TagManagerProps

Language-specific names:

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

Properties for Tag Manager

initialTags

Initial tags to set on the tag manager using TAG_DEFAULTS

Type:string => string (optional)

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

overwrite

If set this tag will overwrite existing tags

Type:boolean (optional)
Default:true
propagate

If true all child taggable Constructs will receive this tag

Type:boolean (optional)
Default:true
sticky

If set propagated tags from parents will not overwrite the tag

Type:boolean (optional)
Default:true

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[]