Interface IVolume
An EBS Volume in AWS EC2.
Namespace: Amazon.CDK.AWS.EC2
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public interface IVolume : IResource
Syntax (vb)
Public Interface IVolume
Inherits IResource, IConstruct, IDependable
Synopsis
Properties
AvailabilityZone | The availability zone that the EBS Volume is contained within (ex: us-west-2a). |
EncryptionKey | The customer-managed encryption key that is used to encrypt the Volume. |
VolumeId | The EBS Volume's ID. |
Methods
GrantAttachVolume(IGrantable, IInstance[]) | Grants permission to attach this Volume to an instance. |
GrantAttachVolumeByResourceTag(IGrantable, Construct[], String) | Grants permission to attach the Volume by a ResourceTag condition. |
GrantDetachVolume(IGrantable, IInstance[]) | 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, Construct[], String) | Grants permission to detach the Volume by a ResourceTag condition. |
Properties
AvailabilityZone
The availability zone that the EBS Volume is contained within (ex: us-west-2a).
string AvailabilityZone { get; }
Property Value
System.String
EncryptionKey
The customer-managed encryption key that is used to encrypt the Volume.
virtual IKey EncryptionKey { get; }
Property Value
Remarks
Attribute: true
VolumeId
The EBS Volume's ID.
string VolumeId { get; }
Property Value
System.String
Remarks
Attribute: true
Methods
GrantAttachVolume(IGrantable, IInstance[])
Grants permission to attach this Volume to an instance.
Grant GrantAttachVolume(IGrantable grantee, IInstance[] instances = null)
Parameters
- grantee IGrantable
the principal being granted permission.
- instances IInstance[]
the instances to which permission is being granted to attach this volume to.
Returns
Remarks
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.grantAttachVolumeToSelf
to grant an instance permission to attach this
volume to itself.
GrantAttachVolumeByResourceTag(IGrantable, Construct[], String)
Grants permission to attach the Volume by a ResourceTag condition.
Grant GrantAttachVolumeByResourceTag(IGrantable grantee, Construct[] constructs, string tagKeySuffix = null)
Parameters
- grantee IGrantable
the principal being granted permission.
- constructs Constructs.Construct[]
The list of constructs that will have the generated resource tag applied to them.
- tagKeySuffix System.String
A suffix to use on the generated Tag key in place of the generated hash value.
Returns
Remarks
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.
GrantDetachVolume(IGrantable, IInstance[])
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.
Grant GrantDetachVolume(IGrantable grantee, IInstance[] instances = null)
Parameters
- grantee IGrantable
the principal being granted permission.
- instances IInstance[]
the instances to which permission is being granted to detach this volume from.
Returns
Remarks
Use IVolume.grantDetachVolumeFromSelf
to grant an instance permission to detach this
volume from itself.
GrantDetachVolumeByResourceTag(IGrantable, Construct[], String)
Grants permission to detach the Volume by a ResourceTag condition.
Grant GrantDetachVolumeByResourceTag(IGrantable grantee, Construct[] constructs, string tagKeySuffix = null)
Parameters
- grantee IGrantable
the principal being granted permission.
- constructs Constructs.Construct[]
The list of constructs that will have the generated resource tag applied to them.
- tagKeySuffix System.String
A suffix to use on the generated Tag key in place of the generated hash value.
Returns
Remarks
This is implemented via the same mechanism as IVolume.grantAttachVolumeByResourceTag
,
and is subject to the same conditions.