/AWS1/IF_EC2=>COPYSNAPSHOT()¶
About CopySnapshot¶
Creates an exact copy of an Amazon EBS snapshot.
The location of the source snapshot determines whether you can copy it or not, and the allowed destinations for the snapshot copy.
- 
If the source snapshot is in a Region, you can copy it within that Region, to another Region, to an Outpost associated with that Region, or to a Local Zone in that Region. 
- 
If the source snapshot is in a Local Zone, you can copy it within that Local Zone, to another Local Zone in the same zone group, or to the parent Region of the Local Zone. 
- 
If the source snapshot is on an Outpost, you can't copy it. 
When copying snapshots to a Region, the encryption outcome for the snapshot copy depends on the Amazon EBS encryption by default setting for the destination Region, the encryption status of the source snapshot, and the encryption parameters you specify in the request. For more information, see Encryption and snapshot copying.
Snapshots copied to an Outpost must be encrypted. Unencrypted snapshots are not supported on Outposts. For more information, Amazon EBS local snapshots on Outposts.
Snapshots copies have an arbitrary source volume ID. Do not use this volume ID for any purpose.
For more information, see Copy an Amazon EBS snapshot in the Amazon EBS User Guide.
Method Signature¶
METHODS /AWS1/IF_EC2~COPYSNAPSHOT
  IMPORTING
    !IV_DESCRIPTION TYPE /AWS1/EC2STRING OPTIONAL
    !IV_DESTINATIONOUTPOSTARN TYPE /AWS1/EC2STRING OPTIONAL
    !IV_DESTINATIONREGION TYPE /AWS1/EC2STRING OPTIONAL
    !IV_ENCRYPTED TYPE /AWS1/EC2BOOLEAN OPTIONAL
    !IV_KMSKEYID TYPE /AWS1/EC2KMSKEYID OPTIONAL
    !IV_PRESIGNEDURL TYPE /AWS1/EC2COPYSNAPREQUESTPSU OPTIONAL
    !IV_SOURCEREGION TYPE /AWS1/EC2STRING OPTIONAL
    !IV_SOURCESNAPSHOTID TYPE /AWS1/EC2STRING OPTIONAL
    !IT_TAGSPECIFICATIONS TYPE /AWS1/CL_EC2TAGSPECIFICATION=>TT_TAGSPECIFICATIONLIST OPTIONAL
    !IV_COMPLETIONDURATIONMINUTES TYPE /AWS1/EC2SNAPCOMPLETIONDURMI00 OPTIONAL
    !IV_DESTINATIONAZ TYPE /AWS1/EC2STRING OPTIONAL
    !IV_DRYRUN TYPE /AWS1/EC2BOOLEAN OPTIONAL
  RETURNING
    VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_ec2copysnapshotresult
  RAISING
    /AWS1/CX_EC2CLIENTEXC
    /AWS1/CX_EC2SERVEREXC
    /AWS1/CX_RT_TECHNICAL_GENERIC
    /AWS1/CX_RT_SERVICE_GENERIC.
