Skip to content
v2.278.0

CfnStack L1 construct ​

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-stack.html.

Example ​

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

declare const customJson: any;
const cfnStack = new opsworks.CfnStack(this, 'MyCfnStack', {
  defaultInstanceProfileArn: 'defaultInstanceProfileArn',
  name: 'name',
  serviceRoleArn: 'serviceRoleArn',

  // the properties below are optional
  agentVersion: 'agentVersion',
  attributes: {
    attributesKey: 'attributes',
  },
  chefConfiguration: {
    berkshelfVersion: 'berkshelfVersion',
    manageBerkshelf: false,
  },
  cloneAppIds: ['cloneAppIds'],
  clonePermissions: false,
  configurationManager: {
    name: 'name',
    version: 'version',
  },
  customCookbooksSource: {
    password: 'password',
    revision: 'revision',
    sshKey: 'sshKey',
    type: 'type',
    url: 'url',
    username: 'username',
  },
  customJson: customJson,
  defaultAvailabilityZone: 'defaultAvailabilityZone',
  defaultOs: 'defaultOs',
  defaultRootDeviceType: 'defaultRootDeviceType',
  defaultSshKeyName: 'defaultSshKeyName',
  defaultSubnetId: 'defaultSubnetId',
  ecsClusterArn: 'ecsClusterArn',
  elasticIps: [{
    ip: 'ip',

    // the properties below are optional
    name: 'name',
  }],
  hostnameTheme: 'hostnameTheme',
  rdsDbInstances: [{
    dbPassword: 'dbPassword',
    dbUser: 'dbUser',
    rdsDbInstanceArn: 'rdsDbInstanceArn',
  }],
  sourceStackId: 'sourceStackId',
  tags: [{
    key: 'key',
    value: 'value',
  }],
  useCustomCookbooks: false,
  useOpsworksSecurityGroups: false,
  vpcId: 'vpcId',
});
python
from aws_cdk import CfnTag
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_opsworks as opsworks

# custom_json: Any

