/AWS1/CL_EC2=>CREATESNAPSHOT()
¶
About CreateSnapshot¶
Creates a snapshot of an EBS volume and stores it in Amazon S3. You can use snapshots for backups, to make copies of EBS volumes, and to save data before shutting down an instance.
The location of the source EBS volume determines where you can create the snapshot.
-
If the source volume is in a Region, you must create the snapshot in the same Region as the volume.
-
If the source volume is in a Local Zone, you can create the snapshot in the same Local Zone or in its parent Amazon Web Services Region.
-
If the source volume is on an Outpost, you can create the snapshot on the same Outpost or in its parent Amazon Web Services Region.
When a snapshot is created, any Amazon Web Services Marketplace product codes that are associated with the source volume are propagated to the snapshot.
You can take a snapshot of an attached volume that is in use. However, snapshots only
capture data that has been written to your Amazon EBS volume at the time the snapshot command is
issued; this might exclude any data that has been cached by any applications or the operating
system. If you can pause any file systems on the volume long enough to take a snapshot, your
snapshot should be complete. However, if you cannot pause all file writes to the volume, you
should unmount the volume from within the instance, issue the snapshot command, and then
remount the volume to ensure a consistent and complete snapshot. You may remount and use your
volume while the snapshot status is pending
.
When you create a snapshot for an EBS volume that serves as a root device, we recommend that you stop the instance before taking the snapshot.
Snapshots that are taken from encrypted volumes are automatically encrypted. Volumes that are created from encrypted snapshots are also automatically encrypted. Your encrypted volumes and any associated snapshots always remain protected. For more information, see Amazon EBS encryption in the Amazon EBS User Guide.
Method Signature¶
IMPORTING¶
Required arguments:¶
iv_volumeid
TYPE /AWS1/EC2VOLUMEID
/AWS1/EC2VOLUMEID
¶
The ID of the Amazon EBS volume.
Optional arguments:¶
iv_description
TYPE /AWS1/EC2STRING
/AWS1/EC2STRING
¶
A description for the snapshot.
iv_outpostarn
TYPE /AWS1/EC2STRING
/AWS1/EC2STRING
¶
Only supported for volumes on Outposts. If the source volume is not on an Outpost, omit this parameter.
To create the snapshot on the same Outpost as the source volume, specify the ARN of that Outpost. The snapshot must be created on the same Outpost as the volume.
To create the snapshot in the parent Region of the Outpost, omit this parameter.
For more information, see Create local snapshots from volumes on an Outpost in the Amazon EBS User Guide.
it_tagspecifications
TYPE /AWS1/CL_EC2TAGSPECIFICATION=>TT_TAGSPECIFICATIONLIST
TT_TAGSPECIFICATIONLIST
¶
The tags to apply to the snapshot during creation.
iv_location
TYPE /AWS1/EC2SNAPSHOTLOCATIONENUM
/AWS1/EC2SNAPSHOTLOCATIONENUM
¶
Only supported for volumes in Local Zones. If the source volume is not in a Local Zone, omit this parameter.
To create a local snapshot in the same Local Zone as the source volume, specify
local
.To create a regional snapshot in the parent Region of the Local Zone, specify
regional
or omit this parameter.Default value:
regional
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_ec2snapshot
/AWS1/CL_EC2SNAPSHOT
¶
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->/aws1/if_ec2~createsnapshot(
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_description = |string|
iv_dryrun = ABAP_TRUE
iv_location = |string|
iv_outpostarn = |string|
iv_volumeid = |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_owneralias( ).
lv_string = lo_result->get_outpostarn( ).
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_storagetier = lo_result->get_storagetier( ).
lv_milliseconddatetime = lo_result->get_restoreexpirytime( ).
lv_ssetype = lo_result->get_ssetype( ).
lv_string = lo_result->get_availabilityzone( ).
lv_transfertype = lo_result->get_transfertype( ).
lv_snapshotcompletiondurat = lo_result->get_completiondurminutes( ).
lv_milliseconddatetime = lo_result->get_completiontime( ).
lv_long = lo_result->get_fullsnapshotsizeinbytes( ).
lv_string = lo_result->get_snapshotid( ).
lv_string = lo_result->get_volumeid( ).
lv_snapshotstate = lo_result->get_state( ).
lv_string = lo_result->get_statemessage( ).
lv_datetime = lo_result->get_starttime( ).
lv_string = lo_result->get_progress( ).
lv_string = lo_result->get_ownerid( ).
lv_string = lo_result->get_description( ).
lv_integer = lo_result->get_volumesize( ).
lv_boolean = lo_result->get_encrypted( ).
lv_string = lo_result->get_kmskeyid( ).
lv_string = lo_result->get_dataencryptionkeyid( ).
ENDIF.
To create a snapshot¶
This example creates a snapshot of the volume with a volume ID of vol-1234567890abcdef0
and a short description to identify the snapshot.
DATA(lo_result) = lo_client->/aws1/if_ec2~createsnapshot(
iv_description = |This is my root volume snapshot.|
iv_volumeid = |vol-1234567890abcdef0|
).