IMPORTING¶
Required arguments:¶
iv_sourceregion TYPE /AWS1/EC2STRING /AWS1/EC2STRING¶
The ID of the Region that contains the snapshot to be copied.
iv_sourcesnapshotid TYPE /AWS1/EC2STRING /AWS1/EC2STRING¶
The ID of the EBS snapshot to copy.
Optional arguments:¶
iv_description TYPE /AWS1/EC2STRING /AWS1/EC2STRING¶
A description for the EBS snapshot.
iv_destinationoutpostarn TYPE /AWS1/EC2STRING /AWS1/EC2STRING¶
The Amazon Resource Name (ARN) of the Outpost to which to copy the snapshot.
Only supported when copying a snapshot to an Outpost.
For more information, see Copy snapshots from an Amazon Web Services Region to an Outpost in the Amazon EBS User Guide.
iv_destinationregion TYPE /AWS1/EC2STRING /AWS1/EC2STRING¶
The destination Region to use in the
PresignedUrlparameter of a snapshot copy operation. This parameter is only valid for specifying the destination Region in aPresignedUrlparameter, where it is required.The snapshot copy is sent to the regional endpoint that you sent the HTTP request to (for example,
ec2.us-east-1.amazonaws.com). With the CLI, this is specified using the--regionparameter or the default Region in your Amazon Web Services configuration file.
iv_encrypted TYPE /AWS1/EC2BOOLEAN /AWS1/EC2BOOLEAN¶
To encrypt a copy of an unencrypted snapshot if encryption by default is not enabled, enable encryption using this parameter. Otherwise, omit this parameter. Copies of encrypted snapshots are encrypted, even if you omit this parameter and encryption by default is not enabled. You cannot set this parameter to false. For more information, see Amazon EBS encryption in the Amazon EBS User Guide.
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_presignedurl TYPE /AWS1/EC2COPYSNAPREQUESTPSU /AWS1/EC2COPYSNAPREQUESTPSU¶
When you copy an encrypted source snapshot using the Amazon EC2 Query API, you must supply a pre-signed URL. This parameter is optional for unencrypted snapshots. For more information, see Query requests.
The
PresignedUrlshould use the snapshot source endpoint, theCopySnapshotaction, and include theSourceRegion,SourceSnapshotId, andDestinationRegionparameters. ThePresignedUrlmust be signed using Amazon Web Services Signature Version 4. Because EBS snapshots are stored in Amazon S3, the signing algorithm for this parameter uses the same logic that is described in Authenticating Requests: Using Query Parameters (Amazon Web Services Signature Version 4) in the Amazon S3 API Reference. An invalid or improperly signedPresignedUrlwill cause the copy operation to fail asynchronously, and the snapshot will move to anerrorstate.
it_tagspecifications TYPE /AWS1/CL_EC2TAGSPECIFICATION=>TT_TAGSPECIFICATIONLIST TT_TAGSPECIFICATIONLIST¶
The tags to apply to the new snapshot.
iv_completiondurationminutes TYPE /AWS1/EC2SNAPCOMPLETIONDURMI00 /AWS1/EC2SNAPCOMPLETIONDURMI00¶
Not supported when copying snapshots to or from Local Zones or Outposts.
Specify a completion duration, in 15 minute increments, to initiate a time-based snapshot copy. Time-based snapshot copy operations complete within the specified duration. For more information, see Time-based copies.
If you do not specify a value, the snapshot copy operation is completed on a best-effort basis.
iv_destinationaz TYPE /AWS1/EC2STRING /AWS1/EC2STRING¶
The Local Zone, for example,
cn-north-1-pkx-1ato which to copy the snapshot.Only supported when copying a snapshot to a Local Zone.
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_ec2copysnapshotresult /AWS1/CL_EC2COPYSNAPSHOTRESULT¶
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->copysnapshot(
  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_completiondurationminutes = 123
  iv_description = |string|
  iv_destinationaz = |string|
  iv_destinationoutpostarn = |string|
  iv_destinationregion = |string|
  iv_dryrun = ABAP_TRUE
  iv_encrypted = ABAP_TRUE
  iv_kmskeyid = |string|
  iv_presignedurl = |string|
  iv_sourceregion = |string|
  iv_sourcesnapshotid = |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_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_string = lo_result->get_snapshotid( ).
ENDIF.
To copy a snapshot¶
This example copies a snapshot with the snapshot ID of snap-066877671789bd71b from the us-west-2 region to the us-east-1 region and adds a short description to identify the snapshot.
DATA(lo_result) = lo_client->copysnapshot(
  iv_description = |This is my copied snapshot.|
  iv_destinationregion = |us-east-1|
  iv_sourceregion = |us-west-2|
  iv_sourcesnapshotid = |snap-066877671789bd71b|
).