cfn_stack = opsworks.CfnStack(self, "MyCfnStack",
    default_instance_profile_arn="defaultInstanceProfileArn",
    name="name",
    service_role_arn="serviceRoleArn",

    # the properties below are optional
    agent_version="agentVersion",
    attributes={
        "attributes_key": "attributes"
    },
    chef_configuration=opsworks.CfnStack.ChefConfigurationProperty(
        berkshelf_version="berkshelfVersion",
        manage_berkshelf=False
    ),
    clone_app_ids=["cloneAppIds"],
    clone_permissions=False,
    configuration_manager=opsworks.CfnStack.StackConfigurationManagerProperty(
        name="name",
        version="version"
    ),
    custom_cookbooks_source=opsworks.CfnStack.SourceProperty(
        password="password",
        revision="revision",
        ssh_key="sshKey",
        type="type",
        url="url",
        username="username"
    ),
    custom_json=custom_json,
    default_availability_zone="defaultAvailabilityZone",
    default_os="defaultOs",
    default_root_device_type="defaultRootDeviceType",
    default_ssh_key_name="defaultSshKeyName",
    default_subnet_id="defaultSubnetId",
    ecs_cluster_arn="ecsClusterArn",
    elastic_ips=[opsworks.CfnStack.ElasticIpProperty(
        ip="ip",

        # the properties below are optional
        name="name"
    )],
    hostname_theme="hostnameTheme",
    rds_db_instances=[opsworks.CfnStack.RdsDbInstanceProperty(
        db_password="dbPassword",
        db_user="dbUser",
        rds_db_instance_arn="rdsDbInstanceArn"
    )],
    source_stack_id="sourceStackId",
    tags=[CfnTag(
        key="key",
        value="value"
    )],
    use_custom_cookbooks=False,
    use_opsworks_security_groups=False,
    vpc_id="vpcId"
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.opsworks.*;

Object customJson;

CfnStack cfnStack = CfnStack.Builder.create(this, "MyCfnStack")
        .defaultInstanceProfileArn("defaultInstanceProfileArn")
        .name("name")
        .serviceRoleArn("serviceRoleArn")

        // the properties below are optional
        .agentVersion("agentVersion")
        .attributes(Map.of(
                "attributesKey", "attributes"))
        .chefConfiguration(ChefConfigurationProperty.builder()
                .berkshelfVersion("berkshelfVersion")
                .manageBerkshelf(false)
                .build())
        .cloneAppIds(List.of("cloneAppIds"))
        .clonePermissions(false)
        .configurationManager(StackConfigurationManagerProperty.builder()
                .name("name")
                .version("version")
                .build())
        .customCookbooksSource(SourceProperty.builder()
                .password("password")
                .revision("revision")
                .sshKey("sshKey")
                .type("type")
                .url("url")
                .username("username")
                .build())
        .customJson(customJson)
        .defaultAvailabilityZone("defaultAvailabilityZone")
        .defaultOs("defaultOs")
        .defaultRootDeviceType("defaultRootDeviceType")
        .defaultSshKeyName("defaultSshKeyName")
        .defaultSubnetId("defaultSubnetId")
        .ecsClusterArn("ecsClusterArn")
        .elasticIps(List.of(ElasticIpProperty.builder()
                .ip("ip")

                // the properties below are optional
                .name("name")
                .build()))
        .hostnameTheme("hostnameTheme")
        .rdsDbInstances(List.of(RdsDbInstanceProperty.builder()
                .dbPassword("dbPassword")
                .dbUser("dbUser")
                .rdsDbInstanceArn("rdsDbInstanceArn")
                .build()))
        .sourceStackId("sourceStackId")
        .tags(List.of(CfnTag.builder()
                .key("key")
                .value("value")
                .build()))
        .useCustomCookbooks(false)
        .useOpsworksSecurityGroups(false)
        .vpcId("vpcId")
        .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.AWS.OpsWorks;

var customJson;

var cfnStack = new CfnStack(this, "MyCfnStack", new CfnStackProps {
    DefaultInstanceProfileArn = "defaultInstanceProfileArn",
    Name = "name",
    ServiceRoleArn = "serviceRoleArn",

    // the properties below are optional
    AgentVersion = "agentVersion",
    Attributes = new Dictionary<string, string> {
        { "attributesKey", "attributes" }
    },
    ChefConfiguration = new ChefConfigurationProperty {
        BerkshelfVersion = "berkshelfVersion",
        ManageBerkshelf = false
    },
    CloneAppIds = new [] { "cloneAppIds" },
    ClonePermissions = false,
    ConfigurationManager = new StackConfigurationManagerProperty {
        Name = "name",
        Version = "version"
    },
    CustomCookbooksSource = new SourceProperty {
        Password = "password",
        Revision = "revision",
        SshKey = "sshKey",
        Type = "type",
        Url = "url",
        Username = "username"
    },
    CustomJson = customJson,
    DefaultAvailabilityZone = "defaultAvailabilityZone",
    DefaultOs = "defaultOs",
    DefaultRootDeviceType = "defaultRootDeviceType",
    DefaultSshKeyName = "defaultSshKeyName",
    DefaultSubnetId = "defaultSubnetId",
    EcsClusterArn = "ecsClusterArn",
    ElasticIps = new [] { new ElasticIpProperty {
        Ip = "ip",

        // the properties below are optional
        Name = "name"
    } },
    HostnameTheme = "hostnameTheme",
    RdsDbInstances = new [] { new RdsDbInstanceProperty {
        DbPassword = "dbPassword",
        DbUser = "dbUser",
        RdsDbInstanceArn = "rdsDbInstanceArn"
    } },
    SourceStackId = "sourceStackId",
    Tags = new [] { new CfnTag {
        Key = "key",
        Value = "value"
    } },
    UseCustomCookbooks = false,
    UseOpsworksSecurityGroups = false,
    VpcId = "vpcId"
});
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"

var customJson interface{}

cfnStack := awscdk.Aws_opsworks.NewCfnStack(this, jsii.String("MyCfnStack"), &CfnStackProps{
	DefaultInstanceProfileArn: jsii.String("defaultInstanceProfileArn"),
	Name: jsii.String("name"),
	ServiceRoleArn: jsii.String("serviceRoleArn"),

	// the properties below are optional
	AgentVersion: jsii.String("agentVersion"),
	Attributes: map[string]*string{
		"attributesKey": jsii.String("attributes"),
	},
	ChefConfiguration: &ChefConfigurationProperty{
		BerkshelfVersion: jsii.String("berkshelfVersion"),
		ManageBerkshelf: jsii.Boolean(false),
	},
	CloneAppIds: []*string{
		jsii.String("cloneAppIds"),
	},
	ClonePermissions: jsii.Boolean(false),
	ConfigurationManager: &StackConfigurationManagerProperty{
		Name: jsii.String("name"),
		Version: jsii.String("version"),
	},
	CustomCookbooksSource: &SourceProperty{
		Password: jsii.String("password"),
		Revision: jsii.String("revision"),
		SshKey: jsii.String("sshKey"),
		Type: jsii.String("type"),
		Url: jsii.String("url"),
		Username: jsii.String("username"),
	},
	CustomJson: customJson,
	DefaultAvailabilityZone: jsii.String("defaultAvailabilityZone"),
	DefaultOs: jsii.String("defaultOs"),
	DefaultRootDeviceType: jsii.String("defaultRootDeviceType"),
	DefaultSshKeyName: jsii.String("defaultSshKeyName"),
	DefaultSubnetId: jsii.String("defaultSubnetId"),
	EcsClusterArn: jsii.String("ecsClusterArn"),
	ElasticIps: []interface{}{
		&ElasticIpProperty{
			Ip: jsii.String("ip"),

			// the properties below are optional
			Name: jsii.String("name"),
		},
	},
	HostnameTheme: jsii.String("hostnameTheme"),
	RdsDbInstances: []interface{}{
		&RdsDbInstanceProperty{
			DbPassword: jsii.String("dbPassword"),
			DbUser: jsii.String("dbUser"),
			RdsDbInstanceArn: jsii.String("rdsDbInstanceArn"),
		},
	},
	SourceStackId: jsii.String("sourceStackId"),
	Tags: []CfnTag{
		&CfnTag{
			Key: jsii.String("key"),
			Value: jsii.String("value"),
		},
	},
	UseCustomCookbooks: jsii.Boolean(false),
	UseOpsworksSecurityGroups: jsii.Boolean(false),
	VpcId: jsii.String("vpcId"),
})

Initializer ​

ts
new CfnStack(scope: Construct, id: string, props: CfnStackProps)
python
CfnStack(scope: Construct, id: str, props: CfnStackProps)
java
new CfnStack(Construct scope, String id, CfnStackProps props)
csharp
new CfnStack(Construct scope, string id, CfnStackProps props)
go
NewCfnStack(Scope Construct, Id *string, Props CfnStackProps)

Construct Props ​

agentVersionoptionalstringagent_versionoptionalstragentVersionoptionalStringAgentVersionoptionalstringAgentVersionoptional*string #
The default OpsWorks Stacks agent version. You have the following options:.
notes
  • Auto-update - Set this parameter to LATEST . OpsWorks Stacks automatically installs new agent versions on the stack's instances as soon as they are available.
  • Fixed version - Set this parameter to your preferred agent version. To update the agent version, you must edit the stack configuration and specify a new version. OpsWorks Stacks installs that version on the stack's instances.

The default setting is the most recent release of the agent. To specify an agent version, you must use the complete version number, not the abbreviated number shown on the console. For a list of available agent version numbers, call DescribeAgentVersions . AgentVersion cannot be set to Chef 12.2.

You can also specify an agent version when you create or update an instance, which overrides the stack's default setting.

attributesoptionalIResolvable | { [key: string]: string }attributesoptionaltyping.Union[IResolvable, typing.Mapping[str, str]]attributesoptionalIResolvableAttributesoptionalIResolvableAttributesoptionalinterface{} #
One or more user-defined key-value pairs to be added to the stack attributes.
chefConfigurationoptionalIResolvable | CfnStack.ChefConfigurationPropertychef_configurationoptionaltyping.Union[IResolvable, ChefConfigurationProperty]chefConfigurationoptionalIResolvableChefConfigurationoptionalIResolvableChefConfigurationoptionalinterface{} #
A `ChefConfiguration` object that specifies whether to enable Berkshelf and the Berkshelf version on Chef 11.10 stacks. For more information, see Create a New Stack .
cloneAppIdsoptionalstring[]clone_app_idsoptionaltyping.List[str]cloneAppIdsoptionalList<String>CloneAppIdsoptionalstring[]CloneAppIdsoptional*[]*string #
If you're cloning an OpsWorks stack, a list of OpsWorks application stack IDs from the source stack to include in the cloned stack.
clonePermissionsoptionalboolean | IResolvableclone_permissionsoptionaltyping.Union[bool, IResolvable]clonePermissionsoptionalBooleanClonePermissionsoptionalboolClonePermissionsoptionalinterface{} #
If you're cloning an OpsWorks stack, indicates whether to clone the source stack's permissions.
configurationManageroptionalIResolvable | CfnStack.StackConfigurationManagerPropertyconfiguration_manageroptionaltyping.Union[IResolvable, StackConfigurationManagerProperty]configurationManageroptionalIResolvableConfigurationManageroptionalIResolvableConfigurationManageroptionalinterface{} #
The configuration manager.

When you create a stack we recommend that you use the configuration manager to specify the Chef version: 12, 11.10, or 11.4 for Linux stacks, or 12.2 for Windows stacks. The default value for Linux stacks is currently 12.

customCookbooksSourceoptionalIResolvable | CfnStack.SourcePropertycustom_cookbooks_sourceoptionaltyping.Union[IResolvable, SourceProperty]customCookbooksSourceoptionalIResolvableCustomCookbooksSourceoptionalIResolvableCustomCookbooksSourceoptionalinterface{} #
Contains the information required to retrieve an app or cookbook from a repository.

For more information, see Adding Apps or Cookbooks and Recipes .

customJsonoptionalanycustom_jsonoptionalAnycustomJsonoptionalObjectCustomJsonoptionalobjectCustomJsonoptionalinterface{} #
A string that contains user-defined, custom JSON.
notes

It can be used to override the corresponding default stack configuration attribute values or to pass data to recipes. The string should be in the following format:

"{\"key1\": \"value1\", \"key2\": \"value2\",...}"

For more information about custom JSON, see Use Custom JSON to Modify the Stack Configuration Attributes .

defaultAvailabilityZoneoptionalstringdefault_availability_zoneoptionalstrdefaultAvailabilityZoneoptionalStringDefaultAvailabilityZoneoptionalstringDefaultAvailabilityZoneoptional*string #
The stack's default Availability Zone, which must be in the specified region.
notes

For more information, see Regions and Endpoints . If you also specify a value for DefaultSubnetId , the subnet must be in the same zone. For more information, see the VpcId parameter description.

defaultInstanceProfileArnstringdefault_instance_profile_arnstrdefaultInstanceProfileArnStringDefaultInstanceProfileArnstringDefaultInstanceProfileArn*string required #
The Amazon Resource Name (ARN) of an IAM profile that is the default profile for all of the stack's EC2 instances.

For more information about IAM ARNs, see Using Identifiers .

defaultOsoptionalstringdefault_osoptionalstrdefaultOsoptionalStringDefaultOsoptionalstringDefaultOsoptional*string #
The stack's default operating system, which is installed on every instance unless you specify a different operating system when you create the instance.
notes

You can specify one of the following.

  • A supported Linux operating system: An Amazon Linux version, such as Amazon Linux 2 , Amazon Linux 2018.03 , Amazon Linux 2017.09 , Amazon Linux 2017.03 , Amazon Linux 2016.09 , Amazon Linux 2016.03 , Amazon Linux 2015.09 , or Amazon Linux 2015.03 .
  • A supported Ubuntu operating system, such as Ubuntu 18.04 LTS , Ubuntu 16.04 LTS , Ubuntu 14.04 LTS , or Ubuntu 12.04 LTS .
  • CentOS Linux 7
  • Red Hat Enterprise Linux 7
  • A supported Windows operating system, such as Microsoft Windows Server 2012 R2 Base , Microsoft Windows Server 2012 R2 with SQL Server Express , Microsoft Windows Server 2012 R2 with SQL Server Standard , or Microsoft Windows Server 2012 R2 with SQL Server Web .
  • A custom AMI: Custom . You specify the custom AMI you want to use when you create instances. For more information, see Using Custom AMIs .

The default option is the current Amazon Linux version. Not all operating systems are supported with all versions of Chef. For more information about supported operating systems, see OpsWorks Stacks Operating Systems .

defaultRootDeviceTypeoptionalstringdefault_root_device_typeoptionalstrdefaultRootDeviceTypeoptionalStringDefaultRootDeviceTypeoptionalstringDefaultRootDeviceTypeoptional*string #
The default root device type.
notes

This value is the default for all instances in the stack, but you can override it when you create an instance. The default option is instance-store . For more information, see Storage for the Root Device .

defaultSshKeyNameoptionalstringdefault_ssh_key_nameoptionalstrdefaultSshKeyNameoptionalStringDefaultSshKeyNameoptionalstringDefaultSshKeyNameoptional*string #
A default Amazon EC2 key pair name.
notes

The default value is none. If you specify a key pair name, OpsWorks installs the public key on the instance and you can use the private key with an SSH client to log in to the instance. For more information, see Using SSH to Communicate with an Instance and Managing SSH Access . You can override this setting by specifying a different key pair, or no key pair, when you create an instance .

defaultSubnetIdoptionalstringdefault_subnet_idoptionalstrdefaultSubnetIdoptionalStringDefaultSubnetIdoptionalstringDefaultSubnetIdoptional*string #
The stack's default subnet ID.
notes

All instances are launched into this subnet unless you specify another subnet ID when you create the instance. This parameter is required if you specify a value for the VpcId parameter. If you also specify a value for DefaultAvailabilityZone , the subnet must be in that zone.

ecsClusterArnoptionalstringecs_cluster_arnoptionalstrecsClusterArnoptionalStringEcsClusterArnoptionalstringEcsClusterArnoptional*string #
The Amazon Resource Name (ARN) of the ( Amazon ECS ) cluster to register with the OpsWorks stack.

If you specify a cluster that's registered with another OpsWorks stack, CloudFormation deregisters the existing association before registering the cluster.

elasticIpsoptionalIResolvable | IResolvable | CfnStack.ElasticIpProperty[]elastic_ipsoptionaltyping.Union[IResolvable, typing.List[typing.Union[IResolvable, ElasticIpProperty]]]elasticIpsoptionalIResolvableElasticIpsoptionalIResolvableElasticIpsoptionalinterface{} #
A list of Elastic IP addresses to register with the OpsWorks stack.

If you specify an IP address that's registered with another OpsWorks stack, CloudFormation deregisters the existing association before registering the IP address.

hostnameThemeoptionalstringhostname_themeoptionalstrhostnameThemeoptionalStringHostnameThemeoptionalstringHostnameThemeoptional*string #
The stack's host name theme, with spaces replaced by underscores.
notes

The theme is used to generate host names for the stack's instances. By default, HostnameTheme is set to Layer_Dependent , which creates host names by appending integers to the layer's short name. The other themes are:

  • Baked_Goods
  • Clouds
  • Europe_Cities
  • Fruits
  • Greek_Deities_and_Titans
  • Legendary_creatures_from_Japan
  • Planets_and_Moons
  • Roman_Deities
  • Scottish_Islands
  • US_Cities
  • Wild_Cats

To obtain a generated host name, call GetHostNameSuggestion , which returns a host name based on the current theme.

namestringnamestrnameStringNamestringName*string required #
The stack name.

Stack names can be a maximum of 64 characters.

rdsDbInstancesoptionalIResolvable | IResolvable | CfnStack.RdsDbInstanceProperty[]rds_db_instancesoptionaltyping.Union[IResolvable, typing.List[typing.Union[IResolvable, RdsDbInstanceProperty]]]rdsDbInstancesoptionalIResolvableRdsDbInstancesoptionalIResolvableRdsDbInstancesoptionalinterface{} #
The Amazon Relational Database Service ( Amazon RDS ) database instance to register with the OpsWorks stack.

If you specify a database instance that's registered with another OpsWorks stack, CloudFormation deregisters the existing association before registering the database instance.

serviceRoleArnstringservice_role_arnstrserviceRoleArnStringServiceRoleArnstringServiceRoleArn*string required #
The stack's IAM role, which allows OpsWorks Stacks to work with AWS resources on your behalf.

You must set this parameter to the Amazon Resource Name (ARN) for an existing IAM role. For more information about IAM ARNs, see Using Identifiers .

sourceStackIdoptionalstringsource_stack_idoptionalstrsourceStackIdoptionalStringSourceStackIdoptionalstringSourceStackIdoptional*string #
If you're cloning an OpsWorks stack, the stack ID of the source OpsWorks stack to clone.
tagsoptionalCfnTag[]tagsoptionaltyping.List[CfnTag]tagsoptionalList<CfnTag>TagsoptionalCfnTag[]Tagsoptional*[]CfnTag #
A map that contains tag keys and tag values that are attached to a stack or layer.
notes
  • The key cannot be empty.
  • The key can be a maximum of 127 characters, and can contain only Unicode letters, numbers, or separators, or the following special characters: + - = . _ : /
  • The value can be a maximum 255 characters, and contain only Unicode letters, numbers, or separators, or the following special characters: + - = . _ : /
  • Leading and trailing white spaces are trimmed from both the key and value.
  • A maximum of 40 tags is allowed for any resource.
useCustomCookbooksoptionalboolean | IResolvableuse_custom_cookbooksoptionaltyping.Union[bool, IResolvable]useCustomCookbooksoptionalBooleanUseCustomCookbooksoptionalboolUseCustomCookbooksoptionalinterface{} #
Whether the stack uses custom cookbooks.
useOpsworksSecurityGroupsoptionalboolean | IResolvableuse_opsworks_security_groupsoptionaltyping.Union[bool, IResolvable]useOpsworksSecurityGroupsoptionalBooleanUseOpsworksSecurityGroupsoptionalboolUseOpsworksSecurityGroupsoptionalinterface{} #
Whether to associate the OpsWorks Stacks built-in security groups with the stack's layers.
notes

OpsWorks Stacks provides a standard set of built-in security groups, one for each layer, which are associated with layers by default. With UseOpsworksSecurityGroups you can instead provide your own custom security groups. UseOpsworksSecurityGroups has the following settings:

  • True - OpsWorks Stacks automatically associates the appropriate built-in security group with each layer (default setting). You can associate additional security groups with a layer after you create it, but you cannot delete the built-in security group.
  • False - OpsWorks Stacks does not associate built-in security groups with layers. You must create appropriate EC2 security groups and associate a security group with each layer that you create. However, you can still manually associate a built-in security group with a layer on creation; custom security groups are required only for those layers that need custom settings.

For more information, see Create a New Stack .

vpcIdoptionalstringvpc_idoptionalstrvpcIdoptionalStringVpcIdoptionalstringVpcIdoptional*string #
The ID of the VPC that the stack is to be launched into.
notes

The VPC must be in the stack's region. All instances are launched into this VPC. You cannot change the ID later.

  • If your account supports EC2-Classic, the default value is no VPC .
  • If your account does not support EC2-Classic, the default value is the default VPC for the specified region.

If the VPC ID corresponds to a default VPC and you have specified either the DefaultAvailabilityZone or the DefaultSubnetId parameter only, OpsWorks Stacks infers the value of the other parameter. If you specify neither parameter, OpsWorks Stacks sets these parameters to the first valid Availability Zone for the specified region and the corresponding default VPC subnet ID, respectively.

If you specify a nondefault VPC ID, note the following:

  • It must belong to a VPC in your account that is in the specified region.
  • You must specify a value for DefaultSubnetId .

For more information about how to use OpsWorks Stacks with a VPC, see Running a Stack in a VPC . For more information about default VPC and EC2-Classic, see Supported Platforms .

Properties ​

agentVersionmay be undefinedstringagent_versionmay be undefinedstragentVersionmay be undefinedStringAgentVersionmay be undefinedstringAgentVersionmay be undefined*string #
The default OpsWorks Stacks agent version.

You have the following options:.

attributesmay be undefinedIResolvable | { [key: string]: string }attributesmay be undefinedtyping.Union[IResolvable, typing.Mapping[str, str]]attributesmay be undefinedIResolvableAttributesmay be undefinedIResolvableAttributesmay be undefinedinterface{} #
One or more user-defined key-value pairs to be added to the stack attributes.
CFN_RESOURCE_TYPE_NAMEstringCFN_RESOURCE_TYPE_NAMEstrCFN_RESOURCE_TYPE_NAMEStringCFN_RESOURCE_TYPE_NAMEstringCFN_RESOURCE_TYPE_NAME*string static #
The CloudFormation resource type name for this resource class.
Options for this resource, such as condition, update policy etc.
cfnResourceTypestringcfn_resource_typestrcfnResourceTypeStringCfnResourceTypestringCfnResourceType*string #
AWS resource type.
chefConfigurationmay be undefinedIResolvable | CfnStack.ChefConfigurationPropertychef_configurationmay be undefinedtyping.Union[IResolvable, ChefConfigurationProperty]chefConfigurationmay be undefinedIResolvableChefConfigurationmay be undefinedIResolvableChefConfigurationmay be undefinedinterface{} #
A `ChefConfiguration` object that specifies whether to enable Berkshelf and the Berkshelf version on Chef 11.10 stacks. For more information, see Create a New Stack .
cloneAppIdsmay be undefinedstring[]clone_app_idsmay be undefinedtyping.List[str]cloneAppIdsmay be undefinedList<String>CloneAppIdsmay be undefinedstring[]CloneAppIdsmay be undefined*[]*string #
If you're cloning an OpsWorks stack, a list of OpsWorks application stack IDs from the source stack to include in the cloned stack.
clonePermissionsmay be undefinedboolean | IResolvableclone_permissionsmay be undefinedtyping.Union[bool, IResolvable]clonePermissionsmay be undefinedBooleanClonePermissionsmay be undefinedboolClonePermissionsmay be undefinedinterface{} #
If you're cloning an OpsWorks stack, indicates whether to clone the source stack's permissions.
configurationManagermay be undefinedIResolvable | CfnStack.StackConfigurationManagerPropertyconfiguration_managermay be undefinedtyping.Union[IResolvable, StackConfigurationManagerProperty]configurationManagermay be undefinedIResolvableConfigurationManagermay be undefinedIResolvableConfigurationManagermay be undefinedinterface{} #
The configuration manager.
creationStackstring[]creation_stacktyping.List[str]creationStackList<String>CreationStackstring[]CreationStack*[]*string #
customCookbooksSourcemay be undefinedIResolvable | CfnStack.SourcePropertycustom_cookbooks_sourcemay be undefinedtyping.Union[IResolvable, SourceProperty]customCookbooksSourcemay be undefinedIResolvableCustomCookbooksSourcemay be undefinedIResolvableCustomCookbooksSourcemay be undefinedinterface{} #
Contains the information required to retrieve an app or cookbook from a repository.
customJsonanycustom_jsonAnycustomJsonObjectCustomJsonobjectCustomJsoninterface{} #
A string that contains user-defined, custom JSON.
defaultAvailabilityZonemay be undefinedstringdefault_availability_zonemay be undefinedstrdefaultAvailabilityZonemay be undefinedStringDefaultAvailabilityZonemay be undefinedstringDefaultAvailabilityZonemay be undefined*string #
The stack's default Availability Zone, which must be in the specified region.
defaultInstanceProfileArnstringdefault_instance_profile_arnstrdefaultInstanceProfileArnStringDefaultInstanceProfileArnstringDefaultInstanceProfileArn*string #
The Amazon Resource Name (ARN) of an IAM profile that is the default profile for all of the stack's EC2 instances.
defaultOsmay be undefinedstringdefault_osmay be undefinedstrdefaultOsmay be undefinedStringDefaultOsmay be undefinedstringDefaultOsmay be undefined*string #
The stack's default operating system, which is installed on every instance unless you specify a different operating system when you create the instance.
defaultRootDeviceTypemay be undefinedstringdefault_root_device_typemay be undefinedstrdefaultRootDeviceTypemay be undefinedStringDefaultRootDeviceTypemay be undefinedstringDefaultRootDeviceTypemay be undefined*string #
The default root device type.
defaultSshKeyNamemay be undefinedstringdefault_ssh_key_namemay be undefinedstrdefaultSshKeyNamemay be undefinedStringDefaultSshKeyNamemay be undefinedstringDefaultSshKeyNamemay be undefined*string #
A default Amazon EC2 key pair name.
defaultSubnetIdmay be undefinedstringdefault_subnet_idmay be undefinedstrdefaultSubnetIdmay be undefinedStringDefaultSubnetIdmay be undefinedstringDefaultSubnetIdmay be undefined*string #
The stack's default subnet ID.
ecsClusterArnmay be undefinedstringecs_cluster_arnmay be undefinedstrecsClusterArnmay be undefinedStringEcsClusterArnmay be undefinedstringEcsClusterArnmay be undefined*string #
The Amazon Resource Name (ARN) of the ( Amazon ECS ) cluster to register with the OpsWorks stack.
elasticIpsmay be undefinedIResolvable | IResolvable | CfnStack.ElasticIpProperty[]elastic_ipsmay be undefinedtyping.Union[IResolvable, typing.List[typing.Union[IResolvable, ElasticIpProperty]]]elasticIpsmay be undefinedIResolvableElasticIpsmay be undefinedIResolvableElasticIpsmay be undefinedinterface{} #
A list of Elastic IP addresses to register with the OpsWorks stack.
hostnameThememay be undefinedstringhostname_thememay be undefinedstrhostnameThememay be undefinedStringHostnameThememay be undefinedstringHostnameThememay be undefined*string #
The stack's host name theme, with spaces replaced by underscores.
logicalIdstringlogical_idstrlogicalIdStringLogicalIdstringLogicalId*string #
The logical ID for this CloudFormation stack element.

The logical ID of the element is calculated from the path of the resource node in the construct tree.

To override this value, use overrideLogicalId(newLogicalId).

namestringnamestrnameStringNamestringName*string #
The stack name.
nodeNodenodeNodenodeNodeNodeNodeNodeNode #
The tree node.
rdsDbInstancesmay be undefinedIResolvable | IResolvable | CfnStack.RdsDbInstanceProperty[]rds_db_instancesmay be undefinedtyping.Union[IResolvable, typing.List[typing.Union[IResolvable, RdsDbInstanceProperty]]]rdsDbInstancesmay be undefinedIResolvableRdsDbInstancesmay be undefinedIResolvableRdsDbInstancesmay be undefinedinterface{} #
The Amazon Relational Database Service ( Amazon RDS ) database instance to register with the OpsWorks stack.
refstringrefstrrefStringRefstringRef*string #
Return a string that will be resolved to a CloudFormation `{ Ref }` for this element.

If, by any chance, the intrinsic reference of a resource is not a string, you could coerce it to an IResolvable through Lazy.any({ produce: resource.ref }).

serviceRoleArnstringservice_role_arnstrserviceRoleArnStringServiceRoleArnstringServiceRoleArn*string #
The stack's IAM role, which allows OpsWorks Stacks to work with AWS resources on your behalf.
sourceStackIdmay be undefinedstringsource_stack_idmay be undefinedstrsourceStackIdmay be undefinedStringSourceStackIdmay be undefinedstringSourceStackIdmay be undefined*string #
If you're cloning an OpsWorks stack, the stack ID of the source OpsWorks stack to clone.
stackStackstackStackstackStackStackStackStackStack #
The stack in which this element is defined.

CfnElements must be defined within a stack scope (directly or indirectly).

A reference to a Stack resource.
Tag Manager which manages the tags for this resource.
tagsRawmay be undefinedCfnTag[]tags_rawmay be undefinedtyping.List[CfnTag]tagsRawmay be undefinedList<CfnTag>TagsRawmay be undefinedCfnTag[]TagsRawmay be undefined*[]CfnTag #
A map that contains tag keys and tag values that are attached to a stack or layer.
useCustomCookbooksmay be undefinedboolean | IResolvableuse_custom_cookbooksmay be undefinedtyping.Union[bool, IResolvable]useCustomCookbooksmay be undefinedBooleanUseCustomCookbooksmay be undefinedboolUseCustomCookbooksmay be undefinedinterface{} #
Whether the stack uses custom cookbooks.
useOpsworksSecurityGroupsmay be undefinedboolean | IResolvableuse_opsworks_security_groupsmay be undefinedtyping.Union[bool, IResolvable]useOpsworksSecurityGroupsmay be undefinedBooleanUseOpsworksSecurityGroupsmay be undefinedboolUseOpsworksSecurityGroupsmay be undefinedinterface{} #
Whether to associate the OpsWorks Stacks built-in security groups with the stack's layers.
vpcIdmay be undefinedstringvpc_idmay be undefinedstrvpcIdmay be undefinedStringVpcIdmay be undefinedstringVpcIdmay be undefined*string #
The ID of the VPC that the stack is to be launched into.

Methods ​

addDeletionOverride(path: string): voiddef add_deletion_override(self, path: str) -> Nonepublic void addDeletionOverride(String path)public void AddDeletionOverride(string path)func AddDeletionOverride(Path *string) #
Syntactic sugar for `addOverride(path, undefined)`.
1 parameter

Parameters

  • pathpathpathpathPath — The path of the value to delete.
addDependency(target: CfnResource): voiddef add_dependency(self, target: CfnResource) -> Nonepublic void addDependency(CfnResource target)public void AddDependency(CfnResource target)func AddDependency(Target CfnResource) deprecated #
Use `addResourceDependency` instead.

This method has been renamed to addResourceDependency to more clearly set it apart from construct.node.addDependency. See the documentation of that function for more details.

addDependsOn(target: CfnResource): voiddef add_depends_on(self, target: CfnResource) -> Nonepublic void addDependsOn(CfnResource target)public void AddDependsOn(CfnResource target)func AddDependsOn(Target CfnResource) deprecated #
Use `addResourceDependency` instead.
notes

This can be used for resources across stacks (or nested stack) boundaries and the dependency will automatically be transferred to the relevant scope.

This method has been renamed to addResourceDependency, which makes it more clear that this method operates at a different level from the construct-level construct.node.addDependency() mechanism.

addMetadata(key: string, value: any): voiddef add_metadata(self, key: str, value: Any) -> Nonepublic void addMetadata(String key, Object value)public void AddMetadata(string key, object value)func AddMetadata(Key *string, Value interface{}) #
Add a value to the CloudFormation Resource Metadata.
addOverride(path: string, value: any): voiddef add_override(self, path: str, value: Any) -> Nonepublic void addOverride(String path, Object value)public void AddOverride(string path, object value)func AddOverride(Path *string, Value interface{}) #
Adds an override to the synthesized CloudFormation resource.
notes · 2 parameters

To add a property override, either use addPropertyOverride or prefix path with "Properties." (i.e. Properties.TopicName).

If the override is nested, separate each nested level using a dot (.) in the path parameter. If there is an array as part of the nesting, specify the index in the path.

To include a literal . in the property name, prefix with a \. In most programming languages you will need to write this as "\\." because the \ itself will need to be escaped.

For example,

typescript
cfnResource.addOverride('Properties.GlobalSecondaryIndexes.0.Projection.NonKeyAttributes', ['myattribute']);
cfnResource.addOverride('Properties.GlobalSecondaryIndexes.1.ProjectionType', 'INCLUDE');

would add the overrides

json
"Properties": {
  "GlobalSecondaryIndexes": [
    {
      "Projection": {
        "NonKeyAttributes": [ "myattribute" ]
        ...
      }
      ...
    },
    {
      "ProjectionType": "INCLUDE"
      ...
    },
  ]
  ...
}

The value argument to addOverride will not be processed or translated in any way. Pass raw JSON values in here with the correct capitalization for CloudFormation. If you pass CDK classes or structs, they will be rendered with lowercased key names, and CloudFormation will reject the template.

Parameters

  • pathpathpathpathPath — - The path of the property, you can use dot notation to override values in complex types.
  • valuevaluevaluevalueValue — - The value.
addPropertyDeletionOverride(propertyPath: string): voiddef add_property_deletion_override(self, property_path: str) -> Nonepublic void addPropertyDeletionOverride(String propertyPath)public void AddPropertyDeletionOverride(string propertyPath)func AddPropertyDeletionOverride(PropertyPath *string) #
Adds an override that deletes the value of a property from the resource definition.
1 parameter

Parameters

  • propertyPathproperty_pathpropertyPathpropertyPathPropertyPath — The path to the property.
addPropertyOverride(propertyPath: string, value: any): voiddef add_property_override(self, property_path: str, value: Any) -> Nonepublic void addPropertyOverride(String propertyPath, Object value)public void AddPropertyOverride(string propertyPath, object value)func AddPropertyOverride(PropertyPath *string, Value interface{}) #
Adds an override to a resource property.

Syntactic sugar for addOverride("Properties.<...>", value).

2 parameters

Parameters

  • propertyPathproperty_pathpropertyPathpropertyPathPropertyPath — The path of the property.
  • valuevaluevaluevalueValue — The value.
addResourceDependency(target: CfnResource, reason?: string): voiddef add_resource_dependency(self, target: CfnResource, reason: typing.Optional[str] = None) -> Nonepublic void addResourceDependency(CfnResource target, String reason)public void AddResourceDependency(CfnResource target, string? reason = null)func AddResourceDependency(Target CfnResource, Reason *string) #
Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.
notes

This can be used for resources across stacks (or nested stack) boundaries and the dependency will automatically be transferred to the relevant scope.

This method only adds dependencies between L1 resources. If you are looking for a generic construct-to-construct dependency mechanism that works for all constructs including L2s, use construct.node.addDependency instead.

applyCrossStackReferenceStrength(strength: ReferenceStrength): voiddef apply_cross_stack_reference_strength(self, strength: ReferenceStrength) -> Nonepublic void applyCrossStackReferenceStrength(ReferenceStrength strength)public void ApplyCrossStackReferenceStrength(ReferenceStrength strength)func ApplyCrossStackReferenceStrength(Strength ReferenceStrength) #
Sets the cross-stack reference strength for this resource.

When set, any cross-stack reference to this resource will use the specified strength instead of the global default from the consuming stack's context.

1 parameter

Parameters

  • strengthstrengthstrengthstrengthStrength — - The reference strength to use for this resource.
applyRemovalPolicy(policy?: RemovalPolicy, options?: RemovalPolicyOptions): voiddef apply_removal_policy(self, policy: typing.Optional[RemovalPolicy] = None, options: typing.Optional[RemovalPolicyOptions] = None) -> Nonepublic void applyRemovalPolicy(RemovalPolicy policy, RemovalPolicyOptions options)public void ApplyRemovalPolicy(RemovalPolicy? policy = null, RemovalPolicyOptions? options = null)func ApplyRemovalPolicy(Policy RemovalPolicy, Options RemovalPolicyOptions) #
Sets the deletion policy of the resource based on the removal policy specified.
notes

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN). In some cases, a snapshot can be taken of the resource prior to deletion (RemovalPolicy.SNAPSHOT). A list of resources that support this policy can be found in the following link:

