Skip to content

/AWS1/IF_EC2=>COPYVOLUMES()

About CopyVolumes

Creates a crash-consistent, point-in-time copy of an existing Amazon EBS volume within the same Availability Zone. The volume copy can be attached to an Amazon EC2 instance once it reaches the available state. For more information, see Copy an Amazon EBS volume.

Method Signature

METHODS /AWS1/IF_EC2~COPYVOLUMES
  IMPORTING
    !IV_SOURCEVOLUMEID TYPE /AWS1/EC2VOLUMEID OPTIONAL
    !IV_IOPS TYPE /AWS1/EC2INTEGER OPTIONAL
    !IV_SIZE TYPE /AWS1/EC2INTEGER OPTIONAL
    !IV_VOLUMETYPE TYPE /AWS1/EC2VOLUMETYPE OPTIONAL
    !IV_DRYRUN TYPE /AWS1/EC2BOOLEAN 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
  RETURNING
    VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_ec2copyvolumesresult
  RAISING
    /AWS1/CX_EC2CLIENTEXC
    /AWS1/CX_EC2SERVEREXC
    /AWS1/CX_RT_TECHNICAL_GENERIC
    /AWS1/CX_RT_SERVICE_GENERIC.

IMPORTING

Required arguments:

iv_sourcevolumeid TYPE /AWS1/EC2VOLUMEID /AWS1/EC2VOLUMEID

The ID of the source EBS volume to copy.

Optional arguments:

iv_iops TYPE /AWS1/EC2INTEGER /AWS1/EC2INTEGER

The number of I/O operations per second (IOPS) to provision for the volume copy. Required for io1 and io2 volumes. Optional for gp3 volumes. Omit for all other volume types. Full provisioned IOPS performance can be achieved only once the volume copy is fully initialized.

Valid ranges:

  • gp3: 3,000 (default) - 80,000 IOPS

  • io1: 100 - 64,000 IOPS

  • io2: 100 - 256,000 IOPS

Instances built on the Nitro System can support up to 256,000 IOPS. Other instances can support up to 32,000 IOPS.

iv_size TYPE /AWS1/EC2INTEGER /AWS1/EC2INTEGER

The size of the volume copy, in GiBs. The size must be equal to or greater than the size of the source volume. If not specified, the size defaults to the size of the source volume.

Maximum supported sizes:

  • gp2: 16,384 GiB

  • gp3: 65,536 GiB

  • io1: 16,384 GiB

  • io2: 65,536 GiB

  • st1 and sc1: 16,384 GiB

  • standard: 1024 GiB

iv_volumetype TYPE /AWS1/EC2VOLUMETYPE /AWS1/EC2VOLUMETYPE

The volume type for the volume copy. If not specified, the volume type defaults to gp2.

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 is UnauthorizedOperation.

it_tagspecifications TYPE /AWS1/CL_EC2TAGSPECIFICATION=>TT_TAGSPECIFICATIONLIST TT_TAGSPECIFICATIONLIST

The tags to apply to the volume copy during creation.

iv_multiattachenabled TYPE /AWS1/EC2BOOLEAN /AWS1/EC2BOOLEAN

Indicates whether to enable Amazon EBS Multi-Attach for the volume copy. If you enable Multi-Attach, you can attach the volume to up to 16 Nitro instances in the same Availability Zone simultaneously. Supported with io1 and io2 volumes only. For more information, see Amazon EBS Multi-Attach.

iv_throughput TYPE /AWS1/EC2INTEGER /AWS1/EC2INTEGER

The throughput to provision for the volume copy, in MiB/s. Supported for gp3 volumes only. Omit for all other volume types. Full provisioned throughput performance can be achieved only once the volume copy is fully initialized.

Valid Range: 125 - 2000 MiB/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.

RETURNING

oo_output TYPE REF TO /aws1/cl_ec2copyvolumesresult /AWS1/CL_EC2COPYVOLUMESRESULT

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->copyvolumes(
  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_clienttoken = |string|
  iv_dryrun = ABAP_TRUE
  iv_iops = 123
  iv_multiattachenabled = ABAP_TRUE
  iv_size = 123
  iv_sourcevolumeid = |string|
  iv_throughput = 123
  iv_volumetype = |string|
).

This is an example of reading all possible response values

lo_result = lo_result.
IF lo_result IS NOT INITIAL.
  LOOP AT lo_result->get_volumes( ) into lo_row.
    lo_row_1 = lo_row.
    IF lo_row_1 IS NOT INITIAL.
      lv_string = lo_row_1->get_availabilityzoneid( ).
      lv_string = lo_row_1->get_outpostarn( ).
      lv_string = lo_row_1->get_sourcevolumeid( ).
      lv_integer = lo_row_1->get_iops( ).
      LOOP AT lo_row_1->get_tags( ) into lo_row_2.
        lo_row_3 = lo_row_2.
        IF lo_row_3 IS NOT INITIAL.
          lv_string = lo_row_3->get_key( ).
          lv_string = lo_row_3->get_value( ).
        ENDIF.
      ENDLOOP.
      lv_volumetype = lo_row_1->get_volumetype( ).
      lv_boolean = lo_row_1->get_fastrestored( ).
      lv_boolean = lo_row_1->get_multiattachenabled( ).
      lv_integer = lo_row_1->get_throughput( ).
      lv_ssetype = lo_row_1->get_ssetype( ).
      lo_operatorresponse = lo_row_1->get_operator( ).
      IF lo_operatorresponse IS NOT INITIAL.
        lv_boolean = lo_operatorresponse->get_managed( ).
        lv_string = lo_operatorresponse->get_principal( ).
      ENDIF.
      lv_integer = lo_row_1->get_volumeinitializationrate( ).
      lv_string = lo_row_1->get_volumeid( ).
      lv_integer = lo_row_1->get_size( ).
      lv_string = lo_row_1->get_snapshotid( ).
      lv_string = lo_row_1->get_availabilityzone( ).
      lv_volumestate = lo_row_1->get_state( ).
      lv_datetime = lo_row_1->get_createtime( ).
      LOOP AT lo_row_1->get_attachments( ) into lo_row_4.
        lo_row_5 = lo_row_4.
        IF lo_row_5 IS NOT INITIAL.
          lv_boolean = lo_row_5->get_deleteontermination( ).
          lv_string = lo_row_5->get_associatedresource( ).
          lv_string = lo_row_5->get_instanceowningservice( ).
          lv_string = lo_row_5->get_volumeid( ).
          lv_string = lo_row_5->get_instanceid( ).
          lv_string = lo_row_5->get_device( ).
          lv_volumeattachmentstate = lo_row_5->get_state( ).
          lv_datetime = lo_row_5->get_attachtime( ).
        ENDIF.
      ENDLOOP.
      lv_boolean = lo_row_1->get_encrypted( ).
      lv_string = lo_row_1->get_kmskeyid( ).
    ENDIF.
  ENDLOOP.
ENDIF.