Class Volume
- All Implemented Interfaces:
IResource,IVolume,IVolumeRef,software.amazon.jsii.JsiiSerializable,software.constructs.IConstruct,software.constructs.IDependable
Example:
Volume.Builder.create(this, "Volume")
.availabilityZone("us-east-1a")
.size(Size.gibibytes(125))
.volumeType(EbsDeviceVolumeType.GP3)
.throughput(125)
.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.constructs.IConstruct
software.constructs.IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.IResource
IResource.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.services.ec2.IVolume
IVolume.Jsii$Default, IVolume.Jsii$Proxy -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedVolume(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedVolume(software.amazon.jsii.JsiiObjectRef objRef) Volume(software.constructs.Construct scope, String id, VolumeProps props) -
Method Summary
Modifier and TypeMethodDescriptionstatic IVolumefromVolumeAttributes(software.constructs.Construct scope, String id, VolumeAttributes attrs) Import an existing EBS Volume into the Stack.The availability zone that the EBS Volume is contained within (ex: us-west-2a).The customer-managed encryption key that is used to encrypt the Volume.The EBS Volume's ID.A reference to a Volume resource.grantAttachVolume(IGrantable grantee) Grants permission to attach this Volume to an instance.grantAttachVolume(IGrantable grantee, List<IInstanceRef> instances) Grants permission to attach this Volume to an instance.grantAttachVolumeByResourceTag(IGrantable grantee, List<software.constructs.Construct> constructs) Grants permission to attach the Volume by a ResourceTag condition.grantAttachVolumeByResourceTag(IGrantable grantee, List<software.constructs.Construct> constructs, String tagKeySuffix) Grants permission to attach the Volume by a ResourceTag condition.grantDetachVolume(IGrantable grantee) Grants permission to detach this Volume from an instance CAUTION: Granting an instance permission to detach from itself using this method will lead to an unresolvable circular reference between the instance role and the instance.grantDetachVolume(IGrantable grantee, List<IInstanceRef> instances) Grants permission to detach this Volume from an instance CAUTION: Granting an instance permission to detach from itself using this method will lead to an unresolvable circular reference between the instance role and the instance.grantDetachVolumeByResourceTag(IGrantable grantee, List<software.constructs.Construct> constructs) Grants permission to detach the Volume by a ResourceTag condition.grantDetachVolumeByResourceTag(IGrantable grantee, List<software.constructs.Construct> constructs, String tagKeySuffix) Grants permission to detach the Volume by a ResourceTag condition.protected voidvalidateProps(VolumeProps props) Methods inherited from class software.amazon.awscdk.Resource
applyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isOwnedResource, isResourceMethods inherited from class software.constructs.Construct
getNode, isConstruct, toStringMethods 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.awscdk.IResource
applyRemovalPolicy, getEnv, getStackMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
PROPERTY_INJECTION_ID
Uniquely identifies this class.
-
-
Constructor Details
-
Volume
protected Volume(software.amazon.jsii.JsiiObjectRef objRef) -
Volume
protected Volume(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
Volume
@Stability(Stable) public Volume(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull VolumeProps props) - Parameters:
scope- This parameter is required.id- This parameter is required.props- This parameter is required.
-
-
Method Details
-
fromVolumeAttributes
@Stability(Stable) @NotNull public static IVolume fromVolumeAttributes(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull VolumeAttributes attrs) Import an existing EBS Volume into the Stack.- Parameters:
scope- the scope of the import. This parameter is required.id- the ID of the imported Volume in the construct tree. This parameter is required.attrs- the attributes of the imported Volume. This parameter is required.
-
grantAttachVolume
@Stability(Stable) @NotNull public Grant grantAttachVolume(@NotNull IGrantable grantee, @Nullable List<IInstanceRef> instances) Grants permission to attach this Volume to an instance.CAUTION: Granting an instance permission to attach to itself using this method will lead to an unresolvable circular reference between the instance role and the instance. Use
IVolume.grantAttachVolumeToSelfto grant an instance permission to attach this volume to itself.- Specified by:
grantAttachVolumein interfaceIVolume- Parameters:
grantee- This parameter is required.instances-
-
grantAttachVolume
Grants permission to attach this Volume to an instance.CAUTION: Granting an instance permission to attach to itself using this method will lead to an unresolvable circular reference between the instance role and the instance. Use
IVolume.grantAttachVolumeToSelfto grant an instance permission to attach this volume to itself.- Specified by:
grantAttachVolumein interfaceIVolume- Parameters:
grantee- This parameter is required.
-
grantAttachVolumeByResourceTag
@Stability(Stable) @NotNull public Grant grantAttachVolumeByResourceTag(@NotNull IGrantable grantee, @NotNull List<software.constructs.Construct> constructs, @Nullable String tagKeySuffix) Grants permission to attach the Volume by a ResourceTag condition.If you are looking to grant an Instance, AutoScalingGroup, EC2-Fleet, SpotFleet, ECS host, etc the ability to attach this volume to itself then this is the method you want to use.
This is implemented by adding a Tag with key
VolumeGrantAttach-<suffix>to the given constructs and this Volume, and then conditioning the Grant such that the grantee is only given the ability to AttachVolume if both the Volume and the destination Instance have that tag applied to them.- Specified by:
grantAttachVolumeByResourceTagin interfaceIVolume- Parameters:
grantee- This parameter is required.constructs- This parameter is required.tagKeySuffix-
-
grantAttachVolumeByResourceTag
@Stability(Stable) @NotNull public Grant grantAttachVolumeByResourceTag(@NotNull IGrantable grantee, @NotNull List<software.constructs.Construct> constructs) Grants permission to attach the Volume by a ResourceTag condition.If you are looking to grant an Instance, AutoScalingGroup, EC2-Fleet, SpotFleet, ECS host, etc the ability to attach this volume to itself then this is the method you want to use.
This is implemented by adding a Tag with key
VolumeGrantAttach-<suffix>to the given constructs and this Volume, and then conditioning the Grant such that the grantee is only given the ability to AttachVolume if both the Volume and the destination Instance have that tag applied to them.- Specified by:
grantAttachVolumeByResourceTagin interfaceIVolume- Parameters:
grantee- This parameter is required.constructs- This parameter is required.
-
grantDetachVolume
@Stability(Stable) @NotNull public Grant grantDetachVolume(@NotNull IGrantable grantee, @Nullable List<IInstanceRef> instances) Grants permission to detach this Volume from an instance CAUTION: Granting an instance permission to detach from itself using this method will lead to an unresolvable circular reference between the instance role and the instance.Use
IVolume.grantDetachVolumeFromSelfto grant an instance permission to detach this volume from itself.- Specified by:
grantDetachVolumein interfaceIVolume- Parameters:
grantee- This parameter is required.instances-
-
grantDetachVolume
Grants permission to detach this Volume from an instance CAUTION: Granting an instance permission to detach from itself using this method will lead to an unresolvable circular reference between the instance role and the instance.Use
IVolume.grantDetachVolumeFromSelfto grant an instance permission to detach this volume from itself.- Specified by:
grantDetachVolumein interfaceIVolume- Parameters:
grantee- This parameter is required.
-
grantDetachVolumeByResourceTag
@Stability(Stable) @NotNull public Grant grantDetachVolumeByResourceTag(@NotNull IGrantable grantee, @NotNull List<software.constructs.Construct> constructs, @Nullable String tagKeySuffix) Grants permission to detach the Volume by a ResourceTag condition.This is implemented via the same mechanism as
IVolume.grantAttachVolumeByResourceTag, and is subject to the same conditions.- Specified by:
grantDetachVolumeByResourceTagin interfaceIVolume- Parameters:
grantee- This parameter is required.constructs- This parameter is required.tagKeySuffix-
-
grantDetachVolumeByResourceTag
@Stability(Stable) @NotNull public Grant grantDetachVolumeByResourceTag(@NotNull IGrantable grantee, @NotNull List<software.constructs.Construct> constructs) Grants permission to detach the Volume by a ResourceTag condition.This is implemented via the same mechanism as
IVolume.grantAttachVolumeByResourceTag, and is subject to the same conditions.- Specified by:
grantDetachVolumeByResourceTagin interfaceIVolume- Parameters:
grantee- This parameter is required.constructs- This parameter is required.
-
validateProps
- Parameters:
props- This parameter is required.
-
getAvailabilityZone
The availability zone that the EBS Volume is contained within (ex: us-west-2a).- Specified by:
getAvailabilityZonein interfaceIVolume
-
getVolumeId
The EBS Volume's ID.- Specified by:
getVolumeIdin interfaceIVolume
-
getVolumeRef
A reference to a Volume resource.- Specified by:
getVolumeRefin interfaceIVolumeRef
-
getEncryptionKey
The customer-managed encryption key that is used to encrypt the Volume.- Specified by:
getEncryptionKeyin interfaceIVolume
-