cfnPropertyName(cdkPropertyName: string): stringdef cfn_property_name(self, cdk_property_name: str) -> strpublic String cfnPropertyName(String cdkPropertyName)public string CfnPropertyName(string cdkPropertyName)func CfnPropertyName(CdkPropertyName *string) *string #
getAtt(attributeName: string, typeHint?: ResolutionTypeHint): Referencedef get_att(self, attribute_name: str, type_hint: typing.Optional[ResolutionTypeHint] = None) -> Referencepublic Reference getAtt(String attributeName, ResolutionTypeHint typeHint)public Reference GetAtt(string attributeName, ResolutionTypeHint? typeHint = null)func GetAtt(AttributeName *string, TypeHint ResolutionTypeHint) Reference #
Returns a token for an runtime attribute of this resource.

Ideally, use generated attribute accessors (e.g. resource.arn), but this can be used for future compatibility in case there is no generated attribute.

1 parameter

Parameters

  • attributeNameattribute_nameattributeNameattributeNameAttributeName — The name of the attribute.
getMetadata(key: string): anydef get_metadata(self, key: str) -> Anypublic Object getMetadata(String key)public object GetMetadata(string key)func GetMetadata(Key *string) interface{} #
Retrieve a value value from the CloudFormation Resource Metadata.
inspect(inspector: TreeInspector): voiddef inspect(self, inspector: TreeInspector) -> Nonepublic void inspect(TreeInspector inspector)public void Inspect(TreeInspector inspector)func Inspect(Inspector TreeInspector) #
Examines the CloudFormation resource and discloses attributes.
1 parameter

