aws-cdk-lib.aws_opsworks.CfnStack

class CfnStack (construct)

LanguageType name
.NETAmazon.CDK.AWS.OpsWorks.CfnStack
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsopsworks#CfnStack
Javasoftware.amazon.awscdk.services.opsworks.CfnStack
Pythonaws_cdk.aws_opsworks.CfnStack
TypeScript aws-cdk-lib » aws_opsworks » CfnStack

Implements IConstruct, IDependable, IInspectable

A CloudFormation AWS::OpsWorks::Stack.

Creates a new stack. For more information, see Create a New Stack .

Required Permissions : To use this action, an IAM user must have an attached policy that explicitly grants permissions. For more information about user permissions, see Managing User Permissions .

Example

// 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',
});

Initializer

new CfnStack(scope: Construct, id: string, props: CfnStackProps)

Parameters

  • scope Construct — - scope in which this resource is defined.
  • id string — - scoped id of the resource.
  • props CfnStackProps — - resource properties.

Create a new AWS::OpsWorks::Stack.

Construct Props

NameTypeDescription
defaultInstanceProfileArnstringThe Amazon Resource Name (ARN) of an IAM profile that is the default profile for all of the stack's EC2 instances.
namestringThe stack name.
serviceRoleArnstringThe stack's IAM role, which allows AWS OpsWorks Stacks to work with AWS resources on your behalf.
agentVersion?stringThe default AWS OpsWorks Stacks agent version. You have the following options:.
attributes?IResolvable | { [string]: string }One or more user-defined key-value pairs to be added to the stack attributes.
chefConfiguration?IResolvable | ChefConfigurationPropertyA 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 .
cloneAppIds?string[]If you're cloning an AWS OpsWorks stack, a list of AWS OpsWorks application stack IDs from the source stack to include in the cloned stack.
clonePermissions?boolean | IResolvableIf you're cloning an AWS OpsWorks stack, indicates whether to clone the source stack's permissions.
configurationManager?IResolvable | StackConfigurationManagerPropertyThe configuration manager.
customCookbooksSource?IResolvable | SourcePropertyContains the information required to retrieve an app or cookbook from a repository.
customJson?anyA string that contains user-defined, custom JSON.
defaultAvailabilityZone?stringThe stack's default Availability Zone, which must be in the specified region.
defaultOs?stringThe stack's default operating system, which is installed on every instance unless you specify a different operating system when you create the instance.
defaultRootDeviceType?stringThe default root device type.
defaultSshKeyName?stringA default Amazon EC2 key pair name.
defaultSubnetId?stringThe stack's default subnet ID.
ecsClusterArn?stringThe Amazon Resource Name (ARN) of the Amazon Elastic Container Service ( Amazon ECS ) cluster to register with the AWS OpsWorks stack.
elasticIps?IResolvable | IResolvable | ElasticIpProperty[]A list of Elastic IP addresses to register with the AWS OpsWorks stack.
hostnameTheme?stringThe stack's host name theme, with spaces replaced by underscores.
rdsDbInstances?IResolvable | IResolvable | RdsDbInstanceProperty[]The Amazon Relational Database Service ( Amazon RDS ) database instance to register with the AWS OpsWorks stack.
sourceStackId?stringIf you're cloning an AWS OpsWorks stack, the stack ID of the source AWS OpsWorks stack to clone.
tags?CfnTag[]A map that contains tag keys and tag values that are attached to a stack or layer.
useCustomCookbooks?boolean | IResolvableWhether the stack uses custom cookbooks.
useOpsworksSecurityGroups?boolean | IResolvableWhether to associate the AWS OpsWorks Stacks built-in security groups with the stack's layers.
vpcId?stringThe ID of the VPC that the stack is to be launched into.

defaultInstanceProfileArn

Type: string

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 .


name

Type: string

The stack name.

Stack names can be a maximum of 64 characters.


serviceRoleArn

Type: string

The stack's IAM role, which allows AWS 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 .


agentVersion?

Type: string (optional)

The default AWS OpsWorks Stacks agent version. You have the following options:.

  • Auto-update - Set this parameter to LATEST . AWS 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. AWS 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.


attributes?

Type: IResolvable | { [string]: string } (optional)

One or more user-defined key-value pairs to be added to the stack attributes.


chefConfiguration?

Type: IResolvable | ChefConfigurationProperty (optional)

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 .


cloneAppIds?

Type: string[] (optional)

If you're cloning an AWS OpsWorks stack, a list of AWS OpsWorks application stack IDs from the source stack to include in the cloned stack.


clonePermissions?

Type: boolean | IResolvable (optional)

If you're cloning an AWS OpsWorks stack, indicates whether to clone the source stack's permissions.


configurationManager?

Type: IResolvable | StackConfigurationManagerProperty (optional)

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.


