Class CfnVolumeAttachment

java.lang.Object
software.amazon.jsii.JsiiObject
All Implemented Interfaces:
IConstruct, IDependable, IInspectable, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct

@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)", date="2023-06-19T16:30:39.248Z") @Stability(Stable) public class CfnVolumeAttachment extends CfnResource implements IInspectable
A CloudFormation 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();
 
  • Field Details

    • CFN_RESOURCE_TYPE_NAME

      @Stability(Stable) public static final String 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 new AWS::EC2::VolumeAttachment.

      Parameters:
      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.
  • Method Details

    • inspect

      @Stability(Stable) public void inspect(@NotNull TreeInspector inspector)
      Examines the CloudFormation resource and discloses attributes.

      Specified by:
      inspect in interface IInspectable
      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:
      renderProperties in class CfnResource
      Parameters:
      props - This parameter is required.
    • getCfnProperties

      @Stability(Stable) @NotNull protected Map<String,Object> getCfnProperties()
      Overrides:
      getCfnProperties in class CfnResource
    • getDevice

      @Stability(Stable) @NotNull public String getDevice()
      The device name (for example, /dev/sdh or xvdh ).
    • setDevice

      @Stability(Stable) public void setDevice(@NotNull String value)
      The device name (for example, /dev/sdh or xvdh ).
    • getInstanceId

      @Stability(Stable) @NotNull public String getInstanceId()
      The ID of the instance to which the volume attaches.

      This value can be a reference to an AWS::EC2::Instance resource, or it can be the physical ID of an existing EC2 instance.

    • setInstanceId

      @Stability(Stable) public void setInstanceId(@NotNull String value)
      The ID of the instance to which the volume attaches.

      This value can be a reference to an AWS::EC2::Instance resource, or it can be the physical ID of an existing EC2 instance.

    • getVolumeId

      @Stability(Stable) @NotNull public String 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::Volume resource, or it can be the volume ID of an existing Amazon EBS volume.

    • setVolumeId

      @Stability(Stable) public void setVolumeId(@NotNull String value)
      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::Volume resource, or it can be the volume ID of an existing Amazon EBS volume.