Parameters

  • inspectorinspectorinspectorinspectorInspector — tree inspector to collect and process attributes.
isCfnElement(x: any): boolean@staticmethod def is_cfn_element(x: Any) -> boolpublic static Boolean isCfnElement(Object x)public static bool IsCfnElement(object x)func IsCfnElement(X interface{}) *bool static #
Returns `true` if a construct is a stack element (i.e. part of the synthesized cloudformation template).

Uses duck-typing instead of instanceof to allow stack elements from different versions of this library to be included in the same stack.

returns

Returns: The construct as a stack element or undefined if it is not a stack element.

isCfnResource(x: any): boolean@staticmethod def is_cfn_resource(x: Any) -> boolpublic static Boolean isCfnResource(Object x)public static bool IsCfnResource(object x)func IsCfnResource(X interface{}) *bool static #
Check whether the given object is a CfnResource.
isCfnStack(x: any): boolean@staticmethod def is_cfn_stack(x: Any) -> boolpublic static Boolean isCfnStack(Object x)public static bool IsCfnStack(object x)func IsCfnStack(X interface{}) *bool static #
Checks whether the given object is a CfnStack.
isConstruct(x: any): boolean@staticmethod def is_construct(x: Any) -> boolpublic static Boolean isConstruct(Object x)public static bool IsConstruct(object x)func IsConstruct(X interface{}) *bool static #
Checks if `x` is a construct.
notes · 1 parameter · returns

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

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs 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 constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

