Class CfnInstance
- All Implemented Interfaces:
IConstruct
,IDependable
,IInspectable
,software.amazon.jsii.JsiiSerializable
,software.constructs.IConstruct
AWS::OpsWorks::Instance
.
Creates an instance in a specified stack. For more information, see Adding an Instance to a Layer .
Required Permissions : To use this action, an IAM user must have a Manage permissions level for the stack, or an attached policy that explicitly grants permissions. For more information on 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 software.amazon.awscdk.services.opsworks.*; CfnInstance cfnInstance = CfnInstance.Builder.create(this, "MyCfnInstance") .instanceType("instanceType") .layerIds(List.of("layerIds")) .stackId("stackId") // the properties below are optional .agentVersion("agentVersion") .amiId("amiId") .architecture("architecture") .autoScalingType("autoScalingType") .availabilityZone("availabilityZone") .blockDeviceMappings(List.of(BlockDeviceMappingProperty.builder() .deviceName("deviceName") .ebs(EbsBlockDeviceProperty.builder() .deleteOnTermination(false) .iops(123) .snapshotId("snapshotId") .volumeSize(123) .volumeType("volumeType") .build()) .noDevice("noDevice") .virtualName("virtualName") .build())) .ebsOptimized(false) .elasticIps(List.of("elasticIps")) .hostname("hostname") .installUpdatesOnBoot(false) .os("os") .rootDeviceType("rootDeviceType") .sshKeyName("sshKeyName") .subnetId("subnetId") .tenancy("tenancy") .timeBasedAutoScaling(TimeBasedAutoScalingProperty.builder() .friday(Map.of( "fridayKey", "friday")) .monday(Map.of( "mondayKey", "monday")) .saturday(Map.of( "saturdayKey", "saturday")) .sunday(Map.of( "sundayKey", "sunday")) .thursday(Map.of( "thursdayKey", "thursday")) .tuesday(Map.of( "tuesdayKey", "tuesday")) .wednesday(Map.of( "wednesdayKey", "wednesday")) .build()) .virtualizationType("virtualizationType") .volumes(List.of("volumes")) .build();
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Describes a block device mapping.static final class
A fluent builder forCfnInstance
.static interface
Describes an Amazon EBS volume.static interface
Describes an instance's time-based auto scaling configuration.Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode
Nested classes/interfaces inherited from interface software.amazon.awscdk.core.IConstruct
IConstruct.Jsii$Default
Nested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$Default
Nested classes/interfaces inherited from interface software.amazon.awscdk.core.IInspectable
IInspectable.Jsii$Default, IInspectable.Jsii$Proxy
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The CloudFormation resource type name for this resource class. -
Constructor Summary
ModifierConstructorDescriptionCfnInstance
(Construct scope, String id, CfnInstanceProps props) Create a newAWS::OpsWorks::Instance
.protected
CfnInstance
(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protected
CfnInstance
(software.amazon.jsii.JsiiObjectRef objRef) -
Method Summary
Modifier and TypeMethodDescriptionThe default AWS OpsWorks Stacks agent version.getAmiId()
A custom AMI ID to be used to create the instance.The instance architecture.The Availability Zone of the AWS OpsWorks instance, such asus-east-2a
.The private DNS name of the AWS OpsWorks instance.The private IP address of the AWS OpsWorks instance, such as192.0.2.0
.The public DNS name of the AWS OpsWorks instance.The public IP address of the AWS OpsWorks instance, such as192.0.2.0
.For load-based or time-based instances, the type.The Availability Zone of the AWS OpsWorks instance, such asus-east-2a
.An array ofBlockDeviceMapping
objects that specify the instance's block devices.Whether to create an Amazon EBS-optimized instance.A list of Elastic IP addresses to associate with the instance.The instance host name.Whether to install operating system and package updates when the instance boots.The instance type, such ast2.micro
.An array that contains the instance's layer IDs.getOs()
The instance's operating system, which must be set to one of the following.The instance root device type.The instance's Amazon EC2 key-pair name.The stack ID.The ID of the instance's subnet.The instance's tenancy option.The time-based scaling configuration for the instance.The instance's virtualization type,paravirtual
orhvm
.A list of AWS OpsWorks volume IDs to associate with the instance.void
inspect
(TreeInspector inspector) Examines the CloudFormation resource and discloses attributes.renderProperties
(Map<String, Object> props) void
setAgentVersion
(String value) The default AWS OpsWorks Stacks agent version.void
A custom AMI ID to be used to create the instance.void
setArchitecture
(String value) The instance architecture.void
setAutoScalingType
(String value) For load-based or time-based instances, the type.void
setAvailabilityZone
(String value) The Availability Zone of the AWS OpsWorks instance, such asus-east-2a
.void
setBlockDeviceMappings
(List<Object> value) An array ofBlockDeviceMapping
objects that specify the instance's block devices.void
An array ofBlockDeviceMapping
objects that specify the instance's block devices.void
setEbsOptimized
(Boolean value) Whether to create an Amazon EBS-optimized instance.void
setEbsOptimized
(IResolvable value) Whether to create an Amazon EBS-optimized instance.void
setElasticIps
(List<String> value) A list of Elastic IP addresses to associate with the instance.void
setHostname
(String value) The instance host name.void
setInstallUpdatesOnBoot
(Boolean value) Whether to install operating system and package updates when the instance boots.void
Whether to install operating system and package updates when the instance boots.void
setInstanceType
(String value) The instance type, such ast2.micro
.void
setLayerIds
(List<String> value) An array that contains the instance's layer IDs.void
The instance's operating system, which must be set to one of the following.void
setRootDeviceType
(String value) The instance root device type.void
setSshKeyName
(String value) The instance's Amazon EC2 key-pair name.void
setStackId
(String value) The stack ID.void
setSubnetId
(String value) The ID of the instance's subnet.void
setTenancy
(String value) The instance's tenancy option.void
The time-based scaling configuration for the instance.void
The time-based scaling configuration for the instance.void
setVirtualizationType
(String value) The instance's virtualization type,paravirtual
orhvm
.void
setVolumes
(List<String> value) A list of AWS OpsWorks volume IDs to associate with the instance.Methods inherited from class software.amazon.awscdk.core.CfnResource
addDeletionOverride, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getCfnOptions, getCfnResourceType, getMetadata, getUpdatedProperites, isCfnResource, shouldSynthesize, toString, validateProperties
Methods inherited from class software.amazon.awscdk.core.CfnRefElement
getRef
Methods inherited from class software.amazon.awscdk.core.CfnElement
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalId
Methods inherited from class software.amazon.awscdk.core.Construct
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize, validate
Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods 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
-
CfnInstance
protected CfnInstance(software.amazon.jsii.JsiiObjectRef objRef) -
CfnInstance
protected CfnInstance(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
CfnInstance
@Stability(Stable) public CfnInstance(@NotNull Construct scope, @NotNull String id, @NotNull CfnInstanceProps props) Create a newAWS::OpsWorks::Instance
.- Parameters:
scope
-- scope in which this resource is defined.
id
-- scoped id of the resource.
props
-- resource properties.
-
-
Method Details
-
inspect
Examines the CloudFormation resource and discloses attributes.- Specified by:
inspect
in interfaceIInspectable
- Parameters:
inspector
-- tree inspector to collect and process attributes.
-
renderProperties
@Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String, Object> props) - Overrides:
renderProperties
in classCfnResource
- Parameters:
props
- This parameter is required.
-
getAttrAvailabilityZone
The Availability Zone of the AWS OpsWorks instance, such asus-east-2a
. -
getAttrPrivateDnsName
The private DNS name of the AWS OpsWorks instance. -
getAttrPrivateIp
The private IP address of the AWS OpsWorks instance, such as192.0.2.0
. -
getAttrPublicDnsName
The public DNS name of the AWS OpsWorks instance. -
getAttrPublicIp
The public IP address of the AWS OpsWorks instance, such as192.0.2.0
.Use this attribute only when the AWS OpsWorks instance is in an AWS OpsWorks layer that auto-assigns public IP addresses.
-
getCfnProperties
- Overrides:
getCfnProperties
in classCfnResource
-
getInstanceType
The instance type, such ast2.micro
. For a list of supported instance types, open the stack in the console, choose Instances , and choose + Instance . The Size list contains the currently supported types. For more information, see Instance Families and Types . The parameter values that you use to specify the various types are in the API Name column of the Available Instance Types table. -
setInstanceType
The instance type, such ast2.micro
. For a list of supported instance types, open the stack in the console, choose Instances , and choose + Instance . The Size list contains the currently supported types. For more information, see Instance Families and Types . The parameter values that you use to specify the various types are in the API Name column of the Available Instance Types table. -
getLayerIds
An array that contains the instance's layer IDs. -
setLayerIds
An array that contains the instance's layer IDs. -
getStackId
The stack ID. -
setStackId
The stack ID. -
getAgentVersion
The default AWS OpsWorks Stacks agent version. You have the following options:.INHERIT
- Use the stack's default agent version setting.- version_number - Use the specified agent version. This value overrides the stack's default setting. To update the agent version, edit the instance configuration and specify a new version. AWS OpsWorks Stacks installs that version on the instance.
The default setting is
INHERIT
. 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. -
setAgentVersion
The default AWS OpsWorks Stacks agent version. You have the following options:.INHERIT
- Use the stack's default agent version setting.- version_number - Use the specified agent version. This value overrides the stack's default setting. To update the agent version, edit the instance configuration and specify a new version. AWS OpsWorks Stacks installs that version on the instance.
The default setting is
INHERIT
. 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. -
getAmiId
A custom AMI ID to be used to create the instance.The AMI should be based on one of the supported operating systems. For more information, see Using Custom AMIs .
If you specify a custom AMI, you must set
Os
toCustom
. -
setAmiId
A custom AMI ID to be used to create the instance.The AMI should be based on one of the supported operating systems. For more information, see Using Custom AMIs .
If you specify a custom AMI, you must set
Os
toCustom
. -
getArchitecture
The instance architecture.The default option is
x86_64
. Instance types do not necessarily support both architectures. For a list of the architectures that are supported by the different instance types, see Instance Families and Types . -
setArchitecture
The instance architecture.The default option is
x86_64
. Instance types do not necessarily support both architectures. For a list of the architectures that are supported by the different instance types, see Instance Families and Types . -
getAutoScalingType
For load-based or time-based instances, the type.Windows stacks can use only time-based instances.
-
setAutoScalingType
For load-based or time-based instances, the type.Windows stacks can use only time-based instances.
-
getAvailabilityZone
The Availability Zone of the AWS OpsWorks instance, such asus-east-2a
. -
setAvailabilityZone
The Availability Zone of the AWS OpsWorks instance, such asus-east-2a
. -
getBlockDeviceMappings
An array ofBlockDeviceMapping
objects that specify the instance's block devices.For more information, see Block Device Mapping . Note that block device mappings are not supported for custom AMIs.
-
setBlockDeviceMappings
An array ofBlockDeviceMapping
objects that specify the instance's block devices.For more information, see Block Device Mapping . Note that block device mappings are not supported for custom AMIs.
-
setBlockDeviceMappings
An array ofBlockDeviceMapping
objects that specify the instance's block devices.For more information, see Block Device Mapping . Note that block device mappings are not supported for custom AMIs.
-
getEbsOptimized
Whether to create an Amazon EBS-optimized instance. -
setEbsOptimized
Whether to create an Amazon EBS-optimized instance. -
setEbsOptimized
Whether to create an Amazon EBS-optimized instance. -
getElasticIps
A list of Elastic IP addresses to associate with the instance. -
setElasticIps
A list of Elastic IP addresses to associate with the instance. -
getHostname
The instance host name. The following are character limits for instance host names.- Linux-based instances: 63 characters
- Windows-based instances: 15 characters
-
setHostname
The instance host name. The following are character limits for instance host names.- Linux-based instances: 63 characters
- Windows-based instances: 15 characters
-
getInstallUpdatesOnBoot
Whether to install operating system and package updates when the instance boots.The default value is
true
. To control when updates are installed, set this value tofalse
. You must then update your instances manually by using CreateDeployment to run theupdate_dependencies
stack command or by manually runningyum
(Amazon Linux) orapt-get
(Ubuntu) on the instances.We strongly recommend using the default value of
true
to ensure that your instances have the latest security updates. -
setInstallUpdatesOnBoot
Whether to install operating system and package updates when the instance boots.The default value is
true
. To control when updates are installed, set this value tofalse
. You must then update your instances manually by using CreateDeployment to run theupdate_dependencies
stack command or by manually runningyum
(Amazon Linux) orapt-get
(Ubuntu) on the instances.We strongly recommend using the default value of
true
to ensure that your instances have the latest security updates. -
setInstallUpdatesOnBoot
Whether to install operating system and package updates when the instance boots.The default value is
true
. To control when updates are installed, set this value tofalse
. You must then update your instances manually by using CreateDeployment to run theupdate_dependencies
stack command or by manually runningyum
(Amazon Linux) orapt-get
(Ubuntu) on the instances.We strongly recommend using the default value of
true
to ensure that your instances have the latest security updates. -
getOs
The instance's operating system, which must be set to 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
, orAmazon Linux 2015.03
. - A supported Ubuntu operating system, such as
Ubuntu 18.04 LTS
,Ubuntu 16.04 LTS
,Ubuntu 14.04 LTS
, orUbuntu 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
, orMicrosoft Windows Server 2012 R2 with SQL Server Web
. - A custom AMI:
Custom
.
Not all operating systems are supported with all versions of Chef. For more information about the supported operating systems, see AWS OpsWorks Stacks Operating Systems .
The default option is the current Amazon Linux version. If you set this parameter to
Custom
, you must use the CreateInstance action's AmiId parameter to specify the custom AMI that you want to use. Block device mappings are not supported if the value isCustom
. For more information about how to use custom AMIs with AWS OpsWorks Stacks, see Using Custom AMIs . - A supported Linux operating system: An Amazon Linux version, such as
-
setOs
The instance's operating system, which must be set to 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
, orAmazon Linux 2015.03
. - A supported Ubuntu operating system, such as
Ubuntu 18.04 LTS
,Ubuntu 16.04 LTS
,Ubuntu 14.04 LTS
, orUbuntu 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
, orMicrosoft Windows Server 2012 R2 with SQL Server Web
. - A custom AMI:
Custom
.
Not all operating systems are supported with all versions of Chef. For more information about the supported operating systems, see AWS OpsWorks Stacks Operating Systems .
The default option is the current Amazon Linux version. If you set this parameter to
Custom
, you must use the CreateInstance action's AmiId parameter to specify the custom AMI that you want to use. Block device mappings are not supported if the value isCustom
. For more information about how to use custom AMIs with AWS OpsWorks Stacks, see Using Custom AMIs . - A supported Linux operating system: An Amazon Linux version, such as
-
getRootDeviceType
The instance root device type.For more information, see Storage for the Root Device .
-
setRootDeviceType
The instance root device type.For more information, see Storage for the Root Device .
-
getSshKeyName
The instance's Amazon EC2 key-pair name. -
setSshKeyName
The instance's Amazon EC2 key-pair name. -
getSubnetId
The ID of the instance's subnet.If the stack is running in a VPC, you can use this parameter to override the stack's default subnet ID value and direct AWS OpsWorks Stacks to launch the instance in a different subnet.
-
setSubnetId
The ID of the instance's subnet.If the stack is running in a VPC, you can use this parameter to override the stack's default subnet ID value and direct AWS OpsWorks Stacks to launch the instance in a different subnet.
-
getTenancy
The instance's tenancy option.The default option is no tenancy, or if the instance is running in a VPC, inherit tenancy settings from the VPC. The following are valid values for this parameter:
dedicated
,default
, orhost
. Because there are costs associated with changes in tenancy options, we recommend that you research tenancy options before choosing them for your instances. For more information about dedicated hosts, see Dedicated Hosts Overview and Amazon EC2 Dedicated Hosts . For more information about dedicated instances, see Dedicated Instances and Amazon EC2 Dedicated Instances . -
setTenancy
The instance's tenancy option.The default option is no tenancy, or if the instance is running in a VPC, inherit tenancy settings from the VPC. The following are valid values for this parameter:
dedicated
,default
, orhost
. Because there are costs associated with changes in tenancy options, we recommend that you research tenancy options before choosing them for your instances. For more information about dedicated hosts, see Dedicated Hosts Overview and Amazon EC2 Dedicated Hosts . For more information about dedicated instances, see Dedicated Instances and Amazon EC2 Dedicated Instances . -
getTimeBasedAutoScaling
The time-based scaling configuration for the instance. -
setTimeBasedAutoScaling
The time-based scaling configuration for the instance. -
setTimeBasedAutoScaling
@Stability(Stable) public void setTimeBasedAutoScaling(@Nullable CfnInstance.TimeBasedAutoScalingProperty value) The time-based scaling configuration for the instance. -
getVirtualizationType
The instance's virtualization type,paravirtual
orhvm
. -
setVirtualizationType
The instance's virtualization type,paravirtual
orhvm
. -
getVolumes
A list of AWS OpsWorks volume IDs to associate with the instance.For more information, see
AWS::OpsWorks::Volume
. -
setVolumes
A list of AWS OpsWorks volume IDs to associate with the instance.For more information, see
AWS::OpsWorks::Volume
.
-