Skip to content
v2.275.0

CloudFormationStackArtifact Class ​

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { cloud_assembly_schema } from 'aws-cdk-lib';
import { cx_api } from 'aws-cdk-lib';

declare const assumeRoleAdditionalOptions: any;
declare const cloudAssembly: cx_api.CloudAssembly;
const cloudFormationStackArtifact = new cx_api.CloudFormationStackArtifact(cloudAssembly, 'artifactId', {
  type: cloud_assembly_schema.ArtifactType.NONE,

  // the properties below are optional
  additionalMetadataFile: 'additionalMetadataFile',
  dependencies: ['dependencies'],
  displayName: 'displayName',
  environment: 'environment',
  metadata: {
    metadataKey: [{
      type: 'type',

      // the properties below are optional
      data: 'data',
      trace: ['trace'],
    }],
  },
  properties: {
    templateFile: 'templateFile',

    // the properties below are optional
    assumeRoleAdditionalOptions: {
      assumeRoleAdditionalOptionsKey: assumeRoleAdditionalOptions,
    },
    assumeRoleArn: 'assumeRoleArn',
    assumeRoleExternalId: 'assumeRoleExternalId',
    bootstrapStackVersionSsmParameter: 'bootstrapStackVersionSsmParameter',
    cloudFormationExecutionRoleArn: 'cloudFormationExecutionRoleArn',
    lookupRole: {
      arn: 'arn',

      // the properties below are optional
      assumeRoleAdditionalOptions: {
        assumeRoleAdditionalOptionsKey: assumeRoleAdditionalOptions,
      },
      assumeRoleExternalId: 'assumeRoleExternalId',
      bootstrapStackVersionSsmParameter: 'bootstrapStackVersionSsmParameter',
      requiresBootstrapStackVersion: 123,
    },
    notificationArns: ['notificationArns'],
    parameters: {
      parametersKey: 'parameters',
    },
    requiresBootstrapStackVersion: 123,
    stackName: 'stackName',
    stackTemplateAssetObjectUrl: 'stackTemplateAssetObjectUrl',
    tags: {
      tagsKey: 'tags',
    },
    terminationProtection: false,
    validateOnSynth: false,
  },
});
python
from aws_cdk.cloud_assembly_schema import MetadataEntry, AwsCloudFormationStackProperties, BootstrapRole
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import cloud_assembly_schema
from aws_cdk import cx_api

# assume_role_additional_options: Any
# cloud_assembly: cx_api.CloudAssembly