Parameters

  • xxxxX — Any object.

Returns: true if x is an object created from a class which extends Construct.

obtainDependencies(): Stack | CfnResource[]def obtain_dependencies(self, ) -> typing.List[typing.Union[Stack, CfnResource]]public List<Stack> obtainDependencies()public Stack[] ObtainDependencies()func ObtainDependencies() *[]interface{} #
Retrieves an array of resources and stacks this resource depends on.

For resources depended on directly, returns the CfnResource object. For dependencies on other stacks, returns the Stack object. The order of the array is not guaranteed.

overrideLogicalId(newLogicalId: string): voiddef override_logical_id(self, new_logical_id: str) -> Nonepublic void overrideLogicalId(String newLogicalId)public void OverrideLogicalId(string newLogicalId)func OverrideLogicalId(NewLogicalId *string) #
Overrides the auto-generated logical ID with a specific ID.
1 parameter

Parameters

  • newLogicalIdnew_logical_idnewLogicalIdnewLogicalIdNewLogicalId — The new logical ID to use for this stack element.
removeDependency(target: CfnResource): voiddef remove_dependency(self, target: CfnResource) -> Nonepublic void removeDependency(CfnResource target)public void RemoveDependency(CfnResource target)func RemoveDependency(Target CfnResource) deprecated #
Use `removeResourceDependency` instead

