@Generated(value="jsii-pacmak/1.74.0 (build 6d08790)", date="2023-03-14T16:25:28.506Z") public class CfnVolume extends CfnResource implements IInspectable
Specifies an Amazon Elastic Block Store (Amazon EBS) volume. You can attach the volume to an instance in the same Availability Zone using AWS::EC2::VolumeAttachment .
When you use AWS CloudFormation to update an Amazon EBS volume that modifies Iops
, Size
, or VolumeType
, there is a cooldown period before another operation can occur. This can cause your stack to report being in UPDATE_IN_PROGRESS
or UPDATE_ROLLBACK_IN_PROGRESS
for long periods of time.
Amazon EBS does not support sizing down an Amazon EBS volume. AWS CloudFormation does not attempt to modify an Amazon EBS volume to a smaller size on rollback.
Some common scenarios when you might encounter a cooldown period for Amazon EBS include:
update-stack
call fails. The rollback will be subject to a cooldown period.For more information on the cooldown period, see Requirements when modifying volumes .
DeletionPolicy attribute
To control how AWS CloudFormation handles the volume when the stack is deleted, set a deletion policy for your volume. You can choose to retain the volume, to delete the volume, or to create a snapshot of the volume. For more information, see DeletionPolicy attribute .
If you set a deletion policy that creates a snapshot, all tags on the volume are included in the snapshot.
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.ec2.*; CfnVolume cfnVolume = CfnVolume.Builder.create(this, "MyCfnVolume") .availabilityZone("availabilityZone") // the properties below are optional .autoEnableIo(false) .encrypted(false) .iops(123) .kmsKeyId("kmsKeyId") .multiAttachEnabled(false) .outpostArn("outpostArn") .size(123) .snapshotId("snapshotId") .tags(List.of(CfnTag.builder() .key("key") .value("value") .build())) .throughput(123) .volumeType("volumeType") .build();
Modifier and Type | Class and Description |
---|---|
static class |
CfnVolume.Builder
A fluent builder for
CfnVolume . |
IInspectable.Jsii$Default, IInspectable.Jsii$Proxy
IConstruct.Jsii$Default
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
|
Modifier | Constructor and Description |
---|---|
|
CfnVolume(Construct scope,
java.lang.String id,
CfnVolumeProps props)
Create a new `AWS::EC2::Volume`.
|
protected |
CfnVolume(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
CfnVolume(software.amazon.jsii.JsiiObjectRef objRef) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getAttrVolumeId()
The ID of the volume.
|
java.lang.Object |
getAutoEnableIo()
Indicates whether the volume is auto-enabled for I/O operations.
|
java.lang.String |
getAvailabilityZone()
The Availability Zone in which to create the volume.
|
protected java.util.Map<java.lang.String,java.lang.Object> |
getCfnProperties() |
java.lang.Object |
getEncrypted()
Indicates whether the volume should be encrypted.
|
java.lang.Number |
getIops()
The number of I/O operations per second (IOPS).
|
java.lang.String |
getKmsKeyId()
The identifier of the AWS KMS key to use for Amazon EBS encryption.
|
java.lang.Object |
getMultiAttachEnabled()
Indicates whether Amazon EBS Multi-Attach is enabled.
|
java.lang.String |
getOutpostArn()
The Amazon Resource Name (ARN) of the Outpost.
|
java.lang.Number |
getSize()
The size of the volume, in GiBs.
|
java.lang.String |
getSnapshotId()
The snapshot from which to create the volume.
|
TagManager |
getTags()
The tags to apply to the volume during creation.
|
java.lang.Number |
getThroughput()
The throughput to provision for a volume, with a maximum of 1,000 MiB/s.
|
java.lang.String |
getVolumeType()
The volume type.
|
void |
inspect(TreeInspector inspector)
Examines the CloudFormation resource and discloses attributes.
|
protected java.util.Map<java.lang.String,java.lang.Object> |
renderProperties(java.util.Map<java.lang.String,java.lang.Object> props) |
void |
setAutoEnableIo(java.lang.Boolean value)
Indicates whether the volume is auto-enabled for I/O operations.
|
void |
setAutoEnableIo(IResolvable value)
Indicates whether the volume is auto-enabled for I/O operations.
|
void |
setAvailabilityZone(java.lang.String value)
The Availability Zone in which to create the volume.
|
void |
setEncrypted(java.lang.Boolean value)
Indicates whether the volume should be encrypted.
|
void |
setEncrypted(IResolvable value)
Indicates whether the volume should be encrypted.
|
void |
setIops(java.lang.Number value)
The number of I/O operations per second (IOPS).
|
void |
setKmsKeyId(java.lang.String value)
The identifier of the AWS KMS key to use for Amazon EBS encryption.
|
void |
setMultiAttachEnabled(java.lang.Boolean value)
Indicates whether Amazon EBS Multi-Attach is enabled.
|
void |
setMultiAttachEnabled(IResolvable value)
Indicates whether Amazon EBS Multi-Attach is enabled.
|
void |
setOutpostArn(java.lang.String value)
The Amazon Resource Name (ARN) of the Outpost.
|
void |
setSize(java.lang.Number value)
The size of the volume, in GiBs.
|
void |
setSnapshotId(java.lang.String value)
The snapshot from which to create the volume.
|
void |
setThroughput(java.lang.Number value)
The throughput to provision for a volume, with a maximum of 1,000 MiB/s.
|
void |
setVolumeType(java.lang.String value)
The volume type.
|
addDeletionOverride, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getCfnOptions, getCfnResourceType, getMetadata, getUpdatedProperites, isCfnResource, shouldSynthesize, toString, validateProperties
getRef
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalId
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize, validate
public static final java.lang.String CFN_RESOURCE_TYPE_NAME
protected CfnVolume(software.amazon.jsii.JsiiObjectRef objRef)
protected CfnVolume(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
public CfnVolume(Construct scope, java.lang.String id, CfnVolumeProps props)
scope
- - scope in which this resource is defined. This parameter is required.id
- - scoped id of the resource. This parameter is required.props
- - resource properties. This parameter is required.public void inspect(TreeInspector inspector)
inspect
in interface IInspectable
inspector
- - tree inspector to collect and process attributes. This parameter is required.protected java.util.Map<java.lang.String,java.lang.Object> renderProperties(java.util.Map<java.lang.String,java.lang.Object> props)
renderProperties
in class CfnResource
props
- This parameter is required.public java.lang.String getAttrVolumeId()
protected java.util.Map<java.lang.String,java.lang.Object> getCfnProperties()
getCfnProperties
in class CfnResource
public TagManager getTags()
public java.lang.String getAvailabilityZone()
public void setAvailabilityZone(java.lang.String value)
public java.lang.Object getAutoEnableIo()
By default, Amazon EBS disables I/O to the volume from attached EC2 instances when it determines that a volume's data is potentially inconsistent. If the consistency of the volume is not a concern, and you prefer that the volume be made available immediately if it's impaired, you can configure the volume to automatically enable I/O.
public void setAutoEnableIo(java.lang.Boolean value)
By default, Amazon EBS disables I/O to the volume from attached EC2 instances when it determines that a volume's data is potentially inconsistent. If the consistency of the volume is not a concern, and you prefer that the volume be made available immediately if it's impaired, you can configure the volume to automatically enable I/O.
public void setAutoEnableIo(IResolvable value)
By default, Amazon EBS disables I/O to the volume from attached EC2 instances when it determines that a volume's data is potentially inconsistent. If the consistency of the volume is not a concern, and you prefer that the volume be made available immediately if it's impaired, you can configure the volume to automatically enable I/O.
public java.lang.Object getEncrypted()
The effect of setting the encryption state to true
depends on the volume origin (new or from a snapshot), starting encryption state, ownership, and whether encryption by default is enabled. For more information, see Encryption by default in the Amazon Elastic Compute Cloud User Guide .
Encrypted Amazon EBS volumes must be attached to instances that support Amazon EBS encryption. For more information, see Supported instance types .
public void setEncrypted(java.lang.Boolean value)
The effect of setting the encryption state to true
depends on the volume origin (new or from a snapshot), starting encryption state, ownership, and whether encryption by default is enabled. For more information, see Encryption by default in the Amazon Elastic Compute Cloud User Guide .
Encrypted Amazon EBS volumes must be attached to instances that support Amazon EBS encryption. For more information, see Supported instance types .
public void setEncrypted(IResolvable value)
The effect of setting the encryption state to true
depends on the volume origin (new or from a snapshot), starting encryption state, ownership, and whether encryption by default is enabled. For more information, see Encryption by default in the Amazon Elastic Compute Cloud User Guide .
Encrypted Amazon EBS volumes must be attached to instances that support Amazon EBS encryption. For more information, see Supported instance types .
public java.lang.Number getIops()
For gp3
, io1
, and io2
volumes, this represents the number of IOPS that are provisioned for the volume. For gp2
volumes, this represents the baseline performance of the volume and the rate at which the volume accumulates I/O credits for bursting.
The following are the supported values for each volume type:
gp3
: 3,000-16,000 IOPSio1
: 100-64,000 IOPSio2
: 100-64,000 IOPS
io1
and io2
volumes support up to 64,000 IOPS only on Instances built on the Nitro System . Other instance families support performance up to 32,000 IOPS.
This parameter is required for io1
and io2
volumes. The default for gp3
volumes is 3,000 IOPS. This parameter is not supported for gp2
, st1
, sc1
, or standard
volumes.
public void setIops(java.lang.Number value)
For gp3
, io1
, and io2
volumes, this represents the number of IOPS that are provisioned for the volume. For gp2
volumes, this represents the baseline performance of the volume and the rate at which the volume accumulates I/O credits for bursting.
The following are the supported values for each volume type:
gp3
: 3,000-16,000 IOPSio1
: 100-64,000 IOPSio2
: 100-64,000 IOPS
io1
and io2
volumes support up to 64,000 IOPS only on Instances built on the Nitro System . Other instance families support performance up to 32,000 IOPS.
This parameter is required for io1
and io2
volumes. The default for gp3
volumes is 3,000 IOPS. This parameter is not supported for gp2
, st1
, sc1
, or standard
volumes.
public java.lang.String getKmsKeyId()
If KmsKeyId
is specified, the encrypted state must be true
.
If you omit this property and your account is enabled for encryption by default, or Encrypted is set to true
, then the volume is encrypted using the default key specified for your account. If your account does not have a default key, then the volume is encrypted using the AWS managed key .
Alternatively, if you want to specify a different key, you can specify one of the following:
alias/
. For example, for a key with the alias my_cmk
, use alias/my_cmk
. Or to specify the AWS managed key , use alias/aws/ebs
.public void setKmsKeyId(java.lang.String value)
If KmsKeyId
is specified, the encrypted state must be true
.
If you omit this property and your account is enabled for encryption by default, or Encrypted is set to true
, then the volume is encrypted using the default key specified for your account. If your account does not have a default key, then the volume is encrypted using the AWS managed key .
Alternatively, if you want to specify a different key, you can specify one of the following:
alias/
. For example, for a key with the alias my_cmk
, use alias/my_cmk
. Or to specify the AWS managed key , use alias/aws/ebs
.public java.lang.Object getMultiAttachEnabled()
AWS CloudFormation does not currently support updating a single-attach volume to be multi-attach enabled, updating a multi-attach enabled volume to be single-attach, or updating the size or number of I/O operations per second (IOPS) of a multi-attach enabled volume.
public void setMultiAttachEnabled(java.lang.Boolean value)
AWS CloudFormation does not currently support updating a single-attach volume to be multi-attach enabled, updating a multi-attach enabled volume to be single-attach, or updating the size or number of I/O operations per second (IOPS) of a multi-attach enabled volume.
public void setMultiAttachEnabled(IResolvable value)
AWS CloudFormation does not currently support updating a single-attach volume to be multi-attach enabled, updating a multi-attach enabled volume to be single-attach, or updating the size or number of I/O operations per second (IOPS) of a multi-attach enabled volume.
public java.lang.String getOutpostArn()
public void setOutpostArn(java.lang.String value)
public java.lang.Number getSize()
You must specify either a snapshot ID or a volume size. If you specify a snapshot, the default is the snapshot size. You can specify a volume size that is equal to or larger than the snapshot size.
The following are the supported volumes sizes for each volume type:
gp2
and gp3
: 1-16,384io1
and io2
: 4-16,384st1
and sc1
: 125-16,384standard
: 1-1,024public void setSize(java.lang.Number value)
You must specify either a snapshot ID or a volume size. If you specify a snapshot, the default is the snapshot size. You can specify a volume size that is equal to or larger than the snapshot size.
The following are the supported volumes sizes for each volume type:
gp2
and gp3
: 1-16,384io1
and io2
: 4-16,384st1
and sc1
: 125-16,384standard
: 1-1,024public java.lang.String getSnapshotId()
You must specify either a snapshot ID or a volume size.
public void setSnapshotId(java.lang.String value)
You must specify either a snapshot ID or a volume size.
public java.lang.Number getThroughput()
This parameter is valid only for gp3
volumes. The default value is 125.
Valid Range: Minimum value of 125. Maximum value of 1000.
public void setThroughput(java.lang.Number value)
This parameter is valid only for gp3
volumes. The default value is 125.
Valid Range: Minimum value of 125. Maximum value of 1000.
public java.lang.String getVolumeType()
gp2
| gp3
io1
| io2
st1
sc1
standard
For more information, see Amazon EBS volume types in the Amazon Elastic Compute Cloud User Guide .
Default: gp2
public void setVolumeType(java.lang.String value)
gp2
| gp3
io1
| io2
st1
sc1
standard
For more information, see Amazon EBS volume types in the Amazon Elastic Compute Cloud User Guide .
Default: gp2