customCookbooksSource?

Type: IResolvable | SourceProperty (optional)

Contains the information required to retrieve an app or cookbook from a repository.

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


customJson?

Type: any (optional)

A string that contains user-defined, custom JSON.

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 .


defaultAvailabilityZone?

Type: string (optional)

The stack's default Availability Zone, which must be in the specified region.

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.


defaultOs?

Type: string (optional)

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

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 AWS OpsWorks Stacks Operating Systems .


defaultRootDeviceType?

Type: string (optional)

The default root device type.

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 .


defaultSshKeyName?

Type: string (optional)

A default Amazon EC2 key pair name.

The default value is none. If you specify a key pair name, AWS 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 .


defaultSubnetId?

Type: string (optional)

The stack's default subnet ID.

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.


ecsClusterArn?

Type: string (optional)

The Amazon Resource Name (ARN) of the Amazon Elastic Container Service ( Amazon ECS ) cluster to register with the AWS OpsWorks stack.

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


elasticIps?

Type: IResolvable | IResolvable | ElasticIpProperty[] (optional)

A list of Elastic IP addresses to register with the AWS OpsWorks stack.

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


hostnameTheme?

Type: string (optional)

The stack's host name theme, with spaces replaced by underscores.

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.


rdsDbInstances?

Type: IResolvable | IResolvable | RdsDbInstanceProperty[] (optional)

The Amazon Relational Database Service ( Amazon RDS ) database instance to register with the AWS OpsWorks stack.

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


sourceStackId?

Type: string (optional)

If you're cloning an AWS OpsWorks stack, the stack ID of the source AWS OpsWorks stack to clone.


tags?

Type: CfnTag[] (optional)

A map that contains tag keys and tag values that are attached to a stack or layer.

  • 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.

useCustomCookbooks?

Type: boolean | IResolvable (optional)

Whether the stack uses custom cookbooks.


useOpsworksSecurityGroups?

Type: boolean | IResolvable (optional)

Whether to associate the AWS OpsWorks Stacks built-in security groups with the stack's layers.

AWS 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 - AWS 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 - AWS 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 .


vpcId?

Type: string (optional)

The ID of the VPC that the stack is to be launched into.

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, AWS OpsWorks Stacks infers the value of the other parameter. If you specify neither parameter, AWS 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 AWS 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

NameTypeDescription
cfnOptionsICfnResourceOptionsOptions for this resource, such as condition, update policy etc.
cfnProperties{ [string]: any }
cfnResourceTypestringAWS resource type.
creationStackstring[]
customJsonanyA string that contains user-defined, custom JSON.
defaultInstanceProfileArnstringThe Amazon Resource Name (ARN) of an IAM profile that is the default profile for all of the stack's EC2 instances.
logicalIdstringThe logical ID for this CloudFormation stack element.
namestringThe stack name.
nodeNodeThe tree node.
refstringReturn a string that will be resolved to a CloudFormation { Ref } for this element.
serviceRoleArnstringThe stack's IAM role, which allows AWS OpsWorks Stacks to work with AWS resources on your behalf.
stackStackThe stack in which this element is defined.
tagsTagManagerA map that contains tag keys and tag values that are attached to a stack or layer.
agentVersion?stringThe default AWS OpsWorks Stacks agent version. You have the following options:.
attributes?IResolvable | { [string]: string }One or more user-defined key-value pairs to be added to the stack attributes.
chefConfiguration?IResolvable | ChefConfigurationPropertyA 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 .
cloneAppIds?string[]If you're cloning an AWS OpsWorks stack, a list of AWS OpsWorks application stack IDs from the source stack to include in the cloned stack.
clonePermissions?boolean | IResolvableIf you're cloning an AWS OpsWorks stack, indicates whether to clone the source stack's permissions.
configurationManager?IResolvable | StackConfigurationManagerPropertyThe configuration manager.
customCookbooksSource?IResolvable | SourcePropertyContains the information required to retrieve an app or cookbook from a repository.
defaultAvailabilityZone?stringThe stack's default Availability Zone, which must be in the specified region.
defaultOs?stringThe stack's default operating system, which is installed on every instance unless you specify a different operating system when you create the instance.
defaultRootDeviceType?stringThe default root device type.
defaultSshKeyName?stringA default Amazon EC2 key pair name.
defaultSubnetId?stringThe stack's default subnet ID.
ecsClusterArn?stringThe Amazon Resource Name (ARN) of the Amazon Elastic Container Service ( Amazon ECS ) cluster to register with the AWS OpsWorks stack.
elasticIps?IResolvable | IResolvable | ElasticIpProperty[]A list of Elastic IP addresses to register with the AWS OpsWorks stack.
hostnameTheme?stringThe stack's host name theme, with spaces replaced by underscores.
rdsDbInstances?IResolvable | IResolvable | RdsDbInstanceProperty[]The Amazon Relational Database Service ( Amazon RDS ) database instance to register with the AWS OpsWorks stack.
sourceStackId?stringIf you're cloning an AWS OpsWorks stack, the stack ID of the source AWS OpsWorks stack to clone.
useCustomCookbooks?boolean | IResolvableWhether the stack uses custom cookbooks.
useOpsworksSecurityGroups?boolean | IResolvableWhether to associate the AWS OpsWorks Stacks built-in security groups with the stack's layers.
vpcId?stringThe ID of the VPC that the stack is to be launched into.
static CFN_RESOURCE_TYPE_NAMEstringThe CloudFormation resource type name for this resource class.