This can be used for resources across stacks (including nested stacks) and the dependency will automatically be removed from the relevant scope.

removeResourceDependency(target: CfnResource): voiddef remove_resource_dependency(self, target: CfnResource) -> Nonepublic void removeResourceDependency(CfnResource target)public void RemoveResourceDependency(CfnResource target)func RemoveResourceDependency(Target CfnResource) #
Indicates that this resource no longer depends on another resource.

This can be used for resources across stacks (including nested stacks) and the dependency will automatically be removed from the relevant scope.

replaceDependency(target: CfnResource, newTarget: CfnResource): voiddef replace_dependency(self, target: CfnResource, new_target: CfnResource) -> Nonepublic void replaceDependency(CfnResource target, CfnResource newTarget)public void ReplaceDependency(CfnResource target, CfnResource newTarget)func ReplaceDependency(Target CfnResource, NewTarget CfnResource) #
Replaces one dependency with another.
2 parameters

Parameters

  • targettargettargettargetTarget — The dependency to replace.
  • newTargetnew_targetnewTargetnewTargetNewTarget — The new dependency to add.
toString(): stringdef to_string(self, ) -> strpublic String toString()public string ToString()func ToString() *string #
Returns a string representation of this construct.
returns

Returns: a string representation of this resource

with(...mixins: IMixin[]): IConstructdef with(self, mixins: IMixin) -> IConstructpublic IConstruct with(IMixin mixins)public IConstruct With(IMixin mixins)func With(Mixins IMixin) IConstruct #
Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.