Class CfnVolumeAttachment
- All Implemented Interfaces:
IConstruct,IDependable,IInspectable,software.amazon.jsii.JsiiSerializable,software.constructs.IConstruct
AWS::EC2::VolumeAttachment.
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();
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.amazon.awscdk.core.IConstruct
IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.core.IInspectable
IInspectable.Jsii$Default, IInspectable.Jsii$Proxy -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe CloudFormation resource type name for this resource class. -
Constructor Summary
ConstructorsModifierConstructorDescriptionCfnVolumeAttachment(Construct scope, String id, CfnVolumeAttachmentProps props) Create a newAWS::EC2::VolumeAttachment.protectedCfnVolumeAttachment(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedCfnVolumeAttachment(software.amazon.jsii.JsiiObjectRef objRef) -
Method Summary
Modifier and TypeMethodDescriptionThe device name (for example,/dev/sdhorxvdh).The ID of the instance to which the volume attaches.The ID of the Amazon EBS volume.voidinspect(TreeInspector inspector) Examines the CloudFormation resource and discloses attributes.renderProperties(Map<String, Object> props) voidThe device name (for example,/dev/sdhorxvdh).voidsetInstanceId(String value) The ID of the instance to which the volume attaches.voidsetVolumeId(String value) The ID of the Amazon EBS volume.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, validatePropertiesMethods inherited from class software.amazon.awscdk.core.CfnRefElement
getRefMethods inherited from class software.amazon.awscdk.core.CfnElement
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalIdMethods inherited from class software.amazon.awscdk.core.Construct
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize, validateMethods 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.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
-
-
Constructor Details
-
CfnVolumeAttachment
protected CfnVolumeAttachment(software.amazon.jsii.JsiiObjectRef objRef) -
CfnVolumeAttachment
protected CfnVolumeAttachment(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
CfnVolumeAttachment
@Stability(Stable) public CfnVolumeAttachment(@NotNull Construct scope, @NotNull String id, @NotNull CfnVolumeAttachmentProps props) Create a newAWS::EC2::VolumeAttachment.- 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:
inspectin 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:
renderPropertiesin classCfnResource- Parameters:
props- This parameter is required.
-
getCfnProperties
- Overrides:
getCfnPropertiesin classCfnResource
-
getDevice
The device name (for example,/dev/sdhorxvdh). -
setDevice
The device name (for example,/dev/sdhorxvdh). -
getInstanceId
The ID of the instance to which the volume attaches.This value can be a reference to an
AWS::EC2::Instanceresource, or it can be the physical ID of an existing EC2 instance. -
setInstanceId
The ID of the instance to which the volume attaches.This value can be a reference to an
AWS::EC2::Instanceresource, or it can be the physical ID of an existing EC2 instance. -
getVolumeId
The ID of the Amazon EBS volume.The volume and instance must be within the same Availability Zone. This value can be a reference to an
AWS::EC2::Volumeresource, or it can be the volume ID of an existing Amazon EBS volume. -
setVolumeId
The ID of the Amazon EBS volume.The volume and instance must be within the same Availability Zone. This value can be a reference to an
AWS::EC2::Volumeresource, or it can be the volume ID of an existing Amazon EBS volume.
-