全部產品
Search
文件中心

Elastic Compute Service:CreateSnapshot

更新時間:Sep 15, 2026

為一塊雲端硬碟建立一份快照。

介面說明

原本地快照更替為快照極速可用能力。參數說明如下:

  • 如果您在 2020 年 12 月 14 日之前使用過本地快照,您可以正常使用參數Category。

  • 如果您在 2020 年 12 月 14 日之前未使用過本地快照,無需額外進行設定,ESSD 系列雲端硬碟(ESSD、ESSD AutoPL、ESSD Entry 和 ESSD 同城冗餘)新建的快照將預設為建立後極速可用,且同時支援手動快照和自動快照。API 介面中的「InstantAccess」、「InstantAccessRetentionDays」、「DisableInstantAccess」三個極速可用功能相關參數不再生效,「DescribeSnapshots」、「DescribeSnapshotGroups」這兩個 API 介面將新增輸出參數 Available 來描述快照可用的狀態。

前提條件:

  • 已啟用快照。具體操作,請參見啟用快照。

  • 雲端硬碟必須處於使用中或待掛載狀態。不同狀態下的注意事項如下:

    • 如果雲端硬碟處於使用中的狀態,則執行個體必須處於執行中或已停止狀態。

    • 如果雲端硬碟處於待掛載的狀態,則需要保證雲端硬碟有過掛載到 ECS 執行個體的歷史操作。從未掛載過 ECS 執行個體的雲端硬碟不支援建立快照。

    • 當雲端硬碟被用作建立動態擴充磁碟區或者 RAID 陣列時,建議您使用快照一致性群組並開啟應用程式一致性快照備份資料。快照一致性群組能夠保證在業務系統跨多塊雲端硬碟的場景下,資料寫入雲端硬碟的時序一致性,並保證其當機一致性。更多資訊,請參見建立快照一致性群組和建立應用程式一致性快照。

建立快照時,您需要注意:

  • 建立快照應避開業務高峰期。建立快照時,雲端硬碟 I/O 效能降低 10% 以內,讀寫效能出現短暫瞬間變慢。

  • 如果建立快照還未完成,這份快照無法用於建立自訂映像( CreateImage )。

  • 建立快照期間,操作雲端硬碟產生的增量資料不會備份到快照中。

  • 如果雲端硬碟已掛載到 ECS 執行個體上,建立快照期間請勿變更執行個體狀態,如停止或重新啟動 ECS 執行個體,否則會導致快照建立失敗。

  • 正在建立快照的雲端硬碟不支援擴充容量。請您等待快照建立完成後,再開始執行擴充容量操作。

  • 支援對處於已過期(Expired)狀態的雲端硬碟建立快照。若建立快照時雲端硬碟正好達到過期釋放時間,雲端硬碟被釋放的同時也會刪除建立中(Creating)的快照。

  • 建立快照後,系統根據快照容量大小,按每個區域單獨結算費用。更多資訊,請參見快照計費。

  • 以下場景中,您無法為指定的雲端硬碟建立快照:

    • 雲端硬碟保留的手動快照數達到上限。更多資訊,請參見快照使用限制。

    • 建立快照存在並行限制,超過限制會導致建立失敗。更多資訊,請參見快照使用限制。

    • 查詢 ECS 執行個體資訊時,如果回傳資料中包含{"OperationLocks": {"LockReason" : "security"}},則禁止一切操作。

調試

您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。

調試

授權資訊

下表是API對應的授權資訊,可以在RAM權限原則語句的Action元素中使用,用來給RAM使用者或RAM角色授予調用此API的許可權。具體說明如下:

  • 操作:是指具體的許可權點。

  • 存取層級:是指每個操作的存取層級,取值為寫入(Write)、讀取(Read)或列出(List)。

  • 資源類型:是指操作中支援授權的資源類型。具體說明如下:

    • 對於必選的資源類型,用前面加 * 表示。

    • 對於不支援資源級授權的操作,用全部資源表示。

  • 條件關鍵字:是指雲產品自身定義的條件關鍵字。

  • 關聯操作:是指成功執行操作所需要的其他許可權。操作者必須同時具備關聯操作的許可權,操作才能成功。

操作

存取層級

資源類型

條件關鍵字

關聯操作

ecs:CreateSnapshot

create

*Disk

