aws-cdk
- Version 2.178.2
- Published
- 29.4 MB
- No dependencies
- Apache-2.0 license
Install
npm i aws-cdk
yarn add aws-cdk
pnpm add aws-cdk
Overview
CDK Toolkit, the command line tool for CDK apps
Index
Variables
Functions
- assertIsSuccessfulDeployStackResult()
- changeSetHasNoChanges()
- cleanupOldChangeset()
- cli()
- createDiffChangeSet()
- exec()
- formatSdkLoggerContent()
- initContextProviderSdk()
- loadCurrentTemplate()
- loadCurrentTemplateWithNestedStacks()
- stabilizeStack()
- uploadStackTemplateAssets()
- waitForChangeSet()
- waitForStackDelete()
- waitForStackDeploy()
Classes
Interfaces
ICloudFormationClient
- continueUpdateRollback()
- createChangeSet()
- createGeneratedTemplate()
- createStack()
- deleteChangeSet()
- deleteGeneratedTemplate()
- deleteStack()
- describeChangeSet()
- describeGeneratedTemplate()
- describeResourceScan()
- describeStackEvents()
- describeStackResources()
- describeStacks()
- executeChangeSet()
- getGeneratedTemplate()
- getTemplate()
- getTemplateSummary()
- listExports()
- listResourceScanRelatedResources()
- listResourceScanResources()
- listResourceScans()
- listStackResources()
- listStacks()
- rollbackStack()
- startResourceScan()
- updateStack()
- updateTerminationProtection()
Type Aliases
Namespaces
legacy
- aliases
- availableInitTemplates()
- AwsCliCompatible
- Bootstrapper
- cached()
- CfnEvaluationException
- CI
- cli()
- CloudExecutable
- command
- Command
- Configuration
- contentHash()
- CredentialPlugins
- data()
- debug()
- deepClone()
- deepMerge()
- Deployments
- deployStack()
- describe
- enableTracing()
- error()
- exec()
- execProgram()
- flatten()
- formatAsBanner()
- highlight()
- ifDefined()
- increaseVerbosity()
- isArray()
- isEmpty()
- latestVersionIfHigher()
- leftPad()
- LoggerFunction
- logLevel
- LogLevel
- lowerCaseFirstCharacter()
- numberFromBool()
- partition()
- PluginHost
- prefix()
- print()
- PROJECT_CONTEXT
- RequireApproval
- rootDir()
- SdkProvider
- setCI()
- setLogLevel()
- Settings
- success()
- trace()
- versionNumber()
- warning()
- withCorkedLogging()
Variables
variable BOOTSTRAP_VARIANT_PARAMETER
const BOOTSTRAP_VARIANT_PARAMETER: string;
variable BOOTSTRAP_VERSION_OUTPUT
const BOOTSTRAP_VERSION_OUTPUT: string;
variable BOOTSTRAP_VERSION_RESOURCE
const BOOTSTRAP_VERSION_RESOURCE: string;
variable BUCKET_DOMAIN_NAME_OUTPUT
const BUCKET_DOMAIN_NAME_OUTPUT: string;
variable BUCKET_NAME_OUTPUT
const BUCKET_NAME_OUTPUT: string;
variable DEFAULT_BOOTSTRAP_VARIANT
const DEFAULT_BOOTSTRAP_VARIANT: string;
The assumed vendor of a template in case it is not set
variable DEFAULT_TOOLKIT_STACK_NAME
const DEFAULT_TOOLKIT_STACK_NAME: string;
variable ECR_ISOLATED_TAG
const ECR_ISOLATED_TAG: string;
variable REPOSITORY_NAME_OUTPUT
const REPOSITORY_NAME_OUTPUT: string;
variable S3_ISOLATED_TAG
const S3_ISOLATED_TAG: string;
Functions
function assertIsSuccessfulDeployStackResult
assertIsSuccessfulDeployStackResult: ( x: DeployStackResult) => asserts x is SuccessfulDeployStackResult;
function changeSetHasNoChanges
changeSetHasNoChanges: (description: DescribeChangeSetCommandOutput) => boolean;
Return true if the given change set has no changes
This must be determined from the status, not the 'Changes' array on the object; the latter can be empty because no resources were changed, but if there are changes to Outputs, the change set can still be executed.
function cleanupOldChangeset
cleanupOldChangeset: ( changeSetName: string, stackName: string, cfn: ICloudFormationClient) => Promise<void>;
function cli
cli: (args?: string[]) => void;
function createDiffChangeSet
createDiffChangeSet: ( options: PrepareChangeSetOptions) => Promise<DescribeChangeSetCommandOutput | undefined>;
Create a changeset for a diff operation
function exec
exec: (args: string[], synthesizer?: Synthesizer) => Promise<number | void>;
function formatSdkLoggerContent
formatSdkLoggerContent: (content: any[]) => string;
This can be anything.
For debug, it seems to be mostly strings. For info, it seems to be objects.
Stringify and join without separator.
function initContextProviderSdk
initContextProviderSdk: ( aws: SdkProvider, options: ContextLookupRoleOptions) => Promise<SDK>;
Instantiate an SDK for context providers. This function ensures that all lookup assume role options are used when context providers perform lookups.
function loadCurrentTemplate
loadCurrentTemplate: ( stackArtifact: CloudFormationStackArtifact, sdk: SDK, retrieveProcessedTemplate?: boolean) => Promise<Template>;
Returns the currently deployed template from CloudFormation that corresponds to
stackArtifact
.
function loadCurrentTemplateWithNestedStacks
loadCurrentTemplateWithNestedStacks: ( rootStackArtifact: CloudFormationStackArtifact, sdk: SDK, retrieveProcessedTemplate?: boolean) => Promise<RootTemplateWithNestedStacks>;
Reads the currently deployed template and all of its nested stack templates from CloudFormation.
function stabilizeStack
stabilizeStack: ( cfn: ICloudFormationClient, stackName: string) => Promise<CloudFormationStack | undefined>;
Wait for a stack to become stable (no longer _IN_PROGRESS), returning it
function uploadStackTemplateAssets
uploadStackTemplateAssets: ( stack: cxapi.CloudFormationStackArtifact, deployments: Deployments) => Promise<void>;
Uploads the assets that look like templates for this CloudFormation stack
This is necessary for any CloudFormation call that needs the template, it may need to be uploaded to an S3 bucket first. We have to follow the instructions in the asset manifest, because technically that is the only place that knows about bucket and assumed roles and such.
function waitForChangeSet
waitForChangeSet: ( cfn: ICloudFormationClient, stackName: string, changeSetName: string, { fetchAll }: { fetchAll: boolean }) => Promise<DescribeChangeSetCommandOutput>;
Waits for a ChangeSet to be available for triggering a StackUpdate.
Will return a changeset that is either ready to be executed or has no changes. Will throw in other cases.
Parameter cfn
a CloudFormation client
Parameter stackName
the name of the Stack that the ChangeSet belongs to
Parameter changeSetName
the name of the ChangeSet
Parameter fetchAll
if true, fetches all pages of the ChangeSet before returning.
Returns
the CloudFormation description of the ChangeSet
function waitForStackDelete
waitForStackDelete: ( cfn: ICloudFormationClient, stackName: string) => Promise<CloudFormationStack | undefined>;
Waits for a CloudFormation stack to stabilize in a complete/available state after a delete operation is issued.
Fails if the stack is in a FAILED state. Will not fail if the stack was already deleted.
Parameter cfn
a CloudFormation client
Parameter stackName
the name of the stack to wait for after a delete
Returns
the CloudFormation description of the stabilized stack after the delete attempt
function waitForStackDeploy
waitForStackDeploy: ( cfn: ICloudFormationClient, stackName: string) => Promise<CloudFormationStack | undefined>;
Waits for a CloudFormation stack to stabilize in a complete/available state after an update/create operation is issued.
Fails if the stack is in a FAILED state, ROLLBACK state, or DELETED state.
Parameter cfn
a CloudFormation client
Parameter stackName
the name of the stack to wait for after an update
Returns
the CloudFormation description of the stabilized stack after the update attempt
Classes
class AssetManifestBuilder
class AssetManifestBuilder {}
method addDockerImageAsset
addDockerImageAsset: ( id: string, source: cxschema.DockerImageSource, destination: cxschema.DockerImageDestination) => void;
method addFileAsset
addFileAsset: ( id: string, source: cxschema.FileSource, destination: cxschema.FileDestination) => void;
method toManifest
toManifest: (directory: string) => AssetManifest;
class Bootstrapper
class Bootstrapper {}
constructor
constructor(source?: BootstrapSource);
method bootstrapEnvironment
bootstrapEnvironment: ( environment: cxapi.Environment, sdkProvider: SdkProvider, options?: BootstrapEnvironmentOptions) => Promise<SuccessfulDeployStackResult>;
method showTemplate
showTemplate: (json: boolean) => Promise<void>;
class CloudFormationStack
class CloudFormationStack {}
Represents an (existing) Stack in CloudFormation
Bundle and cache some information that we need during deployment (so we don't have to make repeated calls to CloudFormation).
constructor
protected constructor( cfn: ICloudFormationClient, stackName: string, stack?: any, retrieveProcessedTemplate?: boolean);
property exists
readonly exists: boolean;
Whether the stack exists
property notificationArns
readonly notificationArns: string[];
SNS Topic ARNs that will receive stack events.
Empty list if the stack does not exist
property outputs
readonly outputs: Record<string, string>;
The stack's current outputs
Empty object if the stack doesn't exist
property parameterNames
readonly parameterNames: string[];
Return the names of all current parameters to the stack
Empty list if the stack does not exist.
property parameters
readonly parameters: Record<string, string>;
Return the names and values of all current parameters to the stack
Empty object if the stack does not exist.
property stackId
readonly stackId: string;
The stack's ID
Throws if the stack doesn't exist.
property stackName
readonly stackName: string;
property stackStatus
readonly stackStatus: StackStatus;
The stack's status
Special status NOT_FOUND if the stack does not exist.
property tags
readonly tags: Tag[];
The stack's current tags
Empty list if the stack does not exist
property terminationProtection
readonly terminationProtection: boolean;
Return the termination protection of the stack
method doesNotExist
static doesNotExist: ( cfn: ICloudFormationClient, stackName: string) => CloudFormationStack;
Return a copy of the given stack that does not exist
It's a little silly that it needs arguments to do that, but there we go.
method fromStaticInformation
static fromStaticInformation: ( cfn: ICloudFormationClient, stackName: string, stack: Stack) => CloudFormationStack;
From static information (for testing)
method lookup
static lookup: ( cfn: ICloudFormationClient, stackName: string, retrieveProcessedTemplate?: boolean) => Promise<CloudFormationStack>;
method template
template: () => Promise<Template>;
Retrieve the stack's deployed template
Cached, so will only be retrieved once. Will return an empty structure if the stack does not exist.
class Deployments
class Deployments {}
Scope for a single set of deployments from a set of Cloud Assembly Artifacts
Manages lookup of SDKs, Bootstrap stacks, etc.
constructor
constructor(props: DeploymentsProps);
property envs
readonly envs: EnvironmentAccess;
method buildAssets
buildAssets: ( asset: cxapi.AssetManifestArtifact, options: BuildStackAssetsOptions) => Promise<void>;
Build all assets in a manifest
Deprecated
Use
buildSingleAsset
instead
method buildSingleAsset
buildSingleAsset: ( assetArtifact: cxapi.AssetManifestArtifact | 'no-version-validation', assetManifest: cdk_assets.AssetManifest, asset: cdk_assets.IManifestEntry, options: BuildStackAssetsOptions) => Promise<void>;
Build a single asset from an asset manifest
If an assert manifest artifact is given, the bootstrap stack version will be validated according to the constraints in that manifest artifact. If that is not necessary,
'no-version-validation'
can be passed.
method deployStack
deployStack: (options: DeployStackOptions) => Promise<DeployStackResult>;
method destroyStack
destroyStack: (options: DestroyStackOptions) => Promise<void>;
method isSingleAssetPublished
isSingleAssetPublished: ( assetManifest: cdk_assets.AssetManifest, asset: cdk_assets.IManifestEntry, options: PublishStackAssetsOptions) => Promise<boolean>;
Return whether a single asset has been published already
method publishAssets
publishAssets: ( asset: cxapi.AssetManifestArtifact, options: PublishStackAssetsOptions) => Promise<void>;
Publish all assets in a manifest
Deprecated
Use
publishSingleAsset
instead
method publishSingleAsset
publishSingleAsset: ( assetManifest: cdk_assets.AssetManifest, asset: cdk_assets.IManifestEntry, options: PublishStackAssetsOptions) => Promise<void>;
Publish a single asset from an asset manifest
method readCurrentTemplate
readCurrentTemplate: ( stackArtifact: cxapi.CloudFormationStackArtifact) => Promise<Template>;
method readCurrentTemplateWithNestedStacks
readCurrentTemplateWithNestedStacks: ( rootStackArtifact: cxapi.CloudFormationStackArtifact, retrieveProcessedTemplate?: boolean) => Promise<RootTemplateWithNestedStacks>;
method resolveEnvironment
resolveEnvironment: ( stack: cxapi.CloudFormationStackArtifact) => Promise<cxapi.Environment>;
Resolves the environment for a stack.
method resourceIdentifierSummaries
resourceIdentifierSummaries: ( stackArtifact: cxapi.CloudFormationStackArtifact) => Promise<ResourceIdentifierSummaries>;
method rollbackStack
rollbackStack: (options: RollbackStackOptions) => Promise<RollbackStackResult>;
method stackExists
stackExists: (options: StackExistsOptions) => Promise<boolean>;
class GarbageCollector
class GarbageCollector {}
A class to facilitate Garbage Collection of S3 and ECR assets
constructor
constructor(props: GarbageCollectorProps);
property props
readonly props: GarbageCollectorProps;
method garbageCollect
garbageCollect: () => Promise<void>;
Perform garbage collection on the resolved environment.
method garbageCollectEcr
garbageCollectEcr: ( sdk: SDK, activeAssets: ActiveAssetCache, backgroundStackRefresh: BackgroundStackRefresh) => Promise<void>;
Perform garbage collection on ECR assets
method garbageCollectS3
garbageCollectS3: ( sdk: SDK, activeAssets: ActiveAssetCache, backgroundStackRefresh: BackgroundStackRefresh) => Promise<void>;
Perform garbage collection on S3 assets
class ImageAsset
class ImageAsset {}
An image asset that lives in the bootstrapped ECR Repository
constructor
constructor(digest: string, size: number, tags: string[], manifest: string);
property digest
readonly digest: string;
property manifest
readonly manifest: string;
property size
readonly size: number;
property tags
readonly tags: string[];
method buildImageTag
buildImageTag: (inc: number) => string;
method dateIsolated
dateIsolated: () => string | undefined;
method getIsolatedTag
getIsolatedTag: () => string | undefined;
method hasIsolatedTag
hasIsolatedTag: () => boolean;
method isolatedTagBefore
isolatedTagBefore: (date: Date) => boolean;
class ObjectAsset
class ObjectAsset {}
An object asset that lives in the bootstrapped S3 Bucket
constructor
constructor(bucket: string, key: string, size: number);
property key
readonly key: string;
property size
readonly size: number;
method allTags
allTags: (s3: IS3Client) => Promise<Tag[] | undefined>;
method fileName
fileName: () => string;
method hasIsolatedTag
hasIsolatedTag: () => boolean;
method isolatedTagBefore
isolatedTagBefore: (date: Date) => boolean;
class ParameterValues
class ParameterValues {}
The set of parameters we're going to pass to a Stack
constructor
constructor( formalParams: Record<string, TemplateParameter>, updates: Record<string, string>, previousValues?: Record<string, string>);
property apiParameters
readonly apiParameters: Parameter[];
property values
readonly values: Record<string, string>;
method hasChanges
hasChanges: (currentValues: Record<string, string>) => ParameterChanges;
Whether this set of parameter updates will change the actual stack values
class SDK
class SDK {}
Base functionality of SDK without credential fetching
constructor
constructor( credProvider: AwsCredentialIdentityProvider, region: string, requestHandler: NodeHttpHandlerOptions, logger?: Logger);
property config
readonly config: ConfigurationOptions;
property currentRegion
readonly currentRegion: string;
property logger
protected readonly logger?: Logger;
method appendCustomUserAgent
appendCustomUserAgent: (userAgentData?: string) => void;
method appsync
appsync: () => IAppSyncClient;
method cloudFormation
cloudFormation: () => ICloudFormationClient;
method cloudWatchLogs
cloudWatchLogs: () => ICloudWatchLogsClient;
method codeBuild
codeBuild: () => ICodeBuildClient;
method currentAccount
currentAccount: () => Promise<Account>;
method ec2
ec2: () => IEC2Client;
method ecr
ecr: () => IECRClient;
method ecs
ecs: () => IECSClient;
method elbv2
elbv2: () => IElasticLoadBalancingV2Client;
method getUrlSuffix
getUrlSuffix: (region: string) => Promise<string>;
The AWS SDK v3 requires a client config and a command in order to get an endpoint for any given service.
method iam
iam: () => IIAMClient;
method kms
kms: () => IKMSClient;
method lambda
lambda: () => ILambdaClient;
method removeCustomUserAgent
removeCustomUserAgent: (userAgentData: string) => void;
method route53
route53: () => IRoute53Client;
method s3
s3: () => IS3Client;
method secretsManager
secretsManager: () => ISecretsManagerClient;
method ssm
ssm: () => ISSMClient;
method stepFunctions
stepFunctions: () => IStepFunctionsClient;
method validateCredentials
validateCredentials: () => Promise<void>;
Make sure the the current credentials are not expired
class SdkProvider
class SdkProvider {}
Creates instances of the AWS SDK appropriate for a given account/region.
Behavior is as follows:
- First, a set of "base" credentials are established - If a target environment is given and the default ("current") SDK credentials are for that account, return those; otherwise - If a target environment is given, scan all credential provider plugins for credentials, and return those if found; otherwise - Return default ("current") SDK credentials, noting that they might be wrong.
- Second, a role may optionally need to be assumed. Use the base credentials established in the previous process to assume that role. - If assuming the role fails and the base credentials are for the correct account, return those. This is a fallback for people who are trying to interact with a Default Synthesized stack and already have right credentials setup.
Typical cases we see in the wild: - Credential plugin setup that, although not recommended, works for them - Seeded terminal with
ReadOnly
credentials in order to docdk diff
--theReadOnly
role doesn't havests:AssumeRole
and will fail for no real good reason.
constructor
constructor( defaultCredentialProvider: AwsCredentialIdentityProvider, defaultRegion: string, requestHandler?: NodeHttpHandlerOptions, logger?: any);
property defaultRegion
readonly defaultRegion: string;
Default region
method baseCredentialsPartition
baseCredentialsPartition: ( environment: Environment, mode: Mode) => Promise<string | undefined>;
Return the partition that base credentials are for
Returns
undefined
if there are no base credentials.
method defaultAccount
defaultAccount: () => Promise<Account | undefined>;
The account we'd auth into if we used default credentials.
Default credentials are the set of ambiently configured credentials using one of the environment variables, or ~/.aws/credentials, or the *one* profile that was passed into the CLI.
Might return undefined if there are no default/ambient credentials available (in which case the user should better hope they have credential plugins configured).
Uses a cache to avoid STS calls if we don't need 'em.
method forEnvironment
forEnvironment: ( environment: Environment, mode: Mode, options?: CredentialsOptions, quiet?: boolean) => Promise<SdkForEnvironment>;
Return an SDK which can do operations in the given environment
The
environment
parameter is resolved first (seeresolveEnvironment()
).
method resolveEnvironment
resolveEnvironment: (env: Environment) => Promise<Environment>;
Resolve the environment for a stack
Replaces the magic values
UNKNOWN_REGION
andUNKNOWN_ACCOUNT
with the defaults for the current SDK configuration (~/.aws/config
or otherwise).It is an error if
UNKNOWN_ACCOUNT
is used but the user hasn't configured any SDK credentials.
method withAwsCliCompatibleDefaults
static withAwsCliCompatibleDefaults: ( options?: SdkProviderOptions) => Promise<SdkProvider>;
Create a new SdkProvider which gets its defaults in a way that behaves like the AWS CLI does
The AWS SDK for JS behaves slightly differently from the AWS CLI in a number of ways; see the class
AwsCliCompatible
for the details.
class SdkToCliLogger
class SdkToCliLogger implements Logger {}
constructor
constructor(ioHost: IIoHost);
method debug
debug: (..._content: any[]) => void;
method error
error: (...content: any[]) => void;
Error is called mostly (exclusively?) for failing API calls
Payload (input would be the entire API call arguments).
{clientName: 'STSClient',commandName: 'GetCallerIdentityCommand',input: {},error: AggregateError [ECONNREFUSED]:at internalConnectMultiple (node:net:1121:18)at afterConnectMultiple (node:net:1688:7) {code: 'ECONNREFUSED','$metadata': { attempts: 3, totalRetryDelay: 600 },[errors]: [ [Error], [Error] ]},metadata: { attempts: 3, totalRetryDelay: 600 }}
method info
info: (...content: any[]) => void;
Info is called mostly (exclusively?) for successful API calls
Payload:
(Note the input contains entire CFN templates, for example)
{clientName: 'S3Client',commandName: 'GetBucketLocationCommand',input: {Bucket: '.....',ExpectedBucketOwner: undefined},output: { LocationConstraint: 'eu-central-1' },metadata: {httpStatusCode: 200,requestId: '....',extendedRequestId: '...',cfId: undefined,attempts: 1,totalRetryDelay: 0}}
method trace
trace: (..._content: any[]) => void;
method warn
warn: (...content: any[]) => void;
class TemplateParameters
class TemplateParameters {}
The set of (formal) parameters that have been declared in a template
constructor
constructor(params: Record<string, TemplateParameter>);
method fromTemplate
static fromTemplate: (template: Template) => TemplateParameters;
method supplyAll
supplyAll: (updates: Record<string, string | undefined>) => ParameterValues;
Calculate stack parameters to pass from the given desired parameter values
Will throw if parameters without a Default value or a Previous value are not supplied.
method updateExisting
updateExisting: ( updates: Record<string, string | undefined>, previousValues: Record<string, string>) => ParameterValues;
From the template, the given desired values and the current values, calculate the changes to the stack parameters
Will take into account parameters already set on the template (will emit 'UsePreviousValue: true' for those unless the value is changed), and will throw if parameters without a Default value or a Previous value are not supplied.
class ToolkitInfo
abstract class ToolkitInfo {}
Information on the Bootstrap stack of the environment we're deploying to.
This class serves to:
- Inspect the bootstrap stack, and return various properties of it for successful asset deployment (in case of legacy-synthesized stacks). - Validate the version of the target environment, and nothing else (in case of default-synthesized stacks).
An object of this type might represent a bootstrap stack that could not be found. This is not an issue unless any members are used that require the bootstrap stack to have been found, in which case an error is thrown (default-synthesized stacks should never run into this as they don't need information from the bootstrap stack, all information is already encoded into the Cloud Assembly Manifest).
Nevertheless, an instance of this class exists to serve as a cache for SSM parameter lookups (otherwise, the "bootstrap stack version" parameter would need to be read repeatedly).
Called "ToolkitInfo" for historical reasons.
constructor
constructor();
property bootstrapStack
abstract readonly bootstrapStack: CloudFormationStack;
property bucketName
abstract readonly bucketName: string;
property bucketUrl
abstract readonly bucketUrl: string;
property found
abstract readonly found: boolean;
property repositoryName
abstract readonly repositoryName: string;
property stackName
abstract readonly stackName: string;
property variant
abstract readonly variant: string;
property version
abstract readonly version: number;
method bootstrapStackLookupError
static bootstrapStackLookupError: (stackName: string, e: Error) => ToolkitInfo;
method bootstrapStackNotFoundInfo
static bootstrapStackNotFoundInfo: (stackName: string) => ToolkitInfo;
method determineName
static determineName: (overrideName?: string) => string;
method fromStack
static fromStack: (stack: CloudFormationStack) => ToolkitInfo;
method lookup
static lookup: ( environment: cxapi.Environment, sdk: SDK, stackName: string | undefined) => Promise<ToolkitInfo>;
Interfaces
interface Account
interface Account {}
An AWS account
An AWS account always exists in only one partition. Usually we don't care about the partition, but when we need to form ARNs we do.
interface BootstrapEnvironmentOptions
interface BootstrapEnvironmentOptions {}
Options for the bootstrapEnvironment operation(s)
property execute
readonly execute?: boolean;
Whether to execute the changeset or only create it and leave it in review. true
property force
readonly force?: boolean;
property parameters
readonly parameters?: BootstrappingParameters;
property roleArn
readonly roleArn?: StringWithoutPlaceholders;
property source
readonly source?: BootstrapSource;
The source of the bootstrap stack
- modern v2-style bootstrapping
property tags
readonly tags?: Tag[];
Tags for cdktoolkit stack.
- None.
property terminationProtection
readonly terminationProtection?: boolean;
Whether the stacks created by the bootstrap process should be protected from termination.
See Also
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-protect-stacks.html true
property toolkitStackName
readonly toolkitStackName?: string;
property usePreviousParameters
usePreviousParameters?: boolean;
Use previous values for unspecified parameters
If not set, all parameters must be specified for every deployment.
true
interface BootstrappingParameters
interface BootstrappingParameters {}
Parameters for the bootstrapping template
property bucketName
readonly bucketName?: string;
The name to be given to the CDK Bootstrap bucket.
- a name is generated by CloudFormation.
property cloudFormationExecutionPolicies
readonly cloudFormationExecutionPolicies?: string[];
The ARNs of the IAM managed policies that should be attached to the role performing CloudFormation deployments. In most cases, this will be the AdministratorAccess policy. At least one policy is required if
trustedAccounts
were passed.- the role will have no policies attached
property createCustomerMasterKey
readonly createCustomerMasterKey?: boolean;
Whether or not to create a new customer master key (CMK)
Only applies to modern bootstrapping. Legacy bootstrapping will never create a CMK, only use the default S3 key.
false
property customPermissionsBoundary
readonly customPermissionsBoundary?: string;
Name for the customer's custom permissions boundary for bootstrapping
- No value, optional argument
property examplePermissionsBoundary
readonly examplePermissionsBoundary?: boolean;
Flag for using the default permissions boundary for bootstrapping
- No value, optional argument
property kmsKeyId
readonly kmsKeyId?: string;
The ID of an existing KMS key to be used for encrypting items in the bucket.
- use the default KMS key or create a custom one
property publicAccessBlockConfiguration
readonly publicAccessBlockConfiguration?: boolean;
Whether or not to enable S3 Staging Bucket Public Access Block Configuration
true
property qualifier
readonly qualifier?: string;
Identifier to distinguish multiple bootstrapped environments
- Default qualifier
property trustedAccounts
readonly trustedAccounts?: string[];
The list of AWS account IDs that are trusted to deploy into the environment being bootstrapped.
- only the bootstrapped account can deploy into this environment
property trustedAccountsForLookup
readonly trustedAccountsForLookup?: string[];
The list of AWS account IDs that are trusted to look up values in the environment being bootstrapped.
- only the bootstrapped account can look up values in this environment
property untrustedAccounts
readonly untrustedAccounts?: string[];
The list of AWS account IDs that should not be trusted by the bootstrapped environment. If these accounts are already trusted, they will be removed on bootstrapping.
- no account will be untrusted.
interface BuildStackAssetsOptions
interface BuildStackAssetsOptions extends AssetOptions {}
property buildOptions
readonly buildOptions?: BuildAssetsOptions;
Options to pass on to
buildAssets()
function
property stackName
readonly stackName?: string;
Stack name this asset is for
interface ChangeSetDeploymentMethod
interface ChangeSetDeploymentMethod {}
property changeSetName
readonly changeSetName?: string;
Optional name to use for the CloudFormation change set. If not provided, a name will be generated automatically.
property execute
readonly execute?: boolean;
Whether to execute the changeset or leave it in review.
true
property importExistingResources
readonly importExistingResources?: boolean;
Indicates if the change set imports resources that already exist.
false
property method
readonly method: 'change-set';
interface ConfigurationOptions
interface ConfigurationOptions {}
property computeChecksums
computeChecksums?: boolean;
property credentials
credentials: AwsCredentialIdentityProvider;
property customUserAgent
customUserAgent: string;
property logger
logger?: Logger;
property region
region: string;
property requestHandler
requestHandler: NodeHttpHandlerOptions;
property retryStrategy
retryStrategy: ConfiguredRetryStrategy;
property s3DisableBodySigning
s3DisableBodySigning?: boolean;
interface CredentialsOptions
interface CredentialsOptions {}
Options for obtaining credentials for an environment
property assumeRoleAdditionalOptions
readonly assumeRoleAdditionalOptions?: AssumeRoleAdditionalOptions;
Session tags required to assume the given role.
property assumeRoleArn
readonly assumeRoleArn?: string;
The ARN of the role that needs to be assumed, if any
property assumeRoleExternalId
readonly assumeRoleExternalId?: string;
External ID required to assume the given role.
interface DeploymentsProps
interface DeploymentsProps {}
property quiet
readonly quiet?: boolean;
property sdkProvider
sdkProvider: SdkProvider;
property toolkitStackName
readonly toolkitStackName?: string;
interface DeployStackOptions
interface DeployStackOptions {}
property assetParallelism
readonly assetParallelism?: boolean;
Whether to build/publish assets in parallel
true To remain backward compatible.
property changeSetName
readonly changeSetName?: string;
Optional name to use for the CloudFormation change set. If not provided, a name will be generated automatically.
Deprecated
Use 'deploymentMethod' instead
property ci
readonly ci?: boolean;
Whether we are on a CI system
false
property deploymentMethod
readonly deploymentMethod?: DeploymentMethod;
Select the deployment method (direct or using a change set)
- Change set with default options
property deployName
readonly deployName?: string;
Override name under which stack will be deployed
- Use artifact default
property execute
readonly execute?: boolean;
Stage the change set but don't execute it
- true
Deprecated
Use 'deploymentMethod' instead
property extraUserAgent
readonly extraUserAgent?: string;
The extra string to append to the User-Agent header when performing AWS SDK calls.
- nothing extra is appended to the User-Agent header
property force
readonly force?: boolean;
Force deployment, even if the deployed template is identical to the one we are about to deploy. false deployment will be skipped if the template is identical
property hotswap
readonly hotswap?: HotswapMode;
property hotswapPropertyOverrides
readonly hotswapPropertyOverrides?: HotswapPropertyOverrides;
Properties that configure hotswap behavior
property ignoreNoStacks
ignoreNoStacks?: boolean;
Whether to deploy if the app contains no stacks.
false
property notificationArns
readonly notificationArns?: string[];
Topic ARNs to send a message when deployment finishes (pass through to CloudFormation)
- No notifications
property overrideTemplate
readonly overrideTemplate?: any;
If present, use this given template instead of the stored one
- Use the stored template
property parameters
readonly parameters?: { [name: string]: string | undefined;};
Extra parameters for CloudFormation - no additional parameters will be passed to the template
property progress
readonly progress?: StackActivityProgress;
Display mode for stack deployment progress.
- StackActivityProgress.Bar - stack events will be displayed for the resource currently being deployed.
property quiet
readonly quiet?: boolean;
Don't show stack deployment events, just wait
false
property resourcesToImport
readonly resourcesToImport?: ResourcesToImport;
List of existing resources to be IMPORTED into the stack, instead of being CREATED
property reuseAssets
readonly reuseAssets?: string[];
List of asset IDs which should NOT be built or uploaded
- Build all assets
property roleArn
readonly roleArn?: string;
Execution role for the deployment (pass through to CloudFormation)
- Current role
property rollback
readonly rollback?: boolean;
Rollback failed deployments
true
property stack
readonly stack: cxapi.CloudFormationStackArtifact;
Stack to deploy
property tags
readonly tags?: Tag[];
Stack tags (pass through to CloudFormation)
property toolkitStackName
readonly toolkitStackName?: string;
Name of the toolkit stack, if not the default name
'CDKToolkit'
property usePreviousParameters
readonly usePreviousParameters?: boolean;
Use previous values for unspecified parameters
If not set, all parameters must be specified for every deployment.
true
interface DestroyStackOptions
interface DestroyStackOptions {}
interface DirectDeploymentMethod
interface DirectDeploymentMethod {}
property method
readonly method: 'direct';
interface EcrCredentials
interface EcrCredentials {}
interface EcrRepositoryInfo
interface EcrRepositoryInfo {}
property repositoryUri
repositoryUri: string;
interface IAppSyncClient
interface IAppSyncClient {}
method getSchemaCreationStatus
getSchemaCreationStatus: ( input: GetSchemaCreationStatusCommandInput) => Promise<GetSchemaCreationStatusCommandOutput>;
method listFunctions
listFunctions: ( input: ListFunctionsCommandInput) => Promise<FunctionConfiguration[]>;
method startSchemaCreation
startSchemaCreation: ( input: StartSchemaCreationCommandInput) => Promise<StartSchemaCreationCommandOutput>;
method updateApiKey
updateApiKey: ( input: UpdateApiKeyCommandInput) => Promise<UpdateApiKeyCommandOutput>;
method updateFunction
updateFunction: ( input: UpdateFunctionCommandInput) => Promise<UpdateFunctionCommandOutput>;
method updateResolver
updateResolver: ( input: UpdateResolverCommandInput) => Promise<UpdateResolverCommandOutput>;
interface ICloudFormationClient
interface ICloudFormationClient {}
method continueUpdateRollback
continueUpdateRollback: ( input: ContinueUpdateRollbackCommandInput) => Promise<ContinueUpdateRollbackCommandOutput>;
method createChangeSet
createChangeSet: ( input: CreateChangeSetCommandInput) => Promise<CreateChangeSetCommandOutput>;
method createGeneratedTemplate
createGeneratedTemplate: ( input: CreateGeneratedTemplateCommandInput) => Promise<CreateGeneratedTemplateCommandOutput>;
method createStack
createStack: ( input: CreateStackCommandInput) => Promise<CreateStackCommandOutput>;
method deleteChangeSet
deleteChangeSet: ( input: DeleteChangeSetCommandInput) => Promise<DeleteChangeSetCommandOutput>;
method deleteGeneratedTemplate
deleteGeneratedTemplate: ( input: DeleteGeneratedTemplateCommandInput) => Promise<DeleteGeneratedTemplateCommandOutput>;
method deleteStack
deleteStack: ( input: DeleteStackCommandInput) => Promise<DeleteStackCommandOutput>;
method describeChangeSet
describeChangeSet: ( input: DescribeChangeSetCommandInput) => Promise<DescribeChangeSetCommandOutput>;
method describeGeneratedTemplate
describeGeneratedTemplate: ( input: DescribeGeneratedTemplateCommandInput) => Promise<DescribeGeneratedTemplateCommandOutput>;
method describeResourceScan
describeResourceScan: ( input: DescribeResourceScanCommandInput) => Promise<DescribeResourceScanCommandOutput>;
method describeStackEvents
describeStackEvents: ( input: DescribeStackEventsCommandInput) => Promise<DescribeStackEventsCommandOutput>;
method describeStackResources
describeStackResources: ( input: DescribeStackResourcesCommandInput) => Promise<DescribeStackResourcesCommandOutput>;
method describeStacks
describeStacks: ( input: DescribeStacksCommandInput) => Promise<DescribeStacksCommandOutput>;
method executeChangeSet
executeChangeSet: ( input: ExecuteChangeSetCommandInput) => Promise<ExecuteChangeSetCommandOutput>;
method getGeneratedTemplate
getGeneratedTemplate: ( input: GetGeneratedTemplateCommandInput) => Promise<GetGeneratedTemplateCommandOutput>;
method getTemplate
getTemplate: ( input: GetTemplateCommandInput) => Promise<GetTemplateCommandOutput>;
method getTemplateSummary
getTemplateSummary: ( input: GetTemplateSummaryCommandInput) => Promise<GetTemplateSummaryCommandOutput>;
method listExports
listExports: ( input: ListExportsCommandInput) => Promise<ListExportsCommandOutput>;
method listResourceScanRelatedResources
listResourceScanRelatedResources: ( input: ListResourceScanRelatedResourcesCommandInput) => Promise<ListResourceScanRelatedResourcesCommandOutput>;
method listResourceScanResources
listResourceScanResources: ( input: ListResourceScanResourcesCommandInput) => Promise<ListResourceScanResourcesCommandOutput>;
method listResourceScans
listResourceScans: ( input?: ListResourceScansCommandInput) => Promise<ListResourceScansCommandOutput>;
method listStackResources
listStackResources: ( input: ListStackResourcesCommandInput) => Promise<StackResourceSummary[]>;
method listStacks
listStacks: (input: ListStacksCommandInput) => Promise<ListStacksCommandOutput>;
method rollbackStack
rollbackStack: ( input: RollbackStackCommandInput) => Promise<RollbackStackCommandOutput>;
method startResourceScan
startResourceScan: ( input: StartResourceScanCommandInput) => Promise<StartResourceScanCommandOutput>;
method updateStack
updateStack: ( input: UpdateStackCommandInput) => Promise<UpdateStackCommandOutput>;
method updateTerminationProtection
updateTerminationProtection: ( input: UpdateTerminationProtectionCommandInput) => Promise<UpdateTerminationProtectionCommandOutput>;
interface ICloudWatchLogsClient
interface ICloudWatchLogsClient {}
method describeLogGroups
describeLogGroups: ( input: DescribeLogGroupsCommandInput) => Promise<DescribeLogGroupsCommandOutput>;
method filterLogEvents
filterLogEvents: ( input: FilterLogEventsCommandInput) => Promise<FilterLogEventsCommandOutput>;
interface ICodeBuildClient
interface ICodeBuildClient {}
method updateProject
updateProject: ( input: UpdateProjectCommandInput) => Promise<UpdateProjectCommandOutput>;
interface IEC2Client
interface IEC2Client {}
method describeAvailabilityZones
describeAvailabilityZones: ( input: DescribeAvailabilityZonesCommandInput) => Promise<DescribeAvailabilityZonesCommandOutput>;
method describeImages
describeImages: ( input: DescribeImagesCommandInput) => Promise<DescribeImagesCommandOutput>;
method describeInstances
describeInstances: ( input: DescribeInstancesCommandInput) => Promise<DescribeInstancesCommandOutput>;
method describeRouteTables
describeRouteTables: ( input: DescribeRouteTablesCommandInput) => Promise<DescribeRouteTablesCommandOutput>;
method describeSecurityGroups
describeSecurityGroups: ( input: DescribeSecurityGroupsCommandInput) => Promise<DescribeSecurityGroupsCommandOutput>;
method describeSubnets
describeSubnets: ( input: DescribeSubnetsCommandInput) => Promise<DescribeSubnetsCommandOutput>;
method describeVpcEndpointServices
describeVpcEndpointServices: ( input: DescribeVpcEndpointServicesCommandInput) => Promise<DescribeVpcEndpointServicesCommandOutput>;
method describeVpcs
describeVpcs: ( input: DescribeVpcsCommandInput) => Promise<DescribeVpcsCommandOutput>;
method describeVpnGateways
describeVpnGateways: ( input: DescribeVpnGatewaysCommandInput) => Promise<DescribeVpnGatewaysCommandOutput>;
interface IECRClient
interface IECRClient {}
method batchDeleteImage
batchDeleteImage: ( input: BatchDeleteImageCommandInput) => Promise<BatchDeleteImageCommandOutput>;
method batchGetImage
batchGetImage: ( input: BatchGetImageCommandInput) => Promise<BatchGetImageCommandOutput>;
method createRepository
createRepository: ( input: CreateRepositoryCommandInput) => Promise<CreateRepositoryCommandOutput>;
method describeImages
describeImages: ( input: ECRDescribeImagesCommandInput) => Promise<ECRDescribeImagesCommandOutput>;
method describeRepositories
describeRepositories: ( input: DescribeRepositoriesCommandInput) => Promise<DescribeRepositoriesCommandOutput>;
method getAuthorizationToken
getAuthorizationToken: ( input: GetAuthorizationTokenCommandInput) => Promise<GetAuthorizationTokenCommandOutput>;
method listImages
listImages: (input: ListImagesCommandInput) => Promise<ListImagesCommandOutput>;
method putImage
putImage: (input: PutImageCommandInput) => Promise<PutImageCommandOutput>;
method putImageScanningConfiguration
putImageScanningConfiguration: ( input: PutImageScanningConfigurationCommandInput) => Promise<PutImageScanningConfigurationCommandOutput>;
interface IECSClient
interface IECSClient {}
method listClusters
listClusters: ( input: ListClustersCommandInput) => Promise<ListClustersCommandOutput>;
method registerTaskDefinition
registerTaskDefinition: ( input: RegisterTaskDefinitionCommandInput) => Promise<RegisterTaskDefinitionCommandOutput>;
method updateService
updateService: ( input: UpdateServiceCommandInput) => Promise<UpdateServiceCommandOutput>;
method waitUntilServicesStable
waitUntilServicesStable: ( input: DescribeServicesCommandInput) => Promise<WaiterResult>;
interface IElasticLoadBalancingV2Client
interface IElasticLoadBalancingV2Client {}
method describeListeners
describeListeners: ( input: DescribeListenersCommandInput) => Promise<DescribeListenersCommandOutput>;
method describeLoadBalancers
describeLoadBalancers: ( input: DescribeLoadBalancersCommandInput) => Promise<DescribeLoadBalancersCommandOutput>;
method describeTags
describeTags: ( input: DescribeTagsCommandInput) => Promise<DescribeTagsCommandOutput>;
method paginateDescribeListeners
paginateDescribeListeners: ( input: DescribeListenersCommandInput) => Promise<Listener[]>;
method paginateDescribeLoadBalancers
paginateDescribeLoadBalancers: ( input: DescribeLoadBalancersCommandInput) => Promise<LoadBalancer[]>;
interface IIAMClient
interface IIAMClient {}
method createPolicy
createPolicy: ( input: CreatePolicyCommandInput) => Promise<CreatePolicyCommandOutput>;
method getPolicy
getPolicy: (input: GetPolicyCommandInput) => Promise<GetPolicyCommandOutput>;
method getRole
getRole: (input: GetRoleCommandInput) => Promise<GetRoleCommandOutput>;
interface IKMSClient
interface IKMSClient {}
method describeKey
describeKey: ( input: DescribeKeyCommandInput) => Promise<DescribeKeyCommandOutput>;
method listAliases
listAliases: ( input: ListAliasesCommandInput) => Promise<ListAliasesCommandOutput>;
interface ILambdaClient
interface ILambdaClient {}
method invokeCommand
invokeCommand: (input: InvokeCommandInput) => Promise<InvokeCommandOutput>;
method publishVersion
publishVersion: ( input: PublishVersionCommandInput) => Promise<PublishVersionCommandOutput>;
method updateAlias
updateAlias: ( input: UpdateAliasCommandInput) => Promise<UpdateAliasCommandOutput>;
method updateFunctionCode
updateFunctionCode: ( input: UpdateFunctionCodeCommandInput) => Promise<UpdateFunctionCodeCommandOutput>;
method updateFunctionConfiguration
updateFunctionConfiguration: ( input: UpdateFunctionConfigurationCommandInput) => Promise<UpdateFunctionConfigurationCommandOutput>;
method waitUntilFunctionUpdated
waitUntilFunctionUpdated: ( delaySeconds: number, input: UpdateFunctionConfigurationCommandInput) => Promise<WaiterResult>;
interface IRoute53Client
interface IRoute53Client {}
method getHostedZone
getHostedZone: ( input: GetHostedZoneCommandInput) => Promise<GetHostedZoneCommandOutput>;
method listHostedZones
listHostedZones: ( input: ListHostedZonesCommandInput) => Promise<ListHostedZonesCommandOutput>;
method listHostedZonesByName
listHostedZonesByName: ( input: ListHostedZonesByNameCommandInput) => Promise<ListHostedZonesByNameCommandOutput>;
interface IS3Client
interface IS3Client {}
method deleteObjects
deleteObjects: ( input: DeleteObjectsCommandInput) => Promise<DeleteObjectsCommandOutput>;
method deleteObjectTagging
deleteObjectTagging: ( input: DeleteObjectTaggingCommandInput) => Promise<DeleteObjectTaggingCommandOutput>;
method getBucketEncryption
getBucketEncryption: ( input: GetBucketEncryptionCommandInput) => Promise<GetBucketEncryptionCommandOutput>;
method getBucketLocation
getBucketLocation: ( input: GetBucketLocationCommandInput) => Promise<GetBucketLocationCommandOutput>;
method getObject
getObject: (input: GetObjectCommandInput) => Promise<GetObjectCommandOutput>;
method getObjectTagging
getObjectTagging: ( input: GetObjectTaggingCommandInput) => Promise<GetObjectTaggingCommandOutput>;
method listObjectsV2
listObjectsV2: ( input: ListObjectsV2CommandInput) => Promise<ListObjectsV2CommandOutput>;
method putObjectTagging
putObjectTagging: ( input: PutObjectTaggingCommandInput) => Promise<PutObjectTaggingCommandOutput>;
method upload
upload: ( input: PutObjectCommandInput) => Promise<CompleteMultipartUploadCommandOutput>;
interface ISecretsManagerClient
interface ISecretsManagerClient {}
method getSecretValue
getSecretValue: ( input: GetSecretValueCommandInput) => Promise<GetSecretValueCommandOutput>;
interface ISSMClient
interface ISSMClient {}
method getParameter
getParameter: ( input: GetParameterCommandInput) => Promise<GetParameterCommandOutput>;
interface IStepFunctionsClient
interface IStepFunctionsClient {}
method updateStateMachine
updateStateMachine: ( input: UpdateStateMachineCommandInput) => Promise<UpdateStateMachineCommandOutput>;
interface NeedRollbackFirstDeployStackResult
interface NeedRollbackFirstDeployStackResult {}
The stack is currently in a failpaused state, and needs to be rolled back before the deployment
interface NestedStackTemplates
interface NestedStackTemplates {}
property deployedTemplate
readonly deployedTemplate: Template;
property generatedTemplate
readonly generatedTemplate: Template;
property nestedStackTemplates
readonly nestedStackTemplates: { [nestedStackLogicalId: string]: NestedStackTemplates;};
property physicalName
readonly physicalName: string | undefined;
interface ReplacementRequiresRollbackStackResult
interface ReplacementRequiresRollbackStackResult {}
The upcoming change has a replacement, which requires deploying with --rollback
property type
readonly type: 'replacement-requires-rollback';
interface RollbackStackOptions
interface RollbackStackOptions {}
property ci
readonly ci?: boolean;
Whether we are on a CI system
false
property force
readonly force?: boolean;
Whether to force a rollback or not
Forcing a rollback will orphan all undeletable resources.
false
property orphanLogicalIds
readonly orphanLogicalIds?: string[];
Orphan the resources with the given logical IDs
- No orphaning
property progress
readonly progress?: StackActivityProgress;
Display mode for stack deployment progress.
- StackActivityProgress.Bar - stack events will be displayed for the resource currently being deployed.
property quiet
readonly quiet?: boolean;
Don't show stack deployment events, just wait
false
property roleArn
readonly roleArn?: string;
Execution role for the deployment (pass through to CloudFormation)
- Current role
property stack
readonly stack: cxapi.CloudFormationStackArtifact;
Stack to roll back
property toolkitStackName
readonly toolkitStackName?: string;
Name of the toolkit stack, if not the default name
'CDKToolkit'
property validateBootstrapStackVersion
readonly validateBootstrapStackVersion?: boolean;
Whether to validate the version of the bootstrap stack permissions
true
interface RollbackStackResult
interface RollbackStackResult {}
property notInRollbackableState
readonly notInRollbackableState?: boolean;
property success
readonly success?: boolean;
interface RootTemplateWithNestedStacks
interface RootTemplateWithNestedStacks {}
property deployedRootTemplate
readonly deployedRootTemplate: Template;
property nestedStacks
readonly nestedStacks: { [nestedStackLogicalId: string]: NestedStackTemplates;};
interface S3ClientOptions
interface S3ClientOptions {}
property needsMd5Checksums
needsMd5Checksums?: boolean;
If APIs are used that require MD5 checksums.
Some S3 APIs in SDKv2 have a bug that always requires them to use a MD5 checksum. These APIs are not going to be supported in a FIPS environment.
interface SdkForEnvironment
interface SdkForEnvironment {}
SDK configuration for a given environment 'forEnvironment' will attempt to assume a role and if it is not successful, then it will either: 1. Check to see if the default credentials (local credentials the CLI was executed with) are for the given environment. If they are then return those. 2. If the default credentials are not for the given environment then throw an error
'didAssumeRole' allows callers to whether they are receiving the assume role credentials or the default credentials.
property didAssumeRole
readonly didAssumeRole: boolean;
Whether or not the assume role was successful. If the assume role was not successful (false) then that means that the 'sdk' returned contains the default credentials (not the assume role credentials)
property sdk
readonly sdk: SDK;
The SDK for the given environment
interface SdkHttpOptions
interface SdkHttpOptions {}
Options for individual SDKs
property caBundlePath
readonly caBundlePath?: string;
A path to a certificate bundle that contains a cert to be trusted.
No certificate bundle
property proxyAddress
readonly proxyAddress?: string;
Proxy address to use
No proxy
interface SdkOptions
interface SdkOptions {}
Additional SDK configuration options
property assumeRoleCredentialsSourceDescription
readonly assumeRoleCredentialsSourceDescription?: string;
Additional descriptive strings that indicate where the "AssumeRole" credentials are coming from
Will be printed in an error message to help users diagnose auth problems.
interface SdkProviderOptions
interface SdkProviderOptions {}
Options for the default SDK provider
property httpOptions
readonly httpOptions?: SdkHttpOptions;
HTTP options for SDK
property logger
readonly logger?: Logger;
The logger for sdk calls.
property profile
readonly profile?: string;
Profile to read from ~/.aws
- No profile
interface StackExistsOptions
interface StackExistsOptions {}
property deployName
deployName?: string;
property stack
stack: cxapi.CloudFormationStackArtifact;
property tryLookupRole
tryLookupRole?: boolean;
interface SuccessfulDeployStackResult
interface SuccessfulDeployStackResult {}
Successfully deployed a stack
Type Aliases
type AssumeRoleAdditionalOptions
type AssumeRoleAdditionalOptions = Partial< Omit<AssumeRoleCommandInput, 'ExternalId' | 'RoleArn'>>;
type BootstrapSource
type BootstrapSource = | { source: 'legacy'; } | { source: 'default'; } | { source: 'custom'; templateFile: string; };
type CreateChangeSetOptions
type CreateChangeSetOptions = { cfn: ICloudFormationClient; changeSetName: string; willExecute: boolean; exists: boolean; uuid: string; stack: cxapi.CloudFormationStackArtifact; bodyParameter: TemplateBodyParameter; parameters: { [name: string]: string | undefined; }; resourcesToImport?: ResourceToImport[]; role?: string;};
type DeploymentMethod
type DeploymentMethod = DirectDeploymentMethod | ChangeSetDeploymentMethod;
type DeployStackResult
type DeployStackResult = | SuccessfulDeployStackResult | NeedRollbackFirstDeployStackResult | ReplacementRequiresRollbackStackResult;
type GcAsset
type GcAsset = ImageAsset | ObjectAsset;
type ParameterChanges
type ParameterChanges = boolean | 'ssm';
type PrepareChangeSetOptions
type PrepareChangeSetOptions = { stack: cxapi.CloudFormationStackArtifact; deployments: Deployments; uuid: string; willExecute: boolean; sdkProvider: SdkProvider; stream: NodeJS.WritableStream; parameters: { [name: string]: string | undefined; }; resourcesToImport?: ResourcesToImport;};
type ResourceIdentifierProperties
type ResourceIdentifierProperties = Record<string, string>;
type ResourceIdentifierSummaries
type ResourceIdentifierSummaries = ResourceIdentifierSummary[];
type ResourcesToImport
type ResourcesToImport = ResourceToImport[];
type Template
type Template = { Parameters?: Record<string, TemplateParameter>; [key: string]: any;};
Namespaces
namespace legacy
module 'lib/legacy-exports-source.d.ts' {}
variable aliases
const aliases: string[];
variable CI
let CI: boolean;
variable command
const command: string;
variable describe
const describe: string;
variable logLevel
let logLevel: LogLevel;
variable PROJECT_CONTEXT
const PROJECT_CONTEXT: string;
function availableInitTemplates
availableInitTemplates: () => Promise<InitTemplate[]>;
function cached
cached: <A extends object, B>(obj: A, sym: symbol, fn: () => B) => B;
Cache the result of a function on an object
We could have used to make this nicer but we don't use them anywhere yet, so let's keep it simple and readable.
function cli
cli: (args?: string[]) => void;
function contentHash
contentHash: (data: string | Buffer | DataView) => string;
function data
data: (fmt: string, ...args: unknown[]) => void;
function debug
debug: (fmt: string, ...args: unknown[]) => false | void;
function deepClone
deepClone: (x: any) => any;
Deep clone a tree of objects, lists or scalars
Does not support cycles.
function deepMerge
deepMerge: (...objects: Array<Obj<any> | undefined>) => Obj<any>;
Recursively merge objects together
The leftmost object is mutated and returned. Arrays are not merged but overwritten just like scalars.
If an object is merged into a non-object, the non-object is lost.
function deployStack
deployStack: (options: DeployStackOptions) => Promise<DeployStackResult>;
function enableTracing
enableTracing: (enabled: boolean) => void;
function error
error: (fmt: string, ...args: unknown[]) => void;
function exec
exec: (args: string[], synthesizer?: Synthesizer) => Promise<number | void>;
function execProgram
execProgram: ( aws: SdkProvider, config: Configuration) => Promise<ExecProgramResult>;
Invokes the cloud executable and returns JSON output
function flatten
flatten: <T>(xs: T[][]) => T[];
Flatten a list of lists into a list of elements
function formatAsBanner
formatAsBanner: (msgs: string[]) => string[];
Returns a set of strings when printed on the console produces a banner msg. The message is in the following format - ******************** *** msg line x *** *** msg line xyz *** ********************
Spec: - The width of every line is equal, dictated by the longest message string - The first and last lines are '*'s for the full length of the line - Each line in between is prepended with '*** ' and appended with ' ***' - The text is indented left, i.e. whitespace is right-padded when the length is shorter than the longest.
Parameter msgs
array of strings containing the message lines to be printed in the banner. Returns empty string if array is empty.
Returns
array of strings containing the message formatted as a banner
function highlight
highlight: (fmt: string, ...args: unknown[]) => void;
function ifDefined
ifDefined: <T>(x: T | undefined, def: T) => T;
Return the value of the first argument if it's not undefined, otherwise the default
function increaseVerbosity
increaseVerbosity: () => void;
function isArray
isArray: (arg: any) => arg is any[];
Return whether the given value is an array
function isEmpty
isEmpty: (x: any) => boolean;
Return whether the given parameter is an empty object or empty list.
function latestVersionIfHigher
latestVersionIfHigher: ( currentVersion: string, cacheFile: VersionCheckTTL) => Promise<string | null>;
function leftPad
leftPad: (s: string, n: number, char: string) => string;
Pad 's' on the left with 'char' until it is n characters wide
function lowerCaseFirstCharacter
lowerCaseFirstCharacter: (str: string) => string;
This function lower cases the first character of the string provided.
function numberFromBool
numberFromBool: (bool: boolean) => number;
Converts a boolean into a number.
Parameter bool
input boolean
Returns
1 if bool is true, and 0 if false
function partition
partition: <T>(collection: T[], pred: (x: T) => boolean) => T[];
Partition a collection by removing and returning all elements that match a predicate
Note: the input collection is modified in-place!
function prefix
prefix: (prefixString: string, fn: LoggerFunction) => LoggerFunction;
Create a logger output that features a constant prefix string.
Parameter prefixString
the prefix string to be appended before any log entry.
Parameter fn
the logger function to be used (typically one of the other functions in this module)
Returns
a new LoggerFunction.
function print
print: (fmt: string, ...args: unknown[]) => void;
function rootDir
rootDir: { (): string; (fail: true): string; (fail: false): string };
From the current file, find the directory that contains the CLI's package.json
Can't use
__dirname
in production code, as the CLI will get bundled as it's released and__dirname
will refer to a different location in the.ts
form as it will in the final executing form.
function setCI
setCI: (newCI: boolean) => void;
function setLogLevel
setLogLevel: (newLogLevel: LogLevel) => void;
function success
success: (fmt: string, ...args: unknown[]) => void;
function trace
trace: (fmt: string, ...args: unknown[]) => false | void;
function versionNumber
versionNumber: () => string;
function warning
warning: (fmt: string, ...args: unknown[]) => void;
function withCorkedLogging
withCorkedLogging: <A>(block: () => Promise<A>) => Promise<A>;
class AwsCliCompatible
class AwsCliCompatible {}
Behaviors to match AWS CLI
See these links:
https://docs.aws.amazon.com/cli/latest/topic/config-vars.html https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-envvars.html
method credentialChainBuilder
static credentialChainBuilder: ( options?: CredentialChainOptions) => Promise<AwsCredentialIdentityProvider>;
Build an AWS CLI-compatible credential chain provider
The credential chain returned by this function is always caching.
method proxyAgent
static proxyAgent: (options: SdkHttpOptions) => ProxyAgent;
method region
static region: (maybeProfile?: string) => Promise<string>;
Attempts to get the region from a number of sources and falls back to us-east-1 if no region can be found, as is done in the AWS CLI.
The order of priority is the following:
1. Environment variables specifying region, with both an AWS prefix and AMAZON prefix to maintain backwards compatibility, and without
DEFAULT
in the name because Lambda and CodeBuild set the $AWS_REGION variable. 2. Regions listed in the Shared Ini Files - First checking for the profile provided and then checking for the default profile. 3. IMDS instance identity region from the Metadata Service. 4. us-east-1
method requestHandlerBuilder
static requestHandlerBuilder: ( options?: SdkHttpOptions) => NodeHttpHandlerOptions;
class Bootstrapper
class Bootstrapper {}
constructor
constructor(source?: BootstrapSource);
method bootstrapEnvironment
bootstrapEnvironment: ( environment: cxapi.Environment, sdkProvider: SdkProvider, options?: BootstrapEnvironmentOptions) => Promise<SuccessfulDeployStackResult>;
method showTemplate
showTemplate: (json: boolean) => Promise<void>;
class CfnEvaluationException
class CfnEvaluationException extends Error {}
class CloudExecutable
class CloudExecutable {}
Represent the Cloud Executable and the synthesis we can do on it
constructor
constructor(props: CloudExecutableProps);
property hasApp
readonly hasApp: boolean;
Return whether there is an app command from the configuration
method synthesize
synthesize: (cacheCloudAssembly?: boolean) => Promise<CloudAssembly>;
Synthesize a set of stacks.
Parameter cacheCloudAssembly
whether to cache the Cloud Assembly after it has been first synthesized. This is 'true' by default, and only set to 'false' for 'cdk watch', which needs to re-synthesize the Assembly each time it detects a change to the project files
class Configuration
class Configuration {}
All sources of settings combined
constructor
constructor(props?: ConfigurationProps);
property context
context: Context;
property defaultConfig
readonly defaultConfig: Settings;
property projectContext
readonly projectContext: Settings;
property settings
settings: Settings;
method load
load: () => Promise<this>;
Load all config
method saveContext
saveContext: () => Promise<this>;
Save the project context
class CredentialPlugins
class CredentialPlugins {}
Cache for credential providers.
Given an account and an operating mode (read or write) will return an appropriate credential provider for credentials for the given account. The credential provider will be cached so that multiple AWS clients for the same environment will not make multiple network calls to obtain credentials.
Will use default credentials if they are for the right account; otherwise, all loaded credential provider plugins will be tried to obtain credentials for the given account.
constructor
constructor(host?: PluginHost);
property availablePluginNames
readonly availablePluginNames: string[];
method fetchCredentialsFor
fetchCredentialsFor: ( awsAccountId: string, mode: Mode) => Promise<PluginCredentialsFetchResult | undefined>;
class Deployments
class Deployments {}
Scope for a single set of deployments from a set of Cloud Assembly Artifacts
Manages lookup of SDKs, Bootstrap stacks, etc.
constructor
constructor(props: DeploymentsProps);
property envs
readonly envs: EnvironmentAccess;
method buildAssets
buildAssets: ( asset: cxapi.AssetManifestArtifact, options: BuildStackAssetsOptions) => Promise<void>;
Build all assets in a manifest
Deprecated
Use
buildSingleAsset
instead
method buildSingleAsset
buildSingleAsset: ( assetArtifact: cxapi.AssetManifestArtifact | 'no-version-validation', assetManifest: cdk_assets.AssetManifest, asset: cdk_assets.IManifestEntry, options: BuildStackAssetsOptions) => Promise<void>;
Build a single asset from an asset manifest
If an assert manifest artifact is given, the bootstrap stack version will be validated according to the constraints in that manifest artifact. If that is not necessary,
'no-version-validation'
can be passed.
method deployStack
deployStack: (options: DeployStackOptions) => Promise<DeployStackResult>;
method destroyStack
destroyStack: (options: DestroyStackOptions) => Promise<void>;
method isSingleAssetPublished
isSingleAssetPublished: ( assetManifest: cdk_assets.AssetManifest, asset: cdk_assets.IManifestEntry, options: PublishStackAssetsOptions) => Promise<boolean>;
Return whether a single asset has been published already
method publishAssets
publishAssets: ( asset: cxapi.AssetManifestArtifact, options: PublishStackAssetsOptions) => Promise<void>;
Publish all assets in a manifest
Deprecated
Use
publishSingleAsset
instead
method publishSingleAsset
publishSingleAsset: ( assetManifest: cdk_assets.AssetManifest, asset: cdk_assets.IManifestEntry, options: PublishStackAssetsOptions) => Promise<void>;
Publish a single asset from an asset manifest
method readCurrentTemplate
readCurrentTemplate: ( stackArtifact: cxapi.CloudFormationStackArtifact) => Promise<Template>;
method readCurrentTemplateWithNestedStacks
readCurrentTemplateWithNestedStacks: ( rootStackArtifact: cxapi.CloudFormationStackArtifact, retrieveProcessedTemplate?: boolean) => Promise<RootTemplateWithNestedStacks>;
method resolveEnvironment
resolveEnvironment: ( stack: cxapi.CloudFormationStackArtifact) => Promise<cxapi.Environment>;
Resolves the environment for a stack.
method resourceIdentifierSummaries
resourceIdentifierSummaries: ( stackArtifact: cxapi.CloudFormationStackArtifact) => Promise<ResourceIdentifierSummaries>;
method rollbackStack
rollbackStack: (options: RollbackStackOptions) => Promise<RollbackStackResult>;
method stackExists
stackExists: (options: StackExistsOptions) => Promise<boolean>;
class PluginHost
class PluginHost implements IPluginHost {}
A utility to manage plug-ins.
constructor
constructor();
property contextProviderPlugins
readonly contextProviderPlugins: Record<string, ContextProviderPlugin>;
property credentialProviderSources
readonly credentialProviderSources: CredentialProviderSource[];
Access the currently registered CredentialProviderSources. New sources can be registered using the +registerCredentialProviderSource+ method.
property instance
static instance: PluginHost;
method load
load: (moduleSpec: string) => void;
Loads a plug-in into this PluginHost.
Parameter moduleSpec
the specification (path or name) of the plug-in module to be loaded.
method registerContextProviderAlpha
registerContextProviderAlpha: ( pluginProviderName: string, provider: ContextProviderPlugin) => void;
(EXPERIMENTAL) Allow plugins to register context providers
Context providers are objects with the following method:
getValue(args: {[key: string]: any}): Promise<any>;Currently, they cannot reuse the CDK's authentication mechanisms, so they must be prepared to either not make AWS calls or use their own source of AWS credentials.
This feature is experimental, and only intended to be used internally at Amazon as a trial.
After registering with 'my-plugin-name', the provider must be addressed as follows:
const value = ContextProvider.getValue(this, {providerName: 'plugin',props: {pluginName: 'my-plugin-name',myParameter1: 'xyz',},includeEnvironment: true | false,dummyValue: 'what-to-return-on-the-first-pass',})Modifiers
@experimental
method registerCredentialProviderSource
registerCredentialProviderSource: (source: CredentialProviderSource) => void;
Allows plug-ins to register new CredentialProviderSources.
Parameter source
a new CredentialProviderSource to register.
class SdkProvider
class SdkProvider {}
Creates instances of the AWS SDK appropriate for a given account/region.
Behavior is as follows:
- First, a set of "base" credentials are established - If a target environment is given and the default ("current") SDK credentials are for that account, return those; otherwise - If a target environment is given, scan all credential provider plugins for credentials, and return those if found; otherwise - Return default ("current") SDK credentials, noting that they might be wrong.
- Second, a role may optionally need to be assumed. Use the base credentials established in the previous process to assume that role. - If assuming the role fails and the base credentials are for the correct account, return those. This is a fallback for people who are trying to interact with a Default Synthesized stack and already have right credentials setup.
Typical cases we see in the wild: - Credential plugin setup that, although not recommended, works for them - Seeded terminal with
ReadOnly
credentials in order to docdk diff
--theReadOnly
role doesn't havests:AssumeRole
and will fail for no real good reason.
constructor
constructor( defaultCredentialProvider: AwsCredentialIdentityProvider, defaultRegion: string, requestHandler?: NodeHttpHandlerOptions, logger?: any);
property defaultRegion
readonly defaultRegion: string;
Default region
method baseCredentialsPartition
baseCredentialsPartition: ( environment: Environment, mode: Mode) => Promise<string | undefined>;
Return the partition that base credentials are for
Returns
undefined
if there are no base credentials.
method defaultAccount
defaultAccount: () => Promise<Account | undefined>;
The account we'd auth into if we used default credentials.
Default credentials are the set of ambiently configured credentials using one of the environment variables, or ~/.aws/credentials, or the *one* profile that was passed into the CLI.
Might return undefined if there are no default/ambient credentials available (in which case the user should better hope they have credential plugins configured).
Uses a cache to avoid STS calls if we don't need 'em.
method forEnvironment
forEnvironment: ( environment: Environment, mode: Mode, options?: CredentialsOptions, quiet?: boolean) => Promise<SdkForEnvironment>;
Return an SDK which can do operations in the given environment
The
environment
parameter is resolved first (seeresolveEnvironment()
).
method resolveEnvironment
resolveEnvironment: (env: Environment) => Promise<Environment>;
Resolve the environment for a stack
Replaces the magic values
UNKNOWN_REGION
andUNKNOWN_ACCOUNT
with the defaults for the current SDK configuration (~/.aws/config
or otherwise).It is an error if
UNKNOWN_ACCOUNT
is used but the user hasn't configured any SDK credentials.
method withAwsCliCompatibleDefaults
static withAwsCliCompatibleDefaults: ( options?: SdkProviderOptions) => Promise<SdkProvider>;
Create a new SdkProvider which gets its defaults in a way that behaves like the AWS CLI does
The AWS SDK for JS behaves slightly differently from the AWS CLI in a number of ways; see the class
AwsCliCompatible
for the details.
class Settings
class Settings {}
A single bag of settings
constructor
constructor(settings?: SettingsMap, readOnly?: boolean);
property all
readonly all: any;
property empty
readonly empty: boolean;
property readOnly
readonly readOnly: boolean;
method clear
clear: () => void;
method get
get: (path: string[]) => any;
method load
load: (fileName: string) => Promise<this>;
method makeReadOnly
makeReadOnly: () => Settings;
method merge
merge: (other: Settings) => Settings;
method mergeAll
static mergeAll: (...settings: Settings[]) => Settings;
method save
save: (fileName: string) => Promise<this>;
method set
set: (path: string[], value: any) => Settings;
method subSettings
subSettings: (keyPrefix: string[]) => Settings;
method unset
unset: (path: string[]) => void;
enum Command
enum Command { LS = 'ls', LIST = 'list', DIFF = 'diff', BOOTSTRAP = 'bootstrap', DEPLOY = 'deploy', DESTROY = 'destroy', SYNTHESIZE = 'synthesize', SYNTH = 'synth', METADATA = 'metadata', INIT = 'init', VERSION = 'version', WATCH = 'watch', GC = 'gc', ROLLBACK = 'rollback', IMPORT = 'import', ACKNOWLEDGE = 'acknowledge', ACK = 'ack', NOTICES = 'notices', MIGRATE = 'migrate', CONTEXT = 'context', DOCS = 'docs', DOC = 'doc', DOCTOR = 'doctor',}
member ACK
ACK = 'ack'
member ACKNOWLEDGE
ACKNOWLEDGE = 'acknowledge'
member BOOTSTRAP
BOOTSTRAP = 'bootstrap'
member CONTEXT
CONTEXT = 'context'
member DEPLOY
DEPLOY = 'deploy'
member DESTROY
DESTROY = 'destroy'
member DIFF
DIFF = 'diff'
member DOC
DOC = 'doc'
member DOCS
DOCS = 'docs'
member DOCTOR
DOCTOR = 'doctor'
member GC
GC = 'gc'
member IMPORT
IMPORT = 'import'
member INIT
INIT = 'init'
member LIST
LIST = 'list'
member LS
LS = 'ls'
member METADATA
METADATA = 'metadata'
member MIGRATE
MIGRATE = 'migrate'
member NOTICES
NOTICES = 'notices'
member ROLLBACK
ROLLBACK = 'rollback'
member SYNTH
SYNTH = 'synth'
member SYNTHESIZE
SYNTHESIZE = 'synthesize'
member VERSION
VERSION = 'version'
member WATCH
WATCH = 'watch'
enum LogLevel
enum LogLevel { DEFAULT = 0, DEBUG = 1, TRACE = 2,}
enum RequireApproval
enum RequireApproval { Never = 'never', AnyChange = 'any-change', Broadening = 'broadening',}
member AnyChange
AnyChange = 'any-change'
member Broadening
Broadening = 'broadening'
member Never
Never = 'never'
type LoggerFunction
type LoggerFunction = (fmt: string,