cloud_formation_stack_artifact = cx_api.CloudFormationStackArtifact(cloud_assembly, "artifactId",
    type=cloud_assembly_schema.ArtifactType.NONE,

    # the properties below are optional
    additional_metadata_file="additionalMetadataFile",
    dependencies=["dependencies"],
    display_name="displayName",
    environment="environment",
    metadata={
        "metadata_key": [MetadataEntry(
            type="type",

            # the properties below are optional
            data="data",
            trace=["trace"]
        )]
    },
    properties=AwsCloudFormationStackProperties(
        template_file="templateFile",

        # the properties below are optional
        assume_role_additional_options={
            "assume_role_additional_options_key": assume_role_additional_options
        },
        assume_role_arn="assumeRoleArn",
        assume_role_external_id="assumeRoleExternalId",
        bootstrap_stack_version_ssm_parameter="bootstrapStackVersionSsmParameter",
        cloud_formation_execution_role_arn="cloudFormationExecutionRoleArn",
        lookup_role=BootstrapRole(
            arn="arn",

            # the properties below are optional
            assume_role_additional_options={
                "assume_role_additional_options_key": assume_role_additional_options
            },
            assume_role_external_id="assumeRoleExternalId",
            bootstrap_stack_version_ssm_parameter="bootstrapStackVersionSsmParameter",
            requires_bootstrap_stack_version=123
        ),
        notification_arns=["notificationArns"],
        parameters={
            "parameters_key": "parameters"
        },
        requires_bootstrap_stack_version=123,
        stack_name="stackName",
        stack_template_asset_object_url="stackTemplateAssetObjectUrl",
        tags={
            "tags_key": "tags"
        },
        termination_protection=False,
        validate_on_synth=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.cloud_assembly_schema.*;
import software.amazon.awscdk.cxapi.*;

Object assumeRoleAdditionalOptions;
CloudAssembly cloudAssembly;

CloudFormationStackArtifact cloudFormationStackArtifact = CloudFormationStackArtifact.Builder.create(cloudAssembly, "artifactId")
        .type(ArtifactType.NONE)

        // the properties below are optional
        .additionalMetadataFile("additionalMetadataFile")
        .dependencies(List.of("dependencies"))
        .displayName("displayName")
        .environment("environment")
        .metadata(Map.of(
                "metadataKey", List.of(MetadataEntry.builder()
                        .type("type")

                        // the properties below are optional
                        .data("data")
                        .trace(List.of("trace"))
                        .build())))
        .properties(AwsCloudFormationStackProperties.builder()
                .templateFile("templateFile")

                // the properties below are optional
                .assumeRoleAdditionalOptions(Map.of(
                        "assumeRoleAdditionalOptionsKey", assumeRoleAdditionalOptions))
                .assumeRoleArn("assumeRoleArn")
                .assumeRoleExternalId("assumeRoleExternalId")
                .bootstrapStackVersionSsmParameter("bootstrapStackVersionSsmParameter")
                .cloudFormationExecutionRoleArn("cloudFormationExecutionRoleArn")
                .lookupRole(BootstrapRole.builder()
                        .arn("arn")

                        // the properties below are optional
                        .assumeRoleAdditionalOptions(Map.of(
                                "assumeRoleAdditionalOptionsKey", assumeRoleAdditionalOptions))
                        .assumeRoleExternalId("assumeRoleExternalId")
                        .bootstrapStackVersionSsmParameter("bootstrapStackVersionSsmParameter")
                        .requiresBootstrapStackVersion(123)
                        .build())
                .notificationArns(List.of("notificationArns"))
                .parameters(Map.of(
                        "parametersKey", "parameters"))
                .requiresBootstrapStackVersion(123)
                .stackName("stackName")
                .stackTemplateAssetObjectUrl("stackTemplateAssetObjectUrl")
                .tags(Map.of(
                        "tagsKey", "tags"))
                .terminationProtection(false)
                .validateOnSynth(false)
                .build())
        .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.Cloud_assembly_schema;
using Amazon.CDK.CXAPI;

var assumeRoleAdditionalOptions;
CloudAssembly cloudAssembly;

var cloudFormationStackArtifact = new CloudFormationStackArtifact(cloudAssembly, "artifactId", new ArtifactManifest {
    Type = ArtifactType.NONE,

    // the properties below are optional
    AdditionalMetadataFile = "additionalMetadataFile",
    Dependencies = new [] { "dependencies" },
    DisplayName = "displayName",
    Environment = "environment",
    Metadata = new Dictionary<string, MetadataEntry[]> {
        { "metadataKey", new [] { new MetadataEntry {
            Type = "type",

            // the properties below are optional
            Data = "data",
            Trace = new [] { "trace" }
        } } }
    },
    Properties = new AwsCloudFormationStackProperties {
        TemplateFile = "templateFile",

        // the properties below are optional
        AssumeRoleAdditionalOptions = new Dictionary<string, object> {
            { "assumeRoleAdditionalOptionsKey", assumeRoleAdditionalOptions }
        },
        AssumeRoleArn = "assumeRoleArn",
        AssumeRoleExternalId = "assumeRoleExternalId",
        BootstrapStackVersionSsmParameter = "bootstrapStackVersionSsmParameter",
        CloudFormationExecutionRoleArn = "cloudFormationExecutionRoleArn",
        LookupRole = new BootstrapRole {
            Arn = "arn",

            // the properties below are optional
            AssumeRoleAdditionalOptions = new Dictionary<string, object> {
                { "assumeRoleAdditionalOptionsKey", assumeRoleAdditionalOptions }
            },
            AssumeRoleExternalId = "assumeRoleExternalId",
            BootstrapStackVersionSsmParameter = "bootstrapStackVersionSsmParameter",
            RequiresBootstrapStackVersion = 123
        },
        NotificationArns = new [] { "notificationArns" },
        Parameters = new Dictionary<string, string> {
            { "parametersKey", "parameters" }
        },
        RequiresBootstrapStackVersion = 123,
        StackName = "stackName",
        StackTemplateAssetObjectUrl = "stackTemplateAssetObjectUrl",
        Tags = new Dictionary<string, string> {
            { "tagsKey", "tags" }
        },
        TerminationProtection = false,
        ValidateOnSynth = 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"
import "github.com/aws/aws-cdk-go/awscdk"

var assumeRoleAdditionalOptions interface{}
var cloudAssembly CloudAssembly

cloudFormationStackArtifact := awscdk.Cx_api.NewCloudFormationStackArtifact(cloudAssembly, jsii.String("artifactId"), &ArtifactManifest{
	Type: awscdk.Cloud_assembly_schema.ArtifactType_NONE,

	// the properties below are optional
	AdditionalMetadataFile: jsii.String("additionalMetadataFile"),
	Dependencies: []*string{
		jsii.String("dependencies"),
	},
	DisplayName: jsii.String("displayName"),
	Environment: jsii.String("environment"),
	Metadata: map[string][]MetadataEntry{
		"metadataKey": []MetadataEntry{
			&MetadataEntry{
				"type": jsii.String("type"),

				// the properties below are optional
				"data": jsii.String("data"),
				"trace": []*string{
					jsii.String("trace"),
				},
			},
		},
	},
	Properties: &AwsCloudFormationStackProperties{
		TemplateFile: jsii.String("templateFile"),

		// the properties below are optional
		AssumeRoleAdditionalOptions: map[string]interface{}{
			"assumeRoleAdditionalOptionsKey": assumeRoleAdditionalOptions,
		},
		AssumeRoleArn: jsii.String("assumeRoleArn"),
		AssumeRoleExternalId: jsii.String("assumeRoleExternalId"),
		BootstrapStackVersionSsmParameter: jsii.String("bootstrapStackVersionSsmParameter"),
		CloudFormationExecutionRoleArn: jsii.String("cloudFormationExecutionRoleArn"),
		LookupRole: &BootstrapRole{
			Arn: jsii.String("arn"),

			// the properties below are optional
			AssumeRoleAdditionalOptions: map[string]interface{}{
				"assumeRoleAdditionalOptionsKey": assumeRoleAdditionalOptions,
			},
			AssumeRoleExternalId: jsii.String("assumeRoleExternalId"),
			BootstrapStackVersionSsmParameter: jsii.String("bootstrapStackVersionSsmParameter"),
			RequiresBootstrapStackVersion: jsii.Number(123),
		},
		NotificationArns: []*string{
			jsii.String("notificationArns"),
		},
		Parameters: map[string]*string{
			"parametersKey": jsii.String("parameters"),
		},
		RequiresBootstrapStackVersion: jsii.Number(123),
		StackName: jsii.String("stackName"),
		StackTemplateAssetObjectUrl: jsii.String("stackTemplateAssetObjectUrl"),
		Tags: map[string]*string{
			"tagsKey": jsii.String("tags"),
		},
		TerminationProtection: jsii.Boolean(false),
		ValidateOnSynth: jsii.Boolean(false),
	},
})

Initializer ​

ts
new CloudFormationStackArtifact(assembly: CloudAssembly, artifactId: string, artifact: ArtifactManifest)
python
CloudFormationStackArtifact(assembly: CloudAssembly, artifact_id: str, artifact: ArtifactManifest)
java
new CloudFormationStackArtifact(CloudAssembly assembly, String artifactId, ArtifactManifest artifact)
csharp
new CloudFormationStackArtifact(CloudAssembly assembly, string artifactId, ArtifactManifest artifact)
go
NewCloudFormationStackArtifact(Assembly CloudAssembly, ArtifactId *string, Artifact ArtifactManifest)

Properties ​

Any assets associated with this stack.
assumeRoleAdditionalOptionsmay be undefined{ [key: string]: any }assume_role_additional_optionsmay be undefinedtyping.Mapping[str, Any]assumeRoleAdditionalOptionsmay be undefinedMap<String, Object>AssumeRoleAdditionalOptionsmay be undefinedIDictionary<string, object>AssumeRoleAdditionalOptionsmay be undefined*map[string]interface{}#
Additional options to pass to STS when assuming the role for cloudformation deployments.

Default: No additional options.

notes
  • RoleArn should not be used. Use the dedicated assumeRoleArn property instead.
  • ExternalId should not be used. Use the dedicated assumeRoleExternalId instead.
  • TransitiveTagKeys defaults to use all keys (if any) specified in Tags. E.g, all tags are transitive by default.
assumeRoleArnmay be undefinedstringassume_role_arnmay be undefinedstrassumeRoleArnmay be undefinedStringAssumeRoleArnmay be undefinedstringAssumeRoleArnmay be undefined*string#
The role that needs to be assumed to deploy the stack.

Default: No role is assumed (current credentials are used)

assumeRoleExternalIdmay be undefinedstringassume_role_external_idmay be undefinedstrassumeRoleExternalIdmay be undefinedStringAssumeRoleExternalIdmay be undefinedstringAssumeRoleExternalIdmay be undefined*string#
External ID to use when assuming role for cloudformation deployments.

Default: No external ID

bootstrapStackVersionSsmParametermay be undefinedstringbootstrap_stack_version_ssm_parametermay be undefinedstrbootstrapStackVersionSsmParametermay be undefinedStringBootstrapStackVersionSsmParametermay be undefinedstringBootstrapStackVersionSsmParametermay be undefined*string#
Name of SSM parameter with bootstrap stack version.

Default: Discover SSM parameter by reading stack

cloudFormationExecutionRoleArnmay be undefinedstringcloud_formation_execution_role_arnmay be undefinedstrcloudFormationExecutionRoleArnmay be undefinedStringCloudFormationExecutionRoleArnmay be undefinedstringCloudFormationExecutionRoleArnmay be undefined*string#
The role that is passed to CloudFormation to execute the change set.

Default: No role is passed (currently assumed role/credentials are used)

dependenciesCloudArtifact[]dependenciestyping.List[CloudArtifact]dependenciesList<CloudArtifact>DependenciesCloudArtifact[]Dependencies*[]CloudArtifact#
Returns all the artifacts that this artifact depends on.
displayNamestringdisplay_namestrdisplayNameStringDisplayNamestringDisplayName*string#
A string that represents this stack.

Should only be used in user interfaces. If the stackName has not been set explicitly, or has been set to artifactId, it will return the hierarchicalId of the stack. Otherwise, it will return something like "<hierarchicalId> (<stackName>)"

environmentEnvironmentenvironmentEnvironmentenvironmentEnvironmentEnvironmentEnvironmentEnvironmentEnvironment#
The environment into which to deploy this artifact.
hierarchicalIdstringhierarchical_idstrhierarchicalIdStringHierarchicalIdstringHierarchicalId*string#
An identifier that shows where this artifact is located in the tree of nested assemblies, based on their manifests.

Defaults to the normal id. Should only be used in user interfaces.

idstringidstridStringIdstringId*string#
lookupRolemay be undefinedBootstrapRolelookup_rolemay be undefinedBootstrapRolelookupRolemay be undefinedBootstrapRoleLookupRolemay be undefinedBootstrapRoleLookupRolemay be undefinedBootstrapRole#
The role to use to look up values from the target AWS account.

Default: No role is assumed (current credentials are used)

The artifact's manifest.
messagesSynthesisMessage[]messagestyping.List[SynthesisMessage]messagesList<SynthesisMessage>MessagesSynthesisMessage[]Messages*[]SynthesisMessage#
The set of messages extracted from the artifact's metadata.
metadata{ [key: string]: MetadataEntry[] }metadatatyping.Mapping[str, typing.List[MetadataEntry]]metadataMap<String, List<MetadataEntry>>MetadataIDictionary<string, MetadataEntry[]>Metadata*map[string]*[]MetadataEntry#
Returns the metadata associated with this Cloud Artifact.
notificationArnsmay be undefinedstring[]notification_arnsmay be undefinedtyping.List[str]notificationArnsmay be undefinedList<String>NotificationArnsmay be undefinedstring[]NotificationArnsmay be undefined*[]*string#
SNS Topics that will receive stack events.
originalNamestringoriginal_namestroriginalNameStringOriginalNamestringOriginalName*string#
The original name as defined in the CDK app.
parameters{ [key: string]: string }parameterstyping.Mapping[str, str]parametersMap<String, String>ParametersIDictionary<string, string>Parameters*map[string]*string#
CloudFormation parameters to pass to the stack.
requiresBootstrapStackVersionmay be undefinednumberrequires_bootstrap_stack_versionmay be undefinedint | floatrequiresBootstrapStackVersionmay be undefinedNumberRequiresBootstrapStackVersionmay be undefineddoubleRequiresBootstrapStackVersionmay be undefined*float64#
Version of bootstrap stack required to deploy this stack.

Default: No bootstrap stack required

stackNamestringstack_namestrstackNameStringStackNamestringStackName*string#
The physical name of this stack.
stackTemplateAssetObjectUrlmay be undefinedstringstack_template_asset_object_urlmay be undefinedstrstackTemplateAssetObjectUrlmay be undefinedStringStackTemplateAssetObjectUrlmay be undefinedstringStackTemplateAssetObjectUrlmay be undefined*string#
If the stack template has already been included in the asset manifest, its asset URL.

Default: Not uploaded yet, upload just before deploying

tags{ [key: string]: string }tagstyping.Mapping[str, str]tagsMap<String, String>TagsIDictionary<string, string>Tags*map[string]*string#
CloudFormation tags to pass to the stack.
templateanytemplateAnytemplateObjectTemplateobjectTemplateinterface{}#
The CloudFormation template for this stack.
templateFilestringtemplate_filestrtemplateFileStringTemplateFilestringTemplateFile*string#
The file name of the template.
templateFullPathstringtemplate_full_pathstrtemplateFullPathStringTemplateFullPathstringTemplateFullPath*string#
Full path to the template file.
terminationProtectionmay be undefinedbooleantermination_protectionmay be undefinedboolterminationProtectionmay be undefinedBooleanTerminationProtectionmay be undefinedboolTerminationProtectionmay be undefined*bool#
Whether termination protection is enabled for this stack.
validateOnSynthmay be undefinedbooleanvalidate_on_synthmay be undefinedboolvalidateOnSynthmay be undefinedBooleanValidateOnSynthmay be undefinedboolValidateOnSynthmay be undefined*bool= false#
Whether this stack should be validated by the CLI after synthesis.

Methods ​

findMetadataByType(type: string): MetadataEntryResult[]def find_metadata_by_type(self, type: str) -> typing.List[MetadataEntryResult]public List<MetadataEntryResult> findMetadataByType(String type)public MetadataEntryResult[] FindMetadataByType(string type)func FindMetadataByType(Type *string) *[]MetadataEntryResult#
returns

Returns: all the metadata entries of a specific type in this artifact.

fromManifest(assembly: CloudAssembly, id: string, artifact: ArtifactManifest): CloudArtifact@staticmethod def from_manifest(assembly: CloudAssembly, id: str, artifact: ArtifactManifest) -> CloudArtifactpublic static CloudArtifact fromManifest(CloudAssembly assembly, String id, ArtifactManifest artifact)public static CloudArtifact FromManifest(CloudAssembly assembly, string id, ArtifactManifest artifact)func FromManifest(Assembly CloudAssembly, Id *string, Artifact ArtifactManifest) CloudArtifactstatic#
Returns a subclass of `CloudArtifact` based on the artifact type defined in the artifact manifest.
3 parameters · returns

Parameters

  • assemblyassemblyassemblyassemblyAssembly — - The cloud assembly from which to load the artifact.
  • ididididId — - The artifact ID.
  • artifactartifactartifactartifactArtifact — - The artifact manifest.

Returns: the CloudArtifact that matches the artifact type or undefined if it's an artifact type that is unrecognized by this module.

isCloudFormationStackArtifact(art: any): boolean@staticmethod def is_cloud_formation_stack_artifact(art: Any) -> boolpublic static Boolean isCloudFormationStackArtifact(Object art)public static bool IsCloudFormationStackArtifact(object art)func IsCloudFormationStackArtifact(Art interface{}) *boolstatic#
Checks if `art` is an instance of this class.
notes

Use this method instead of instanceof to properly detect CloudFormationStackArtifact instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the cx-api library on disk are seen as independent, completely different libraries. As a consequence, the class CloudFormationStackArtifact in each copy of the cx-api library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the cx-api library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.