/AWS1/IF_EC2=>CREATEVOLUME()¶
About CreateVolume¶
Creates an EBS volume that can be attached to an instance in the same Availability Zone.
You can create a new empty volume or restore a volume from an EBS snapshot. Any Amazon Web Services Marketplace product codes from the snapshot are propagated to the volume.
You can create encrypted volumes. Encrypted volumes must be attached to instances that support Amazon EBS encryption. Volumes that are created from encrypted snapshots are also automatically encrypted. For more information, see Amazon EBS encryption in the Amazon EBS User Guide.
You can tag your volumes during creation. For more information, see Tag your Amazon EC2 resources in the Amazon EC2 User Guide.
For more information, see Create an Amazon EBS volume in the Amazon EBS User Guide.
Method Signature¶
METHODS /AWS1/IF_EC2~CREATEVOLUME
IMPORTING
!IV_AVAILABILITYZONE TYPE /AWS1/EC2AVAILABILITYZONENAME OPTIONAL
!IV_AVAILABILITYZONEID TYPE /AWS1/EC2AVAILABILITYZONEID OPTIONAL
!IV_ENCRYPTED TYPE /AWS1/EC2BOOLEAN OPTIONAL
!IV_IOPS TYPE /AWS1/EC2INTEGER OPTIONAL
!IV_KMSKEYID TYPE /AWS1/EC2KMSKEYID OPTIONAL
!IV_OUTPOSTARN TYPE /AWS1/EC2STRING OPTIONAL
!IV_SIZE TYPE /AWS1/EC2INTEGER OPTIONAL
!IV_SNAPSHOTID TYPE /AWS1/EC2SNAPSHOTID OPTIONAL
!IV_VOLUMETYPE TYPE /AWS1/EC2VOLUMETYPE OPTIONAL
!IT_TAGSPECIFICATIONS TYPE /AWS1/CL_EC2TAGSPECIFICATION=>TT_TAGSPECIFICATIONLIST OPTIONAL
!IV_MULTIATTACHENABLED TYPE /AWS1/EC2BOOLEAN OPTIONAL
!IV_THROUGHPUT TYPE /AWS1/EC2INTEGER OPTIONAL
!IV_CLIENTTOKEN TYPE /AWS1/EC2STRING OPTIONAL
!IV_VOLUMEINITIALIZATIONRATE TYPE /AWS1/EC2INTEGER OPTIONAL
!IO_OPERATOR TYPE REF TO /AWS1/CL_EC2OPERATORREQUEST OPTIONAL
!IV_DRYRUN TYPE /AWS1/EC2BOOLEAN OPTIONAL
RETURNING
VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_ec2volume
RAISING
/AWS1/CX_EC2CLIENTEXC
/AWS1/CX_EC2SERVEREXC
/AWS1/CX_RT_TECHNICAL_GENERIC
/AWS1/CX_RT_SERVICE_GENERIC.
IMPORTING¶
Optional arguments:¶
iv_availabilityzone TYPE /AWS1/EC2AVAILABILITYZONENAME /AWS1/EC2AVAILABILITYZONENAME¶
The ID of the Availability Zone in which to create the volume. For example,
us-east-1a.Either
AvailabilityZoneorAvailabilityZoneIdmust be specified, but not both.
iv_availabilityzoneid TYPE /AWS1/EC2AVAILABILITYZONEID /AWS1/EC2AVAILABILITYZONEID¶
The ID of the Availability Zone in which to create the volume. For example,
use1-az1.Either
AvailabilityZoneorAvailabilityZoneIdmust be specified, but not both.
iv_encrypted TYPE /AWS1/EC2BOOLEAN /AWS1/EC2BOOLEAN¶
Indicates whether the volume should be encrypted. The effect of setting the encryption state to
truedepends on the volume origin (new or from a snapshot), starting encryption state, ownership, and whether encryption by default is enabled. For more information, see Encryption by default in the Amazon EBS User Guide.Encrypted Amazon EBS volumes must be attached to instances that support Amazon EBS encryption. For more information, see Supported instance types.
iv_iops TYPE /AWS1/EC2INTEGER /AWS1/EC2INTEGER¶
The number of I/O operations per second (IOPS) to provision for the volume. Required for
io1andio2volumes. Optional forgp3volumes. Omit for all other volume types.Valid ranges:
gp3:
3,000(default)- 80,000IOPSio1:
100 - 64,000IOPSio2:
100 - 256,000IOPSInstances built on the Nitro System can support up to 256,000 IOPS. Other instances can support up to 32,000 IOPS.
iv_kmskeyid TYPE /AWS1/EC2KMSKEYID /AWS1/EC2KMSKEYID¶
The identifier of the KMS key to use for Amazon EBS encryption. If this parameter is not specified, your KMS key for Amazon EBS is used. If
KmsKeyIdis specified, the encrypted state must betrue.You can specify the KMS key using any of the following:
Key ID. For example, 1234abcd-12ab-34cd-56ef-1234567890ab.
Key alias. For example, alias/ExampleAlias.
Key ARN. For example, arn:aws:kms:us-east-1:012345678910:key/1234abcd-12ab-34cd-56ef-1234567890ab.
Alias ARN. For example, arn:aws:kms:us-east-1:012345678910:alias/ExampleAlias.
Amazon Web Services authenticates the KMS key asynchronously. Therefore, if you specify an ID, alias, or ARN that is not valid, the action can appear to complete, but eventually fails.
iv_outpostarn TYPE /AWS1/EC2STRING /AWS1/EC2STRING¶
The Amazon Resource Name (ARN) of the Outpost on which to create the volume.
If you intend to use a volume with an instance running on an outpost, then you must create the volume on the same outpost as the instance. You can't use a volume created in an Amazon Web Services Region with an instance on an Amazon Web Services outpost, or the other way around.
iv_size TYPE /AWS1/EC2INTEGER /AWS1/EC2INTEGER¶
The size of the volume, in GiBs. You must specify either a snapshot ID or a volume size. If you specify a snapshot, the default is the snapshot size, and you can specify a volume size that is equal to or larger than the snapshot size.
Valid sizes:
gp2:
1 - 16,384GiBgp3:
1 - 65,536GiBio1:
4 - 16,384GiBio2:
4 - 65,536GiBst1 and sc1:
125 - 16,384GiBstandard:
1 - 1024GiB
iv_snapshotid TYPE /AWS1/EC2SNAPSHOTID /AWS1/EC2SNAPSHOTID¶
The snapshot from which to create the volume. You must specify either a snapshot ID or a volume size.
iv_volumetype TYPE /AWS1/EC2VOLUMETYPE /AWS1/EC2VOLUMETYPE¶
The volume type. This parameter can be one of the following values:
General Purpose SSD:
gp2|gp3Provisioned IOPS SSD:
io1|io2Throughput Optimized HDD:
st1Cold HDD:
sc1Magnetic:
standardThroughput Optimized HDD (
st1) and Cold HDD (sc1) volumes can't be used as boot volumes.For more information, see Amazon EBS volume types in the Amazon EBS User Guide.
Default:
gp2
it_tagspecifications TYPE /AWS1/CL_EC2TAGSPECIFICATION=>TT_TAGSPECIFICATIONLIST TT_TAGSPECIFICATIONLIST¶
The tags to apply to the volume during creation.
iv_multiattachenabled TYPE /AWS1/EC2BOOLEAN /AWS1/EC2BOOLEAN¶
Indicates whether to enable Amazon EBS Multi-Attach. If you enable Multi-Attach, you can attach the volume to up to 16 Instances built on the Nitro System in the same Availability Zone. This parameter is supported with
io1andio2volumes only. For more information, see Amazon EBS Multi-Attach in the Amazon EBS User Guide.
iv_throughput TYPE /AWS1/EC2INTEGER /AWS1/EC2INTEGER¶
The throughput to provision for the volume, in MiB/s. Supported for
gp3volumes only. Omit for all other volume types.Valid Range:
125 - 2000MiB/s
iv_clienttoken TYPE /AWS1/EC2STRING /AWS1/EC2STRING¶
Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more information, see Ensure Idempotency.
iv_volumeinitializationrate TYPE /AWS1/EC2INTEGER /AWS1/EC2INTEGER¶
Specifies the Amazon EBS Provisioned Rate for Volume Initialization (volume initialization rate), in MiB/s, at which to download the snapshot blocks from Amazon S3 to the volume. This is also known as volume initialization. Specifying a volume initialization rate ensures that the volume is initialized at a predictable and consistent rate after creation.
This parameter is supported only for volumes created from snapshots. Omit this parameter if:
You want to create the volume using fast snapshot restore. You must specify a snapshot that is enabled for fast snapshot restore. In this case, the volume is fully initialized at creation.
If you specify a snapshot that is enabled for fast snapshot restore and a volume initialization rate, the volume will be initialized at the specified rate instead of fast snapshot restore.
You want to create a volume that is initialized at the default rate.
For more information, see Initialize Amazon EBS volumes in the Amazon EC2 User Guide.
Valid range: 100 - 300 MiB/s
io_operator TYPE REF TO /AWS1/CL_EC2OPERATORREQUEST /AWS1/CL_EC2OPERATORREQUEST¶
Reserved for internal use.
iv_dryrun TYPE /AWS1/EC2BOOLEAN /AWS1/EC2BOOLEAN¶
Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is
DryRunOperation. Otherwise, it isUnauthorizedOperation.
RETURNING¶
oo_output TYPE REF TO /aws1/cl_ec2volume /AWS1/CL_EC2VOLUME¶
Domain /AWS1/RT_ACCOUNT_ID Primitive Type NUMC
Examples¶
Syntax Example¶
This is an example of the syntax for calling the method. It includes every possible argument and initializes every possible value. The data provided is not necessarily semantically accurate (for example the value "string" may be provided for something that is intended to be an instance ID, or in some cases two arguments may be mutually exclusive). The syntax shows the ABAP syntax for creating the various data structures.
DATA(lo_result) = lo_client->createvolume(
io_operator = new /aws1/cl_ec2operatorrequest( |string| )
it_tagspecifications = VALUE /aws1/cl_ec2tagspecification=>tt_tagspecificationlist(
(
new /aws1/cl_ec2tagspecification(
it_tags = VALUE /aws1/cl_ec2tag=>tt_taglist(
(
new /aws1/cl_ec2tag(
iv_key = |string|
iv_value = |string|
)
)
)
iv_resourcetype = |string|
)
)
)
iv_availabilityzone = |string|
iv_availabilityzoneid = |string|
iv_clienttoken = |string|
iv_dryrun = ABAP_TRUE
iv_encrypted = ABAP_TRUE
iv_iops = 123
iv_kmskeyid = |string|
iv_multiattachenabled = ABAP_TRUE
iv_outpostarn = |string|
iv_size = 123
iv_snapshotid = |string|
iv_throughput = 123
iv_volumeinitializationrate = 123
iv_volumetype = |string|
).
This is an example of reading all possible response values
lo_result = lo_result.
IF lo_result IS NOT INITIAL.
lv_string = lo_result->get_availabilityzoneid( ).
lv_string = lo_result->get_outpostarn( ).
lv_string = lo_result->get_sourcevolumeid( ).
lv_integer = lo_result->get_iops( ).
LOOP AT lo_result->get_tags( ) into lo_row.
lo_row_1 = lo_row.
IF lo_row_1 IS NOT INITIAL.
lv_string = lo_row_1->get_key( ).
lv_string = lo_row_1->get_value( ).
ENDIF.
ENDLOOP.
lv_volumetype = lo_result->get_volumetype( ).
lv_boolean = lo_result->get_fastrestored( ).
lv_boolean = lo_result->get_multiattachenabled( ).
lv_integer = lo_result->get_throughput( ).
lv_ssetype = lo_result->get_ssetype( ).
lo_operatorresponse = lo_result->get_operator( ).
IF lo_operatorresponse IS NOT INITIAL.
lv_boolean = lo_operatorresponse->get_managed( ).
lv_string = lo_operatorresponse->get_principal( ).
ENDIF.
lv_integer = lo_result->get_volumeinitializationrate( ).
lv_string = lo_result->get_volumeid( ).
lv_integer = lo_result->get_size( ).
lv_string = lo_result->get_snapshotid( ).
lv_string = lo_result->get_availabilityzone( ).
lv_volumestate = lo_result->get_state( ).
lv_datetime = lo_result->get_createtime( ).
LOOP AT lo_result->get_attachments( ) into lo_row_2.
lo_row_3 = lo_row_2.
IF lo_row_3 IS NOT INITIAL.
lv_boolean = lo_row_3->get_deleteontermination( ).
lv_string = lo_row_3->get_associatedresource( ).
lv_string = lo_row_3->get_instanceowningservice( ).
lv_string = lo_row_3->get_volumeid( ).
lv_string = lo_row_3->get_instanceid( ).
lv_string = lo_row_3->get_device( ).
lv_volumeattachmentstate = lo_row_3->get_state( ).
lv_datetime = lo_row_3->get_attachtime( ).
ENDIF.
ENDLOOP.
lv_boolean = lo_result->get_encrypted( ).
lv_string = lo_result->get_kmskeyid( ).
ENDIF.
To create a new Provisioned IOPS (SSD) volume from a snapshot¶
This example creates a new Provisioned IOPS (SSD) volume with 1000 provisioned IOPS from a snapshot in the Availability Zone us-east-1a.
DATA(lo_result) = lo_client->createvolume(
iv_availabilityzone = |us-east-1a|
iv_iops = 1000
iv_snapshotid = |snap-066877671789bd71b|
iv_volumetype = |io1|
).
To create a new volume¶
This example creates an 80 GiB General Purpose (SSD) volume in the Availability Zone us-east-1a.
DATA(lo_result) = lo_client->createvolume(
iv_availabilityzone = |us-east-1a|
iv_size = 80
iv_volumetype = |gp2|
).