Class CfnStack
java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.CfnElement
software.amazon.awscdk.CfnRefElement
software.amazon.awscdk.CfnResource
software.amazon.awscdk.services.opsworks.CfnStack
- All Implemented Interfaces:
IEnvironmentAware,IInspectable,ITaggable,IStackRef,software.amazon.jsii.JsiiSerializable,software.constructs.IConstruct,software.constructs.IDependable
@Generated(value="jsii-pacmak/1.118.0 (build 02eec31)",
date="2025-11-04T09:27:46.144Z")
@Stability(Stable)
public class CfnStack
extends CfnResource
implements IInspectable, IStackRef, ITaggable
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-stack.html.
Example:
// 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();
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classA fluent builder forCfnStack.static interfaceExample:static interfaceExample:static interfaceExample:static interfaceExample:static interfaceExample:Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.IInspectable
IInspectable.Jsii$Default, IInspectable.Jsii$ProxyNested classes/interfaces inherited from interface software.amazon.awscdk.services.opsworks.IStackRef
IStackRef.Jsii$Default, IStackRef.Jsii$ProxyNested classes/interfaces inherited from interface software.amazon.awscdk.ITaggable
ITaggable.Jsii$Default, ITaggable.Jsii$Proxy -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe CloudFormation resource type name for this resource class. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCfnStack(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedCfnStack(software.amazon.jsii.JsiiObjectRef objRef) CfnStack(software.constructs.Construct scope, String id, CfnStackProps props) -
Method Summary
Modifier and TypeMethodDescriptionstatic IStackReffromStackId(software.constructs.Construct scope, String id, String stackId) Creates a new IStackRef from a stackId.The default OpsWorks Stacks agent version.One or more user-defined key-value pairs to be added to the stack attributes.AChefConfigurationobject that specifies whether to enable Berkshelf and the Berkshelf version on Chef 11.10 stacks.If you're cloning an OpsWorks stack, a list of OpsWorks application stack IDs from the source stack to include in the cloned stack.If you're cloning an OpsWorks stack, indicates whether to clone the source stack's permissions.The configuration manager.Contains the information required to retrieve an app or cookbook from a repository.A string that contains user-defined, custom JSON.The stack's default Availability Zone, which must be in the specified region.The Amazon Resource Name (ARN) of an IAM profile that is the default profile for all of the stack's EC2 instances.The stack's default operating system, which is installed on every instance unless you specify a different operating system when you create the instance.The default root device type.A default Amazon EC2 key pair name.The stack's default subnet ID.The Amazon Resource Name (ARN) of the Amazon Elastic Container Service ( Amazon ECS ) cluster to register with the OpsWorks stack.A list of Elastic IP addresses to register with the OpsWorks stack.The stack's host name theme, with spaces replaced by underscores.getName()The stack name.The Amazon Relational Database Service ( Amazon RDS ) database instance to register with the OpsWorks stack.The stack's IAM role, which allows OpsWorks Stacks to work with AWS resources on your behalf.If you're cloning an OpsWorks stack, the stack ID of the source OpsWorks stack to clone.A reference to a Stack resource.getTags()Tag Manager which manages the tags for this resource.A map that contains tag keys and tag values that are attached to a stack or layer.Whether the stack uses custom cookbooks.Whether to associate the OpsWorks Stacks built-in security groups with the stack's layers.getVpcId()The ID of the VPC that the stack is to be launched into.voidinspect(TreeInspector inspector) Examines the CloudFormation resource and discloses attributes.renderProperties(Map<String, Object> props) voidsetAgentVersion(String value) The default OpsWorks Stacks agent version.voidsetAttributes(Map<String, String> value) One or more user-defined key-value pairs to be added to the stack attributes.voidsetAttributes(IResolvable value) One or more user-defined key-value pairs to be added to the stack attributes.voidsetChefConfiguration(IResolvable value) AChefConfigurationobject that specifies whether to enable Berkshelf and the Berkshelf version on Chef 11.10 stacks.voidAChefConfigurationobject that specifies whether to enable Berkshelf and the Berkshelf version on Chef 11.10 stacks.voidsetCloneAppIds(List<String> value) If you're cloning an OpsWorks stack, a list of OpsWorks application stack IDs from the source stack to include in the cloned stack.voidsetClonePermissions(Boolean value) If you're cloning an OpsWorks stack, indicates whether to clone the source stack's permissions.voidsetClonePermissions(IResolvable value) If you're cloning an OpsWorks stack, indicates whether to clone the source stack's permissions.voidThe configuration manager.voidThe configuration manager.voidContains the information required to retrieve an app or cookbook from a repository.voidContains the information required to retrieve an app or cookbook from a repository.voidsetCustomJson(Object value) A string that contains user-defined, custom JSON.voidsetDefaultAvailabilityZone(String value) The stack's default Availability Zone, which must be in the specified region.voidThe Amazon Resource Name (ARN) of an IAM profile that is the default profile for all of the stack's EC2 instances.voidsetDefaultOs(String value) The stack's default operating system, which is installed on every instance unless you specify a different operating system when you create the instance.voidsetDefaultRootDeviceType(String value) The default root device type.voidsetDefaultSshKeyName(String value) A default Amazon EC2 key pair name.voidsetDefaultSubnetId(String value) The stack's default subnet ID.voidsetEcsClusterArn(String value) The Amazon Resource Name (ARN) of the Amazon Elastic Container Service ( Amazon ECS ) cluster to register with the OpsWorks stack.voidsetElasticIps(List<Object> value) A list of Elastic IP addresses to register with the OpsWorks stack.voidsetElasticIps(IResolvable value) A list of Elastic IP addresses to register with the OpsWorks stack.voidsetHostnameTheme(String value) The stack's host name theme, with spaces replaced by underscores.voidThe stack name.voidsetRdsDbInstances(List<Object> value) The Amazon Relational Database Service ( Amazon RDS ) database instance to register with the OpsWorks stack.voidsetRdsDbInstances(IResolvable value) The Amazon Relational Database Service ( Amazon RDS ) database instance to register with the OpsWorks stack.voidsetServiceRoleArn(String value) The stack's IAM role, which allows OpsWorks Stacks to work with AWS resources on your behalf.voidsetSourceStackId(String value) If you're cloning an OpsWorks stack, the stack ID of the source OpsWorks stack to clone.voidsetTagsRaw(List<CfnTag> value) A map that contains tag keys and tag values that are attached to a stack or layer.voidsetUseCustomCookbooks(Boolean value) Whether the stack uses custom cookbooks.voidsetUseCustomCookbooks(IResolvable value) Whether the stack uses custom cookbooks.voidWhether to associate the OpsWorks Stacks built-in security groups with the stack's layers.voidWhether to associate the OpsWorks Stacks built-in security groups with the stack's layers.voidThe ID of the VPC that the stack is to be launched into.Methods inherited from class software.amazon.awscdk.CfnResource
addDeletionOverride, addDependency, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getAtt, getCfnOptions, getCfnResourceType, getEnv, getMetadata, getUpdatedProperites, getUpdatedProperties, isCfnResource, obtainDependencies, obtainResourceDependencies, removeDependency, replaceDependency, shouldSynthesize, toString, validatePropertiesMethods inherited from class software.amazon.awscdk.CfnRefElement
getRefMethods inherited from class software.amazon.awscdk.CfnElement
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalIdMethods inherited from class software.constructs.Construct
getNode, isConstructMethods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface software.constructs.IConstruct
getNodeMethods inherited from interface software.amazon.awscdk.IEnvironmentAware
getEnvMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
-
-
Constructor Details
-
CfnStack
protected CfnStack(software.amazon.jsii.JsiiObjectRef objRef) -
CfnStack
protected CfnStack(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
CfnStack
@Stability(Stable) public CfnStack(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull CfnStackProps props) - Parameters:
scope- Scope in which this resource is defined. This parameter is required.id- Construct identifier for this resource (unique in its scope). This parameter is required.props- Resource properties. This parameter is required.
-
-
Method Details
-
fromStackId
@Stability(Stable) @NotNull public static IStackRef fromStackId(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String stackId) Creates a new IStackRef from a stackId.- Parameters:
scope- This parameter is required.id- This parameter is required.stackId- This parameter is required.
-
inspect
Examines the CloudFormation resource and discloses attributes.- Specified by:
inspectin interfaceIInspectable- Parameters:
inspector- tree inspector to collect and process attributes. This parameter is required.
-
renderProperties
@Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String, Object> props) - Overrides:
renderPropertiesin classCfnResource- Parameters:
props- This parameter is required.
-
getAttrId
-
getCfnProperties
- Overrides:
getCfnPropertiesin classCfnResource
-
getStackRef
A reference to a Stack resource.- Specified by:
getStackRefin interfaceIStackRef
-
getTags
Tag Manager which manages the tags for this resource. -
getDefaultInstanceProfileArn
The Amazon Resource Name (ARN) of an IAM profile that is the default profile for all of the stack's EC2 instances. -
setDefaultInstanceProfileArn
The Amazon Resource Name (ARN) of an IAM profile that is the default profile for all of the stack's EC2 instances. -
getName
The stack name. -
setName
The stack name. -
getServiceRoleArn
The stack's IAM role, which allows OpsWorks Stacks to work with AWS resources on your behalf. -
setServiceRoleArn
The stack's IAM role, which allows OpsWorks Stacks to work with AWS resources on your behalf. -
getAgentVersion
The default OpsWorks Stacks agent version.You have the following options:.
-
setAgentVersion
The default OpsWorks Stacks agent version.You have the following options:.
-
getAttributes
One or more user-defined key-value pairs to be added to the stack attributes.Returns union: either Mapinvalid input: '<'String,
String> orIResolvable -
setAttributes
One or more user-defined key-value pairs to be added to the stack attributes. -
setAttributes
One or more user-defined key-value pairs to be added to the stack attributes. -
getChefConfiguration
AChefConfigurationobject that specifies whether to enable Berkshelf and the Berkshelf version on Chef 11.10 stacks. For more information, see Create a New Stack .Returns union: either
IResolvableorCfnStack.ChefConfigurationProperty -
setChefConfiguration
AChefConfigurationobject that specifies whether to enable Berkshelf and the Berkshelf version on Chef 11.10 stacks. For more information, see Create a New Stack . -
setChefConfiguration
@Stability(Stable) public void setChefConfiguration(@Nullable CfnStack.ChefConfigurationProperty value) AChefConfigurationobject that specifies whether to enable Berkshelf and the Berkshelf version on Chef 11.10 stacks. For more information, see Create a New Stack . -
getCloneAppIds
If you're cloning an OpsWorks stack, a list of OpsWorks application stack IDs from the source stack to include in the cloned stack. -
setCloneAppIds
If you're cloning an OpsWorks stack, a list of OpsWorks application stack IDs from the source stack to include in the cloned stack. -
getClonePermissions
If you're cloning an OpsWorks stack, indicates whether to clone the source stack's permissions.Returns union: either
BooleanorIResolvable -
setClonePermissions
If you're cloning an OpsWorks stack, indicates whether to clone the source stack's permissions. -
setClonePermissions
If you're cloning an OpsWorks stack, indicates whether to clone the source stack's permissions. -
getConfigurationManager
The configuration manager.Returns union: either
IResolvableorCfnStack.StackConfigurationManagerProperty -
setConfigurationManager
The configuration manager. -
setConfigurationManager
@Stability(Stable) public void setConfigurationManager(@Nullable CfnStack.StackConfigurationManagerProperty value) The configuration manager. -
getCustomCookbooksSource
Contains the information required to retrieve an app or cookbook from a repository.Returns union: either
IResolvableorCfnStack.SourceProperty -
setCustomCookbooksSource
Contains the information required to retrieve an app or cookbook from a repository. -
setCustomCookbooksSource
Contains the information required to retrieve an app or cookbook from a repository. -
getCustomJson
A string that contains user-defined, custom JSON. -
setCustomJson
A string that contains user-defined, custom JSON. -
getDefaultAvailabilityZone
The stack's default Availability Zone, which must be in the specified region. -
setDefaultAvailabilityZone
The stack's default Availability Zone, which must be in the specified region. -
getDefaultOs
The stack's default operating system, which is installed on every instance unless you specify a different operating system when you create the instance. -
setDefaultOs
The stack's default operating system, which is installed on every instance unless you specify a different operating system when you create the instance. -
getDefaultRootDeviceType
The default root device type. -
setDefaultRootDeviceType
The default root device type. -
getDefaultSshKeyName
A default Amazon EC2 key pair name. -
setDefaultSshKeyName
A default Amazon EC2 key pair name. -
getDefaultSubnetId
The stack's default subnet ID. -
setDefaultSubnetId
The stack's default subnet ID. -
getEcsClusterArn
The Amazon Resource Name (ARN) of the Amazon Elastic Container Service ( Amazon ECS ) cluster to register with the OpsWorks stack. -
setEcsClusterArn
The Amazon Resource Name (ARN) of the Amazon Elastic Container Service ( Amazon ECS ) cluster to register with the OpsWorks stack. -
getElasticIps
A list of Elastic IP addresses to register with the OpsWorks stack.Returns union: either
IResolvableor Listinvalid input: '<'eitherIResolvableorCfnStack.ElasticIpProperty> -
setElasticIps
A list of Elastic IP addresses to register with the OpsWorks stack. -
setElasticIps
A list of Elastic IP addresses to register with the OpsWorks stack. -
getHostnameTheme
The stack's host name theme, with spaces replaced by underscores. -
setHostnameTheme
The stack's host name theme, with spaces replaced by underscores. -
getRdsDbInstances
The Amazon Relational Database Service ( Amazon RDS ) database instance to register with the OpsWorks stack.Returns union: either
IResolvableor Listinvalid input: '<'eitherIResolvableorCfnStack.RdsDbInstanceProperty> -
setRdsDbInstances
The Amazon Relational Database Service ( Amazon RDS ) database instance to register with the OpsWorks stack. -
setRdsDbInstances
The Amazon Relational Database Service ( Amazon RDS ) database instance to register with the OpsWorks stack. -
getSourceStackId
If you're cloning an OpsWorks stack, the stack ID of the source OpsWorks stack to clone. -
setSourceStackId
If you're cloning an OpsWorks stack, the stack ID of the source OpsWorks stack to clone. -
getTagsRaw
A map that contains tag keys and tag values that are attached to a stack or layer. -
setTagsRaw
A map that contains tag keys and tag values that are attached to a stack or layer. -
getUseCustomCookbooks
Whether the stack uses custom cookbooks.Returns union: either
BooleanorIResolvable -
setUseCustomCookbooks
Whether the stack uses custom cookbooks. -
setUseCustomCookbooks
Whether the stack uses custom cookbooks. -
getUseOpsworksSecurityGroups
Whether to associate the OpsWorks Stacks built-in security groups with the stack's layers.Returns union: either
BooleanorIResolvable -
setUseOpsworksSecurityGroups
Whether to associate the OpsWorks Stacks built-in security groups with the stack's layers. -
setUseOpsworksSecurityGroups
Whether to associate the OpsWorks Stacks built-in security groups with the stack's layers. -
getVpcId
The ID of the VPC that the stack is to be launched into. -
setVpcId
The ID of the VPC that the stack is to be launched into.
-