cfnOptions

Type: ICfnResourceOptions

Options for this resource, such as condition, update policy etc.


cfnProperties

Type: { [string]: any }


cfnResourceType

Type: string

AWS resource type.


creationStack

Type: string[]


customJson

Type: any

A string that contains user-defined, custom JSON.

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 .


defaultInstanceProfileArn

Type: string

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 .


logicalId

Type: 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).


name

Type: string

The stack name.

Stack names can be a maximum of 64 characters.


node

Type: Node

The tree node.


ref

Type: 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 }).


serviceRoleArn

Type: string

The stack's IAM role, which allows AWS 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 .


stack

Type: Stack

The stack in which this element is defined.

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


tags

Type: TagManager

A map that contains tag keys and tag values that are attached to a stack or layer.

  • 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.

agentVersion?

Type: string (optional)

The default AWS OpsWorks Stacks agent version. You have the following options:.

  • Auto-update - Set this parameter to LATEST . AWS 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. AWS 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.


attributes?

Type: IResolvable | { [string]: string } (optional)

One or more user-defined key-value pairs to be added to the stack attributes.


chefConfiguration?

Type: IResolvable | ChefConfigurationProperty (optional)

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 .


cloneAppIds?

Type: string[] (optional)

If you're cloning an AWS OpsWorks stack, a list of AWS OpsWorks application stack IDs from the source stack to include in the cloned stack.


clonePermissions?

Type: boolean | IResolvable (optional)

If you're cloning an AWS OpsWorks stack, indicates whether to clone the source stack's permissions.


configurationManager?

Type: IResolvable | StackConfigurationManagerProperty (optional)

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.


customCookbooksSource?

Type: IResolvable | SourceProperty (optional)

Contains the information required to retrieve an app or cookbook from a repository.

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


defaultAvailabilityZone?

Type: string (optional)

The stack's default Availability Zone, which must be in the specified region.

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.


defaultOs?

Type: string (optional)

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

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 AWS OpsWorks Stacks Operating Systems .


defaultRootDeviceType?

Type: string (optional)

The default root device type.

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 .


defaultSshKeyName?

Type: string (optional)

A default Amazon EC2 key pair name.

The default value is none. If you specify a key pair name, AWS 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 .


defaultSubnetId?

Type: string (optional)

The stack's default subnet ID.

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.


ecsClusterArn?

Type: string (optional)

The Amazon Resource Name (ARN) of the Amazon Elastic Container Service ( Amazon ECS ) cluster to register with the AWS OpsWorks stack.

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


elasticIps?

Type: IResolvable | IResolvable | ElasticIpProperty[] (optional)

A list of Elastic IP addresses to register with the AWS OpsWorks stack.

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


hostnameTheme?

Type: string (optional)

The stack's host name theme, with spaces replaced by underscores.

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.


rdsDbInstances?

Type: IResolvable | IResolvable | RdsDbInstanceProperty[] (optional)

The Amazon Relational Database Service ( Amazon RDS ) database instance to register with the AWS OpsWorks stack.

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


sourceStackId?

Type: string (optional)

If you're cloning an AWS OpsWorks stack, the stack ID of the source AWS OpsWorks stack to clone.


useCustomCookbooks?

Type: boolean | IResolvable (optional)

Whether the stack uses custom cookbooks.


useOpsworksSecurityGroups?

Type: boolean | IResolvable (optional)

Whether to associate the AWS OpsWorks Stacks built-in security groups with the stack's layers.

AWS 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 - AWS 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 - AWS 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 .


vpcId?

Type: string (optional)

The ID of the VPC that the stack is to be launched into.

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, AWS OpsWorks Stacks infers the value of the other parameter. If you specify neither parameter, AWS 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 AWS OpsWorks Stacks with a VPC, see Running a Stack in a VPC . For more information about default VPC and EC2-Classic, see Supported Platforms .


static CFN_RESOURCE_TYPE_NAME

Type: string

The CloudFormation resource type name for this resource class.

Methods

