All Products
Search
Document Center

Elastic Compute Service:CopySnapshot

Last Updated:Nov 14, 2024

Copies a standard or encrypted snapshot from one region to another.

Operation description

Usage notes

Take note of the following items:

  • New snapshots (snapshot copies) cannot be used to roll back the disks for which source snapshots (copied snapshots) were created.
  • Local snapshots cannot be copied.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
ecs:CopySnapshotcreate
*Snapshot
acs:ecs:{#regionId}:{#accountId}:snapshot/{#snapshotId}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
ResourceGroupIdstringNo

This parameter is not publicly available.

rg-bp67acfmxazb4p****
Tagarray<object>No

The tag key and value of the new snapshot.

objectNo

The tag key and value of the new snapshot.

KeystringNo

The key of tag N to add to the new snapshot. The tag key cannot be an empty string. It can be up to 128 characters in length and cannot start with acs: or aliyun. It cannot contain http:// or https://.

TestKey
ValuestringNo

The value of tag N to add to the new snapshot. The tag value can be an empty string. It can be up to 128 characters in length and cannot start with acs: or aliyun. It cannot contain http:// or https://.

TestValue
RegionIdstringYes

The region ID of the source snapshot. You can call the DescribeRegions operation to query the most recent region list.

cn-chengdu
DestinationRegionIdstringYes

The ID of the destination region to which to copy the source snapshot.

us-east-1
SnapshotIdstringYes

The ID of the source snapshot.

s-bp67acfmxazb4p****
DestinationSnapshotNamestringYes

The name of the new snapshot. The name must be 2 to 128 characters in length. The name must start with a letter and cannot start with http:// or https://. The name can contain letters, digits, colons (:), underscores (_), periods (.), and hyphens (-).

This parameter is left empty by default.

CopySnapshotDemo
DestinationSnapshotDescriptionstringYes

The description of the new snapshot. The description must be 2 to 256 characters in length and cannot start with http:// or https://.

This parameter is empty by default.

CopySnapshotDemo
RetentionDaysintegerNo

The retention period of the new snapshot. Unit: days. The new snapshot is automatically released when its retention period ends. Valid values: 1 to 65536.

This parameter is empty by default, which indicates that the snapshot is not automatically released.

60
EncryptedbooleanNo

Specifies whether to encrypt the new snapshot. Valid values:

  • true
  • false

Default value: false.

false
KMSKeyIdstringNo

The ID of the customer master key (CMK) in Key Management Service (KMS) in the destination region.

0e478b7a-4262-4802-b8cb-00d3fb40****
Arnarray<object>No
Note This parameter is currently in invitational preview and unavailable for public use.
objectNo
RoleTypestringNo
Note This parameter is not publicly available.
null
RolearnstringNo
Note This parameter is not publicly available.
null
AssumeRoleForlongNo
Note This parameter is not publicly available.
0
DestinationStorageLocationArnstringNo
Note This parameter is not publicly available.
null
ClientTokenstringNo

The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see How to ensure idempotence.

123e4567-e89b-12d3-a456-426655440000

Response parameters

ParameterTypeDescriptionExample
object
SnapshotIdstring

The ID of the new snapshot.

s-bp17441ohwka0yui****
RequestIdstring

The request ID.

C8B26B44-0189-443E-9816-D951F596****

Examples

Sample success responses

JSONformat

{
  "SnapshotId": "s-bp17441ohwka0yui****",
  "RequestId": "C8B26B44-0189-443E-9816-D951F596****"
}

Error codes

HTTP status codeError codeError messageDescription
400Duplicate.TagKeyThe Tag.N.Key contain duplicate key.The specified tag key already exists. Tag keys must be unique.
400InvalidTagKey.MalformedThe specified Tag.n.Key is not valid.The specified Tag.N.Key parameter is invalid.
400InvalidTagValue.MalformedThe specified Tag.n.Value is not valid.The specified tag value is invalid.
400InvalidRegionId.MalFormedThe specified RegionId is not valid.The specified region does not exist.
403InvalidSnapshotId.EncryptedNotSupportThe specified snapshot with encrypted does not support copy.-
403InvalidSnapshotId.NotFoundThe specified snapshot is not exists.The specified source snapshot does not exist.
403InvalidSnapshotCategory.NotSupportCopyThe specified snapshot's category does not support copy.-
403InvalidUser.NotInWhiteListThe user is not in the white list of copying snapshot.You are not authorized to perform the operation.
403InvalidParamter%s-
403InvalidAccountStatus.NotEnoughBalanceYour account does not have enough balance.Your account balance is insufficient. Add funds to your account and try again.
403InvalidAccountStatus.SnapshotServiceUnavailableSnapshot service has not been opened yet.The operation is not supported while the snapshot service is not activated.
403InvalidSnapshotId.NotReadyThe specified snapshot has not completed yet.The specified snapshot is being created.
403InvalidOperation.UnauthorizedThe specified operation is unauthorized.-
403InvalidOperation.UnfinishedCrossRegionCopyThis disk has unfinished cross-region copy snapshots in the target region.-
403InvalidOperation.NotSupportCopyInSameRegionCopying snapshot in the same region is not supported.-
403InvalidSnapshotName.MalformedThe specified SnapshotName is wrongly formed.The format of the specified snapshot name is invalid.
403InvalidDescription.MalformedThe specified description is wrongly formed.The resource description is invalid. The description must be 2 to 256 characters in length and cannot start with http:// or https://.
403InvalidRetentionDays.MalformedThe specified RetentionDays is not valid.The specified RetentionDays parameter is invalid.
403InvalidRegionId.NotSupportedEncryptedSnapshotCopyThe specified region not support copy encrypted snapshot.-
403InvalidRegion.NotSupportThe specified region does not support byok.The bring your own key (BYOK) feature is not supported in the region.
403InvalidRegionId.NotSupportEncryptAlgorithmThe current region does not support creating encrypted disks with EncryptAlgorithm.-
403InvalidRegionId.NotExistsRegion not exists.-
403InvalidEncryptAlgorithmThe specified parameter EncryptAlgorithm is not valid.-
403InvalidEncrypted.NotMatchKmsKeyIdThe specified parameter Encrypted must be true when KmsKeyId is not empty.-
403InvalidEncrypted.NotMatchEncryptAlgorithmThe specified parameter Encrypted must be true when EncryptAlgorithm is not empty.-
403InvalidEncrypted.NotSupportDecryptEncrypted snapshot not support copy to decrypt snapshot.-
403InvalidSnapshotCategory.NotSupportCrossRegionCopyThe specified snapshot is not support cross region copy.-
403InvalidSnapshotCategory.NotSupportEncryptedCopyThe specified snapshot is not support encrypted copy.-
403InvalidParameter.KmsNotEnabledThe specified operation need enable KMS.The current operation requires opening KMS
403InvalidParameter.DataEncryptedKeyCreateFailedCreate kms data encrypted key fail. If you need further assistance, you can contact the KMS Technical Support.-
403InvalidParameter.KMSKeyId.NotFoundThe specified KMSKeyId does not exist.The specified KMSKeyId parameter does not exist.
403InvalidParameter.KMSKeyId.CMKUnauthorizedThis operation for kmsKeyId is forbidden by KMS. If you need further assistance, you can contact the KMS Technical Support.-
403InvalidParameter.KMSKeyId.CMKNotEnabledThe CMK needs to be enabled.The customer master key (CMK) is not enabled when KMSKeyId is specified for an encrypted disk. You can call the DescribeKey operation of KMS to query information about the specified CMK.
403InvalidParameter.KMSKeyId.KMSUnauthorizedECS service have no right to access your KMS.ECS is not authorized to access your KMS resources.
403InvalidKMSKeyId.NotSymmetricThe specified parameter KmsKeyId must be symmetric.-
403InvalidEncrypted.NotMatchKmsKeyIdThe specified parameter Encrypted must be true when kmsKeyId is not null.-
403QuotaExceed.SnapshotQuotaThe quota is insufficient, please contact your channel partner to increase the quota.The quota is insufficient. Contact your channel partner to request a quota increase.
403InvalidOperation.UnfinishedEncryptedSnapshotCopyThis disk has unfinished encrypted copy snapshots in the target region.The cloud disk has unfinished encrypted snapshot copy tasks.
403InvalidParameterDestinationStorageLocationArn.UnauthorizedThe operation has failed due to lack of permission for the specified "DestinationStorageLocationArn". Please use a resource with appropriate permission for the operation.-
403InvalidParameterDestinationStorageLocationArn.RegionNotMatchThe region information in the specified parameter "DestinationStorageLocationArn" is inconsistent with "DestinationRegionId". Please use the correct information for the operation.-
403InvalidSnapshot.StorageLocationNotSupportedThe storage location of the current snapshot does not support this operation.-
403InvalidSnapshot.EncryptedNotSupportedThe current operation does not support the use of encrypted snapshots.-
403InvalidParameterDestinationStorageLocationArn.MalformedThe specified DestinationStorageLocationArn is wrongly formed.-
403OperationDenied.NonCompliantDestinationRegionThe copy operation to the destination region is not in compliance with regulations.The target region does not meet the security compliance requirements.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2024-06-27The Error code has changedView Change Details
2023-12-18The Error code has changedView Change Details
2023-08-02The Error code has changed. The request parameters of the API has changedView Change Details
2023-06-19The Error code has changedView Change Details
2023-03-01The Error code has changedView Change Details