@Generated(value="jsii-pacmak/1.74.0 (build 6d08790)", date="2023-03-22T19:35:42.915Z") public class CfnVolumeAttachment extends CfnResource implements IInspectable
Attaches an Amazon EBS volume to a running instance and exposes it to the instance with the specified device name.
Before this resource can be deleted (and therefore the volume detached), you must first unmount the volume in the instance. Failure to do so results in the volume being stuck in the busy state while it is trying to detach, which could possibly damage the file system or the data it contains.
If an Amazon EBS volume is the root device of an instance, it cannot be detached while the instance is in the "running" state. To detach the root volume, stop the instance first.
If the root volume is detached from an instance with an AWS Marketplace product code, then the product codes from that volume are no longer associated with the instance.
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.*; CfnVolumeAttachment cfnVolumeAttachment = CfnVolumeAttachment.Builder.create(this, "MyCfnVolumeAttachment") .device("device") .instanceId("instanceId") .volumeId("volumeId") .build();
Modifier and Type | Class and Description |
---|---|
static class |
CfnVolumeAttachment.Builder
A fluent builder for
CfnVolumeAttachment . |
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 |
---|---|
|
CfnVolumeAttachment(Construct scope,
java.lang.String id,
CfnVolumeAttachmentProps props)
Create a new `AWS::EC2::VolumeAttachment`.
|
protected |
CfnVolumeAttachment(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
CfnVolumeAttachment(software.amazon.jsii.JsiiObjectRef objRef) |
Modifier and Type | Method and Description |
---|---|
protected java.util.Map<java.lang.String,java.lang.Object> |
getCfnProperties() |
java.lang.String |
getDevice()
The device name (for example, `/dev/sdh` or `xvdh` ).
|
java.lang.String |
getInstanceId()
The ID of the instance to which the volume attaches.
|
java.lang.String |
getVolumeId()
The ID of the Amazon EBS volume.
|
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 |
setDevice(java.lang.String value)
The device name (for example, `/dev/sdh` or `xvdh` ).
|
void |
setInstanceId(java.lang.String value)
The ID of the instance to which the volume attaches.
|
void |
setVolumeId(java.lang.String value)
The ID of the Amazon EBS volume.
|
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 CfnVolumeAttachment(software.amazon.jsii.JsiiObjectRef objRef)
protected CfnVolumeAttachment(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
public CfnVolumeAttachment(Construct scope, java.lang.String id, CfnVolumeAttachmentProps 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.protected java.util.Map<java.lang.String,java.lang.Object> getCfnProperties()
getCfnProperties
in class CfnResource
public java.lang.String getDevice()
public void setDevice(java.lang.String value)
public java.lang.String getInstanceId()
This value can be a reference to an AWS::EC2::Instance
resource, or it can be the physical ID of an existing EC2 instance.
public void setInstanceId(java.lang.String value)
This value can be a reference to an AWS::EC2::Instance
resource, or it can be the physical ID of an existing EC2 instance.
public java.lang.String getVolumeId()
The volume and instance must be within the same Availability Zone. This value can be a reference to an AWS::EC2::Volume
resource, or it can be the volume ID of an existing Amazon EBS volume.
public void setVolumeId(java.lang.String value)
The volume and instance must be within the same Availability Zone. This value can be a reference to an AWS::EC2::Volume
resource, or it can be the volume ID of an existing Amazon EBS volume.