class CloudAssembly
| Language | Type name |
|---|---|
.NET | Amazon.CDK.CXAPI.CloudAssembly |
Go | github.com/aws/aws-cdk-go/awscdk/v2/cxapi#CloudAssembly |
Java | software.amazon.awscdk.cxapi.CloudAssembly |
Python | aws_cdk.cx_api.CloudAssembly |
TypeScript (source) | aws-cdk-lib » cx_api » CloudAssembly |
Implements
ICloud
Represents a deployable cloud application.
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { cx_api } from 'aws-cdk-lib';
const cloudAssembly = new cx_api.CloudAssembly('directory', /* all optional props */ {
skipEnumCheck: false,
skipVersionCheck: false,
topoSort: false,
});
Initializer
new CloudAssembly(directory: string, loadOptions?: LoadManifestOptions)
Parameters
- directory
string— The root directory of the assembly. - loadOptions
LoadManifest Options
Reads a cloud assembly from the specified directory.
Properties
| Name | Type | Description |
|---|---|---|
| artifacts | Cloud[] | All artifacts included in this assembly. |
| directory | string | The root directory of the cloud assembly. |
| manifest | Assembly | The raw assembly manifest. |
| nested | Nested[] | The nested assembly artifacts in this assembly. |
| runtime | Runtime | Runtime information such as module versions used to synthesize this assembly. |
| stacks | Cloud[] | |
| stacks | Cloud[] | Returns all the stacks, including the ones in nested assemblies. |
| version | string | The schema version of the assembly manifest. |
artifacts
Type:
Cloud[]
All artifacts included in this assembly.
directory
Type:
string
The root directory of the cloud assembly.
manifest
Type:
Assembly
The raw assembly manifest.
nestedAssemblies
Type:
Nested[]
The nested assembly artifacts in this assembly.
runtime
Type:
Runtime
Runtime information such as module versions used to synthesize this assembly.
stacks
Type:
Cloud[]
stacksRecursively
Type:
Cloud[]
Returns all the stacks, including the ones in nested assemblies.
version
Type:
string
The schema version of the assembly manifest.
Methods
| Name | Description |
|---|---|
| get | Returns a nested assembly. |
| get | Returns a nested assembly artifact. |
| get | Returns a CloudFormation stack artifact from this assembly. |
| get | Returns a CloudFormation stack artifact from this assembly. |
| tree() | Returns the tree metadata artifact from this assembly. |
| try | Attempts to find an artifact with a specific identity. |
| static cleanup | Cleans up any temporary assembly directories that got created in this process. |
| static is | Return whether the given object is a CloudAssembly. |
getNestedAssembly(artifactId)
public getNestedAssembly(artifactId: string): CloudAssembly
Parameters
- artifactId
string— The artifact ID of the nested assembly.
Returns
Returns a nested assembly.
getNestedAssemblyArtifact(artifactId)
public getNestedAssemblyArtifact(artifactId: string): NestedCloudAssemblyArtifact
Parameters
- artifactId
string— The artifact ID of the nested assembly.
Returns
Returns a nested assembly artifact.
getStackArtifact(artifactId)
public getStackArtifact(artifactId: string): CloudFormationStackArtifact
Parameters
- artifactId
string— the artifact id of the stack (can be obtained throughstack.artifactId).
Returns
Returns a CloudFormation stack artifact from this assembly.
getStackByName(stackName)
public getStackByName(stackName: string): CloudFormationStackArtifact
Parameters
- stackName
string— the name of the CloudFormation stack.
Returns
Returns a CloudFormation stack artifact from this assembly.
Will only search the current assembly.
tree()
public tree(): TreeCloudArtifact
Returns
Returns the tree metadata artifact from this assembly.
tryGetArtifact(id)
public tryGetArtifact(id: string): CloudArtifact
Parameters
- id
string— The artifact ID.
Returns
Attempts to find an artifact with a specific identity.
static cleanupTemporaryDirectories()
public static cleanupTemporaryDirectories(): void
Cleans up any temporary assembly directories that got created in this process.
If a Cloud Assembly is emitted to a temporary directory, its directory gets added to a list. This function iterates over that list and deletes each directory in it, to free up disk space.
This function will normally be called automatically during Node process
exit and so you don't need to call this. However, some test environments do
not properly trigger Node's exit event. Notably: Jest does not trigger
the exit event (https://github.com/jestjs/jest/issues/10927).
Cleaning up temporary directories in jest
For Jest, you have to make sure this function is called at the end of the test suite instead:
import { CloudAssembly } from 'aws-cdk-lib/cx-api';
afterAll(CloudAssembly.cleanupTemporaryDirectories);
Alternatively, you can use the setupFilesAfterEnv feature and use a
provided helper script to automatically inject the above into every
test file, so you don't have to do it by hand.
$ npx jest --setupFilesAfterEnv aws-cdk-lib/testhelpers/jest-autoclean
Or put the following into jest.config.js:
module.exports = {
// ...
setupFilesAfterEnv: ['aws-cdk-lib/testhelpers/jest-cleanup'],
};
static isCloudAssembly(x)
public static isCloudAssembly(x: any): boolean
Parameters
- x
any
Returns
boolean
Return whether the given object is a CloudAssembly.
We do attribute detection since we can't reliably use 'instanceof'.

.NET
Go
Java
Python
TypeScript (