NameDescription
addDeletionOverride(path)Syntactic sugar for addOverride(path, undefined).
addDependency(target)Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.
addDependsOn(target)⚠️Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.
addMetadata(key, value)Add a value to the CloudFormation Resource Metadata.
addOverride(path, value)Adds an override to the synthesized CloudFormation resource.
addPropertyDeletionOverride(propertyPath)Adds an override that deletes the value of a property from the resource definition.
addPropertyOverride(propertyPath, value)Adds an override to a resource property.
applyRemovalPolicy(policy?, options?)Sets the deletion policy of the resource based on the removal policy specified.
getAtt(attributeName, typeHint?)Returns a token for an runtime attribute of this resource.
getMetadata(key)Retrieve a value value from the CloudFormation Resource Metadata.
inspect(inspector)Examines the CloudFormation resource and discloses attributes.
obtainDependencies()Retrieves an array of resources this resource depends on.
obtainResourceDependencies()Get a shallow copy of dependencies between this resource and other resources in the same stack.
overrideLogicalId(newLogicalId)Overrides the auto-generated logical ID with a specific ID.
removeDependency(target)Indicates that this resource no longer depends on another resource.
replaceDependency(target, newTarget)Replaces one dependency with another.
toString()Returns a string representation of this construct.
protected renderProperties(props)

addDeletionOverride(path)

public addDeletionOverride(path: string): void

Parameters

  • path string — The path of the value to delete.

Syntactic sugar for addOverride(path, undefined).


addDependency(target)

public addDependency(target: CfnResource): void

Parameters

  • target CfnResource

Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.

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


addDependsOn(target)⚠️

public addDependsOn(target: CfnResource): void

⚠️ Deprecated: use addDependency

Parameters

  • target CfnResource

Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.


addMetadata(key, value)

public addMetadata(key: string, value: any): void

Parameters

  • key string
  • value any

Add a value to the CloudFormation Resource Metadata.

See also: [https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html

Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html

Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.)


addOverride(path, value)

public addOverride(path: string, value: any): void

Parameters

  • path string — - The path of the property, you can use dot notation to override values in complex types.
  • value any — - The value.

Adds an override to the synthesized CloudFormation resource.

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,

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

would add the overrides

"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.


addPropertyDeletionOverride(propertyPath)

public addPropertyDeletionOverride(propertyPath: string): void

Parameters

  • propertyPath string — The path to the property.

Adds an override that deletes the value of a property from the resource definition.


addPropertyOverride(propertyPath, value)

public addPropertyOverride(propertyPath: string, value: any): void

Parameters

  • propertyPath string — The path of the property.
  • value any — The value.

Adds an override to a resource property.

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


applyRemovalPolicy(policy?, options?)

public applyRemovalPolicy(policy?: RemovalPolicy, options?: RemovalPolicyOptions): void

Parameters

  • policy RemovalPolicy
  • options RemovalPolicyOptions

Sets the deletion policy of the resource based on the removal policy specified.

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:

See also: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html#aws-attribute-deletionpolicy-options


getAtt(attributeName, typeHint?)

public getAtt(attributeName: string, typeHint?: ResolutionTypeHint): Reference

Parameters

  • attributeName string — The name of the attribute.
  • typeHint ResolutionTypeHint

Returns

  • 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.


getMetadata(key)

public getMetadata(key: string): any

Parameters

  • key string

Returns

  • any

Retrieve a value value from the CloudFormation Resource Metadata.

See also: [https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html

Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html

Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.)


inspect(inspector)

public inspect(inspector: TreeInspector): void

Parameters

  • inspector TreeInspector — - tree inspector to collect and process attributes.

Examines the CloudFormation resource and discloses attributes.


obtainDependencies()

public obtainDependencies(): Stack &#124; CfnResource[]

Returns

  • Stack | CfnResource[]

Retrieves an array of resources this resource depends on.

This assembles dependencies on resources across stacks (including nested stacks) automatically.


obtainResourceDependencies()

public obtainResourceDependencies(): CfnResource[]

Returns

  • CfnResource[]

Get a shallow copy of dependencies between this resource and other resources in the same stack.


overrideLogicalId(newLogicalId)

public overrideLogicalId(newLogicalId: string): void

Parameters

  • newLogicalId string — The new logical ID to use for this stack element.

Overrides the auto-generated logical ID with a specific ID.


removeDependency(target)

public removeDependency(target: CfnResource): void

Parameters

  • 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, newTarget)

public replaceDependency(target: CfnResource, newTarget: CfnResource): void

Parameters

  • target CfnResource — The dependency to replace.
  • newTarget CfnResource — The new dependency to add.

Replaces one dependency with another.


toString()

public toString(): string

Returns

  • string

Returns a string representation of this construct.


protected renderProperties(props)

protected renderProperties(props: { [string]: any }): { [string]: any }

Parameters

  • props { [string]: any }

Returns

  • { [string]: any }