Skip to content
v2.275.0

CloudAssembly Class ​

Represents a deployable cloud application.

Example ​

ts
// 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,
  validateSchema: false,
});
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import cx_api

cloud_assembly = cx_api.CloudAssembly("directory",
    skip_enum_check=False,
    skip_version_check=False,
    topo_sort=False,
    validate_schema=False
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.cxapi.*;

CloudAssembly cloudAssembly = CloudAssembly.Builder.create("directory")
        .skipEnumCheck(false)
        .skipVersionCheck(false)
        .topoSort(false)
        .validateSchema(false)
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.CXAPI;

var cloudAssembly = new CloudAssembly("directory", new LoadManifestOptions {
    SkipEnumCheck = false,
    SkipVersionCheck = false,
    TopoSort = false,
    ValidateSchema = false
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

cloudAssembly := awscdk.Cx_api.NewCloudAssembly(jsii.String("directory"), &LoadManifestOptions{
	SkipEnumCheck: jsii.Boolean(false),
	SkipVersionCheck: jsii.Boolean(false),
	TopoSort: jsii.Boolean(false),
	ValidateSchema: jsii.Boolean(false),
})

Initializer ​

ts
new CloudAssembly(directory: string, loadOptions?: LoadManifestOptions)
python
CloudAssembly(directory: str, load_options: typing.Optional[LoadManifestOptions] = None)
java
new CloudAssembly(String directory, LoadManifestOptions loadOptions)
csharp
new CloudAssembly(string directory, LoadManifestOptions? loadOptions = null)
go
NewCloudAssembly(Directory *string, LoadOptions LoadManifestOptions)

Properties ​

artifactsCloudArtifact[]artifactstyping.List[CloudArtifact]artifactsList<CloudArtifact>ArtifactsCloudArtifact[]Artifacts*[]CloudArtifact#
All artifacts included in this assembly.
directorystringdirectorystrdirectoryStringDirectorystringDirectory*string#
The root directory of the cloud assembly.
The raw assembly manifest.
nestedAssembliesNestedCloudAssemblyArtifact[]nested_assembliestyping.List[NestedCloudAssemblyArtifact]nestedAssembliesList<NestedCloudAssemblyArtifact>NestedAssembliesNestedCloudAssemblyArtifact[]NestedAssemblies*[]NestedCloudAssemblyArtifact#
The nested assembly artifacts in this assembly.
Runtime information such as module versions used to synthesize this assembly.
stacksRecursivelyCloudFormationStackArtifact[]stacks_recursivelytyping.List[CloudFormationStackArtifact]stacksRecursivelyList<CloudFormationStackArtifact>StacksRecursivelyCloudFormationStackArtifact[]StacksRecursively*[]CloudFormationStackArtifact#
Returns all the stacks, including the ones in nested assemblies.
versionstringversionstrversionStringVersionstringVersion*string#
The schema version of the assembly manifest.

Methods ​

cleanupTemporaryDirectories(): void@staticmethod def cleanup_temporary_directories() -> Nonepublic static void cleanupTemporaryDirectories()public static void CleanupTemporaryDirectories()func CleanupTemporaryDirectories()static#
Cleans up any temporary assembly directories that got created in this process.
notes

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:

js
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:

js
module.exports = {
  // ...
  setupFilesAfterEnv: ['aws-cdk-lib/testhelpers/jest-autoclean'],
};
getNestedAssembly(artifactId: string): CloudAssembly // chainabledef get_nested_assembly(self, artifact_id: str) -> CloudAssemblypublic CloudAssembly getNestedAssembly(String artifactId)public CloudAssembly GetNestedAssembly(string artifactId)func GetNestedAssembly(ArtifactId *string) CloudAssembly#
Returns a nested assembly.
1 parameter

Parameters

  • artifactIdartifact_idartifactIdartifactIdArtifactId — - The artifact ID of the nested assembly.
getNestedAssemblyArtifact(artifactId: string): NestedCloudAssemblyArtifactdef get_nested_assembly_artifact(self, artifact_id: str) -> NestedCloudAssemblyArtifactpublic NestedCloudAssemblyArtifact getNestedAssemblyArtifact(String artifactId)public NestedCloudAssemblyArtifact GetNestedAssemblyArtifact(string artifactId)func GetNestedAssemblyArtifact(ArtifactId *string) NestedCloudAssemblyArtifact#
Returns a nested assembly artifact.
1 parameter

Parameters

  • artifactIdartifact_idartifactIdartifactIdArtifactId — - The artifact ID of the nested assembly.
getStackArtifact(artifactId: string): CloudFormationStackArtifactdef get_stack_artifact(self, artifact_id: str) -> CloudFormationStackArtifactpublic CloudFormationStackArtifact getStackArtifact(String artifactId)public CloudFormationStackArtifact GetStackArtifact(string artifactId)func GetStackArtifact(ArtifactId *string) CloudFormationStackArtifact#
Returns a CloudFormation stack artifact from this assembly.
1 parameter · returns

Parameters

  • artifactIdartifact_idartifactIdartifactIdArtifactId — - the artifact id of the stack (can be obtained through stack.artifactId).

Returns: a CloudFormationStackArtifact object.

getStackByName(stackName: string): CloudFormationStackArtifactdef get_stack_by_name(self, stack_name: str) -> CloudFormationStackArtifactpublic CloudFormationStackArtifact getStackByName(String stackName)public CloudFormationStackArtifact GetStackByName(string stackName)func GetStackByName(StackName *string) CloudFormationStackArtifact#
Returns a CloudFormation stack artifact from this assembly.

Will only search the current assembly.

1 parameter · returns

Parameters

  • stackNamestack_namestackNamestackNameStackName — - the name of the CloudFormation stack.

Returns: a CloudFormationStackArtifact object.

isCloudAssembly(x: any): boolean@staticmethod def is_cloud_assembly(x: Any) -> boolpublic static Boolean isCloudAssembly(Object x)public static bool IsCloudAssembly(object x)func IsCloudAssembly(X interface{}) *boolstatic#
Return whether the given object is a CloudAssembly.

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

tree(): TreeCloudArtifactdef tree(self, ) -> TreeCloudArtifactpublic TreeCloudArtifact tree()public TreeCloudArtifact Tree()func Tree() TreeCloudArtifact#
Returns the tree metadata artifact from this assembly.
returns

Returns: a TreeCloudArtifact object if there is one defined in the manifest, undefined otherwise.

tryGetArtifact(id: string): CloudArtifactdef try_get_artifact(self, id: str) -> CloudArtifactpublic CloudArtifact tryGetArtifact(String id)public CloudArtifact TryGetArtifact(string id)func TryGetArtifact(Id *string) CloudArtifact#
Attempts to find an artifact with a specific identity.
1 parameter · returns

Parameters

  • ididididId — - The artifact ID.

Returns: A CloudArtifact object or undefined if the artifact does not exist in this assembly.