Create a Snapshot
Last Updated:2020-10-20
This API is used to create the snapshot from specified disks, and it supports the creation of system disk snapshot and CDS disk snapshot.
- When you create the system disk snapshot, this operation can be performed normally only when the instance is in the Running or Stopped status.
- When you create the CDS disk snapshot, it can be normally performed only when the disk is in the InUse or Available status.
- The quota of number of snapshots to create depends on the total number of disks under the account. At present, you can create up to n*8 snapshots at the same time, where, n is the total number of disks (CDS + system disk).
Request Structure
POST /v{version}/snapshot?clientToken={clientToken} HTTP/1.1
Host: bcc.bj.baidubce.com
Authorization: authorization string
{
"volumeId":volumeId,
"snapshotName": snapshotName,
"desc" : create snapshot
}
Request Header Field
There are no other special header fields except the public header field.
Request Parameters
Parameter Name | Type | Required? | Parameter Position | Description |
---|---|---|---|---|
version | String | Yes | URL parameter | API version number |
clientToken | String | Yes | Query Parameter | Idempotent Token, which is an ASCII string with the length no more than 64 bits. See Idempotency of ClientToken for details. |
volumeId | String | Yes | Request Body Parameter | Disk ID to create snapshot, and instance ID for system disk |
snapshotName | String | Yes | Request Body Parameter | Snapshot name, which supports uppercase and lowercase letters, numbers, Chinese, -, , _, /and., Special characters with length 1-65, it must begin with the letter |
desc | String | No | Request Body Parameter | Snapshot description, optional |
Return Header Field
There are no other special header fields except the common header field.
Return Parameter
Parameter Name | Type | Description |
---|---|---|
snapshotId | String | Snapshot ID created |
Error Code
Error Code | Error Description | HTTP status code | Explanations |
---|---|---|---|
BadRequest | Bad request parameters or illegal request. | 400 | Invalid request parameter |
Snapshot.SnapshotNameInvalid | snapshot name is invalid. | 400 | The snapshot name is invalid. |
Instance.SnapshotLimitExceeded | The number of snapshot will exceed the quota limit. | 413 | The number of snapshot exceeds the quota limit. |
Request Instance
POST /v2/snapshot?clientToken=be31b98c-5e41-4838-9830-9be700de5a20 HTTP/1.1
Host: bcc.bj.baidubce.com
Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2015-08-11T04:17:29Z/3600/host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de
{
"volumeId": "v-nky7qeom",
"snapshotName": "example-001"
}
Return Instance
HTTP/1.1 200 OK
x-bce-request-id: 1214cca7-4ad5-451d-9215-71cb844c0a50
Date: Wed, 03 Dec 2014 06:42:19 GMT
Content-Type: application/json;charset=UTF-8
Server: BWS
{
"snapshotId" : "s-6r3dam6F"
}