/AWS1/CL_ECA=>COPYSNAPSHOT()
¶
About CopySnapshot¶
Makes a copy of an existing snapshot.
This operation is valid for Valkey or Redis OSS only.
Users or groups that have permissions to use the CopySnapshot
operation can create their own Amazon S3 buckets and copy snapshots to it. To
control access to your snapshots, use an IAM policy to control who has the ability
to use the CopySnapshot
operation. For more information about using IAM
to control the use of ElastiCache operations, see Exporting
Snapshots and Authentication & Access
Control.
You could receive the following error messages.
Error Messages
-
Error Message: The S3 bucket %s is outside of the region.
Solution: Create an Amazon S3 bucket in the same region as your snapshot. For more information, see Step 1: Create an Amazon S3 Bucket in the ElastiCache User Guide.
-
Error Message: The S3 bucket %s does not exist.
Solution: Create an Amazon S3 bucket in the same region as your snapshot. For more information, see Step 1: Create an Amazon S3 Bucket in the ElastiCache User Guide.
-
Error Message: The S3 bucket %s is not owned by the authenticated user.
Solution: Create an Amazon S3 bucket in the same region as your snapshot. For more information, see Step 1: Create an Amazon S3 Bucket in the ElastiCache User Guide.
-
Error Message: The authenticated user does not have sufficient permissions to perform the desired activity.
Solution: Contact your system administrator to get the needed permissions.
-
Error Message: The S3 bucket %s already contains an object with key %s.
Solution: Give the
TargetSnapshotName
a new and unique value. If exporting a snapshot, you could alternatively create a new Amazon S3 bucket and use this same value forTargetSnapshotName
. -
Error Message: ElastiCache has not been granted READ permissions %s on the S3 Bucket.
Solution: Add List and Read permissions on the bucket. For more information, see Step 2: Grant ElastiCache Access to Your Amazon S3 Bucket in the ElastiCache User Guide.
-
Error Message: ElastiCache has not been granted WRITE permissions %s on the S3 Bucket.
Solution: Add Upload/Delete permissions on the bucket. For more information, see Step 2: Grant ElastiCache Access to Your Amazon S3 Bucket in the ElastiCache User Guide.
-
Error Message: ElastiCache has not been granted READ_ACP permissions %s on the S3 Bucket.
Solution: Add View Permissions on the bucket. For more information, see Step 2: Grant ElastiCache Access to Your Amazon S3 Bucket in the ElastiCache User Guide.
Method Signature¶
IMPORTING¶
Required arguments:¶
iv_sourcesnapshotname
TYPE /AWS1/ECASTRING
/AWS1/ECASTRING
¶
The name of an existing snapshot from which to make a copy.
iv_targetsnapshotname
TYPE /AWS1/ECASTRING
/AWS1/ECASTRING
¶
A name for the snapshot copy. ElastiCache does not permit overwriting a snapshot, therefore this name must be unique within its context - ElastiCache or an Amazon S3 bucket if exporting.
Optional arguments:¶
iv_targetbucket
TYPE /AWS1/ECASTRING
/AWS1/ECASTRING
¶
The Amazon S3 bucket to which the snapshot is exported. This parameter is used only when exporting a snapshot for external access.
When using this parameter to export a snapshot, be sure Amazon ElastiCache has the needed permissions to this S3 bucket. For more information, see Step 2: Grant ElastiCache Access to Your Amazon S3 Bucket in the Amazon ElastiCache User Guide.
For more information, see Exporting a Snapshot in the Amazon ElastiCache User Guide.
iv_kmskeyid
TYPE /AWS1/ECASTRING
/AWS1/ECASTRING
¶
The ID of the KMS key used to encrypt the target snapshot.
it_tags
TYPE /AWS1/CL_ECATAG=>TT_TAGLIST
TT_TAGLIST
¶
A list of tags to be added to this resource. A tag is a key-value pair. A tag key must be accompanied by a tag value, although null is accepted.
RETURNING¶
oo_output
TYPE REF TO /aws1/cl_ecacopysnapshotresult
/AWS1/CL_ECACOPYSNAPSHOTRESULT
¶
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_eca~copysnapshot(
it_tags = VALUE /aws1/cl_ecatag=>tt_taglist(
(
new /aws1/cl_ecatag(
iv_key = |string|
iv_value = |string|
)
)
)
iv_kmskeyid = |string|
iv_sourcesnapshotname = |string|
iv_targetbucket = |string|
iv_targetsnapshotname = |string|
).
This is an example of reading all possible response values
lo_result = lo_result.
IF lo_result IS NOT INITIAL.
lo_snapshot = lo_result->get_snapshot( ).
IF lo_snapshot IS NOT INITIAL.
lv_string = lo_snapshot->get_snapshotname( ).
lv_string = lo_snapshot->get_replicationgroupid( ).
lv_string = lo_snapshot->get_replicationgroupdesc( ).
lv_string = lo_snapshot->get_cacheclusterid( ).
lv_string = lo_snapshot->get_snapshotstatus( ).
lv_string = lo_snapshot->get_snapshotsource( ).
lv_string = lo_snapshot->get_cachenodetype( ).
lv_string = lo_snapshot->get_engine( ).
lv_string = lo_snapshot->get_engineversion( ).
lv_integeroptional = lo_snapshot->get_numcachenodes( ).
lv_string = lo_snapshot->get_preferredaz( ).
lv_string = lo_snapshot->get_preferredoutpostarn( ).
lv_tstamp = lo_snapshot->get_cacheclustercreatetime( ).
lv_string = lo_snapshot->get_preferredmaintenancewi00( ).
lv_string = lo_snapshot->get_topicarn( ).
lv_integeroptional = lo_snapshot->get_port( ).
lv_string = lo_snapshot->get_cacheparametergroupname( ).
lv_string = lo_snapshot->get_cachesubnetgroupname( ).
lv_string = lo_snapshot->get_vpcid( ).
lv_boolean = lo_snapshot->get_autominorversionupgrade( ).
lv_integeroptional = lo_snapshot->get_snapshotretentionlimit( ).
lv_string = lo_snapshot->get_snapshotwindow( ).
lv_integeroptional = lo_snapshot->get_numnodegroups( ).
lv_automaticfailoverstatus = lo_snapshot->get_automaticfailover( ).
LOOP AT lo_snapshot->get_nodesnapshots( ) into lo_row.
lo_row_1 = lo_row.
IF lo_row_1 IS NOT INITIAL.
lv_string = lo_row_1->get_cacheclusterid( ).
lv_string = lo_row_1->get_nodegroupid( ).
lv_string = lo_row_1->get_cachenodeid( ).
lo_nodegroupconfiguration = lo_row_1->get_nodegroupconfiguration( ).
IF lo_nodegroupconfiguration IS NOT INITIAL.
lv_allowednodegroupid = lo_nodegroupconfiguration->get_nodegroupid( ).
lv_string = lo_nodegroupconfiguration->get_slots( ).
lv_integeroptional = lo_nodegroupconfiguration->get_replicacount( ).
lv_string = lo_nodegroupconfiguration->get_primaryavailabilityzone( ).
LOOP AT lo_nodegroupconfiguration->get_replicaavailabilityzones( ) into lo_row_2.
lo_row_3 = lo_row_2.
IF lo_row_3 IS NOT INITIAL.
lv_string = lo_row_3->get_value( ).
ENDIF.
ENDLOOP.
lv_string = lo_nodegroupconfiguration->get_primaryoutpostarn( ).
LOOP AT lo_nodegroupconfiguration->get_replicaoutpostarns( ) into lo_row_4.
lo_row_5 = lo_row_4.
IF lo_row_5 IS NOT INITIAL.
lv_string = lo_row_5->get_value( ).
ENDIF.
ENDLOOP.
ENDIF.
lv_string = lo_row_1->get_cachesize( ).
lv_tstamp = lo_row_1->get_cachenodecreatetime( ).
lv_tstamp = lo_row_1->get_snapshotcreatetime( ).
ENDIF.
ENDLOOP.
lv_string = lo_snapshot->get_kmskeyid( ).
lv_string = lo_snapshot->get_arn( ).
lv_datatieringstatus = lo_snapshot->get_datatiering( ).
ENDIF.
ENDIF.
CopySnapshot¶
Copies a snapshot to a specified name.
DATA(lo_result) = lo_client->/aws1/if_eca~copysnapshot(
iv_sourcesnapshotname = |my-snapshot|
iv_targetbucket = ||
iv_targetsnapshotname = |my-snapshot-copy|
).