acs:ecs:{#regionId}:{#accountId}:disk/{#diskId}

*Snapshot

acs:ecs:{#regionId}:{#accountId}:snapshot/*

無 無

請求參數

名稱

類型

必填

描述

樣本值

DiskId

string

是

雲端硬碟 ID。

d-bp1s5fnvk4gn2tws0****

SnapshotName

string

否

快照的名稱。長度為 2~128 個字元,必須以大小寫字母或中文開頭,支援 Unicode 中 letter 分類下的字元(其中包括英文、中文等),ASCII 數字(0-9)。可以包含半形冒號(:)、底線(_)、半形句號(.)或者短橫線(-)。

說明

不能以 http://和 https:// 開頭。為防止和自動快照的名稱衝突,不能以auto開頭。

testSnapshotName

Description

string

否

快照的描述。長度為 2~256 個英文或中文字元,不能以http://或https://開頭。

預設值:空。

testDescription

RetentionDays

integer

否

設定快照的保留時間,單位為天。取值範圍:1~65536。保留時間到期後快照會被自動釋放。

預設值:空,表示快照不會被自動釋放。

30

Category

string

否

快照類型。取值範圍:

  • Standard:標準快照。

  • Flash:本地快照。

說明

該參數即將被棄用。ESSD 雲端硬碟標準快照已升級為預設極速可用,您無需額外設定,且不產生額外花費。

Standard

ClientToken

string

否

保證請求冪等性。從您的用戶端產生一個參數值,確保不同請求間該參數值唯一。ClientToken 只支援 ASCII 字元,且不能超過 64 個字元。更多詳情,請參見如何保證冪等性。

123e4567-e89b-12d3-a456-426655440000

ResourceGroupId

string

否

快照所在的企業資源群組 ID。

rg-bp67acfmxazb4p****

InstantAccess

boolean

否

是否開啟快照極速可用功能。取值範圍:

  • true:開啟。僅 ESSD 雲端硬碟支援開啟該功能。

  • false:關閉。即建立標準快照。

預設值:false。

說明

該參數已棄用。ESSD 雲端硬碟標準快照已升級為預設極速可用,您無需額外設定,且不產生額外花費。

false

InstantAccessRetentionDays

integer

否

設定快照極速可用功能的保留時間,保留時間到期後快照將自動釋放。該參數在InstantAccess=true時生效。單位:天。取值範圍:1~65535。

預設與參數RetentionDays的值一致。

說明

該參數已棄用。ESSD 雲端硬碟標準快照已升級為預設極速可用,您無需額外設定,且不產生額外花費。

1

Tag

array<object>

否

標籤清單。

object

否

標籤清單。

Key

string

否

快照的標籤鍵。N 的取值範圍:1~20。一旦傳入該值,則不允許為空字串。最多支援 128 個字元,不能以 aliyun 和 acs:開頭,不能包含 http://或者 https://。

TestKey

Value

string

否

快照的標籤值。N 的取值範圍:1~20。一旦傳入該值,可以為空字串。最多支援 128 個字元,不能包含 http://或者 https://。

TestValue

key

string

否

快照的標籤鍵。

說明

為提高相容性,建議您盡量使用 Tag.N.Key 參數。

null

value

string

否

快照的標籤值。

說明

為提高相容性,建議您盡量使用 Tag.N.Value 參數。

null

StorageLocationArn

string

否

說明

該參數暫未開放使用。

null

返回參數

名稱

類型

描述

樣本值

object

RequestId

string

請求 ID。

473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

SnapshotId

string

快照 ID。

s-bp17441ohwka0yuh****

樣本

正常返回樣本

JSON格式

{
  "RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E",
  "SnapshotId": "s-bp17441ohwka0yuh****"
}

錯誤碼

HTTP status code

錯誤碼

錯誤資訊

描述

400 InvalidParameter.KMSKeyId.NotFound The specified KMSKeyId does not exist. Please verify that the key ID is correct and that the key resides in the current region.
400 InvalidSnapshotName.Malformed The specified SnapshotName is malformed.
400 IncorrectInstanceStatus The current status of the resource does not support this operation. 目前執行個體狀態不支援此類操作。
400 DiskCategory.OperationNotSupported The type of the specified disk does not support creating a snapshot. 目前磁碟類型不支援此操作。
400 Duplicate.TagKey The Tag.N.Key contain duplicate key. 標籤中存在重複的鍵,請保持鍵的唯一性。
400 InvalidTagKey.Malformed The specified Tag.n.Key is not valid. 指定的標籤鍵參數有誤。
400 InvalidTagValue.Malformed The specified Tag.n.Value is not valid. 指定的標籤值參數有誤。
400 InvalidRetentionDays.Malformed The specified RetentionDays is not valid. 指定的保留天數無效。請檢查 RetentionDays 參數值是否正確。
400 CreateSnapshot.Failed The process of creating snapshot is failed. 建立快照失敗。
400 InvalidOperation.StorageLocationMismatch The specified storageLocation does not match the storage location of the last snapshot for the disk. Ensure the storageLocation is consistent with previous snapshots.
500 InternalError The request processing has failed due to an internal error and you may retry later or contact support with the request ID.
403 Throttling Request was denied due to user flow control. 請求被流量控制。
403 IncorrectDiskStatus.CreatingSnapshot A previous snapshot creation is in process.
403 InstanceLockedForSecurity The disk attached instance is locked due to security.
403 IncorrectDiskStatus.NeverAttached The specified disk has never been attached to any instance.
403 QuotaExceed.Snapshot The snapshot quota exceeds.
403 IncorrectDiskStatus.NeverUsed The specified disk has never been used after creating.
403 CreateSnapshot.Failed The process of creating snapshot is failed.
403 DiskInArrears The specified operation is denied as your disk has expired.
403 DiskId.ValueNotSupported The specified parameter diskid is not supported. 指定的區塊儲存類型不支援此操作。
403 IncorrectDiskStatus The current disk status does not support this operation.
403 InvalidAccountStatus.NotEnoughBalance Your account does not have enough balance.
403 InvalidAccountStatus.SnapshotServiceUnavailable Snapshot service has not been opened yet. 快照服務未開通,操作無法執行。
403 IncorrectInstanceStatus The current status of the resource does not support this operation.
403 IncorrectVolumeStatus The current volume status does not support this operation. 目前狀態不支援此操作。
403 IdempotentParameterMismatch The specified clientToken is used. 與相同 ClientToken 的請求參數不符。
403 IncorrectDiskStatus.Invalid The specified disk status is invalid. Restart the instance and try again.
403 IncorrectDiskType.NotSupport The specified device type is not supported. 指定磁碟儲存類型不支援此操作。
403 IncorrectDiskStatus.Transferring The specified device is transferring. You can retry after the process is finished.
403 InvalidParameter.KMSKeyId.CMKUnauthorized ECS tags must be added to the CMK. CMK 需要新增 ECS 標籤。
403 InvalidParameter.KMSKeyId.CMKNotEnabled The CMK needs to be enabled.
403 InvalidParameter.KMSKeyId.KMSUnauthorized ECS service does not have permission to access your KMS key. Please verify that the specified KMS key has authorized the ECS service.
403 IdempotentProcessing The previous idempotent request(s) is still processing. 先前的冪等請求仍在處理中,請稍後重試。
403 InvalidSnapshotCategory.Malformed The specified Category is not valid. 指定的快照類型無效。請檢查 Category 參數值是否正確。
403 InvalidAction.Unauthorized The specified action is not valid. 指定的操作無效。
403 InvalidRegion.NotSupportSnapshotInstantAccessRegion The snapshot InstantAccess is not supported for this region.
403 InvalidCategoryAndInstantAccess.Malformed The snapshot Category and InstantAccess can't be used together.
403 DISK_HAS_CREATING_SNAPSHOT The operation cannot be performed while a snapshot is being created for the disk.
403 HibernationConfigured.InstanceOperationForbidden The operation is not permitted due to limit of the hibernation configured instance. 不符合開啟休眠選項的執行個體的相關限制,操作不被允許。
403 QuotaExceed.SnapshotQuota The quota is insufficient. Please contact your channel partner to increase the quota.
403 InvalidInstantAccessRetentionDays.Malformed The specified InstantAccessRetentionDays is not valid. 指定的參數 InstantAccessRetentionDays 格式無效。
403 CloudBoxNotSupportSnapshotWithInstantAccess The specified disk in CloudBox does not support to create a snapshot with InstantAccess. CloudBox 中的磁碟不支援建立帶 IA 特性的快照。
403 InvalidOperation.UnfinishedEncryptedSnapshotCopy This disk has unfinished encrypted copy snapshots in the target region. 雲端硬碟存在未完成的加密快照複製任務。
403 QuotaExceed.ConcurrentSnapshotQuota The number of snapshots being created for the disk %s has exceeded the concurrent quota (%s). Please wait for the previous snapshots to complete before trying again. 該磁碟正在建立的快照數量已超過並行配額,請等待之前的快照完成後再重試。
403 InvalidClientToken.Malformed The specified clientToken is improperly formatted. It must contain only ASCII characters and must not exceed 64 characters in length. 指定的冪等參數不合法。
403 InvalidParameter.UnauthorizedStorageLocationArn The operation has failed due to lack of permission for the specified "StorageLocationArn". Please use a resource with appropriate permission for the operation. 目前操作因為指定的 StorageLocationArn 權限不足而失敗,請聯絡該資源的管理員取得操作權限。
403 InvalidStorageLocationArn.Malformed The specified parameter StorageLocationArn is malformed.
403 InvalidStatus.ResourceGroup You cannot perform an operation on a resource group that is being created or deleted. 資源群組正在建立或刪除時不允許操作。
403 OperationDenied.QuotaExceed The quota of tags on resource is beyond permitted range. 資源標籤已達上限。
403 Forbidden.InDebt The operation is not allowed because your account has an outstanding balance. Please settle the overdue payment and try again.
404 InvalidDiskId.NotFound The specified DiskId does not exist. 指定的磁碟不存在。請您檢查磁碟 ID 是否正確。
404 InvalidDescription.Malformed The specified description is malformed.
404 InvalidInstanceId.NotFound The specified InstanceId does not exist. 指定的執行個體不存在,請您檢查執行個體 ID 是否正確。
404 InvalidVolumeId.NotFound The specified volume does not exist.
404 InvalidResourceGroup.NotFound The ResourceGroup provided does not exist in our records. 資源群組並不在記錄中。

訪問錯誤中心查看更多錯誤碼。

變更歷史

更多資訊,參考變更詳情。