CreateSnapshot - Storage Gateway

CreateSnapshot

Initiates a snapshot of a volume.

Storage Gateway provides the ability to back up point-in-time snapshots of your data to Amazon Simple Storage (Amazon S3) for durable off-site recovery, and also import the data to an Amazon Elastic Block Store (EBS) volume in Amazon Elastic Compute Cloud (EC2). You can take snapshots of your gateway volume on a scheduled or ad hoc basis. This API enables you to take an ad hoc snapshot. For more information, see Editing a snapshot schedule.

In the CreateSnapshot request, you identify the volume by providing its Amazon Resource Name (ARN). You must also provide description for the snapshot. When Storage Gateway takes the snapshot of specified volume, the snapshot and description appears in the Storage Gateway console. In response, Storage Gateway returns you a snapshot ID. You can use this snapshot ID to check the snapshot progress or later use it when you want to create a volume from a snapshot. This operation is only supported in stored and cached volume gateway type.

Note

To list or delete a snapshot, you must use the Amazon EC2 API. For more information, see DescribeSnapshots or DeleteSnapshot in the Amazon Elastic Compute Cloud API Reference.

Important

Volume and snapshot IDs are changing to a longer length ID format. For more information, see the important note on the Welcome page.

Request Syntax

{ "SnapshotDescription": "string", "Tags": [ { "Key": "string", "Value": "string" } ], "VolumeARN": "string" }

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters.

The request accepts the following data in JSON format.

SnapshotDescription

Textual description of the snapshot that appears in the Amazon EC2 console, Elastic Block Store snapshots panel in the Description field, and in the Storage Gateway snapshot Details pane, Description field.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 255.

Required: Yes

Tags

A list of up to 50 tags that can be assigned to a snapshot. Each tag is a key-value pair.

Note

Valid characters for key and value are letters, spaces, and numbers representable in UTF-8 format, and the following special characters: + - = . _ : / @. The maximum length of a tag's key is 128 characters, and the maximum length for a tag's value is 256.

Type: Array of Tag objects

Required: No

VolumeARN

The Amazon Resource Name (ARN) of the volume. Use the ListVolumes operation to return a list of gateway volumes.

Type: String

Length Constraints: Minimum length of 50. Maximum length of 500.

Required: Yes

Response Syntax

{ "SnapshotId": "string", "VolumeARN": "string" }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

SnapshotId

The snapshot ID that is used to refer to the snapshot in future operations such as describing snapshots (Amazon Elastic Compute Cloud API DescribeSnapshots) or creating a volume from a snapshot (CreateStorediSCSIVolume).

Type: String

Pattern: \Asnap-([0-9A-Fa-f]{8}|[0-9A-Fa-f]{17})\z

VolumeARN

The Amazon Resource Name (ARN) of the volume of which the snapshot was taken.

Type: String

Length Constraints: Minimum length of 50. Maximum length of 500.

Errors

For information about the errors that are common to all actions, see Common Errors.

InternalServerError

An internal server error has occurred during the request. For more information, see the error and message fields.

HTTP Status Code: 400

InvalidGatewayRequestException

An exception occurred because an invalid gateway request was issued to the service. For more information, see the error and message fields.

HTTP Status Code: 400

ServiceUnavailableError

An internal server error has occurred because the service is unavailable. For more information, see the error and message fields.

HTTP Status Code: 400

Examples

Example request

The following example sends a CreateSnapshot request to take snapshot of the specified an example volume.

Sample Request

POST / HTTP/1.1 Host: storagegateway.us-east-2.amazonaws.com x-amz-Date: 20120425T120000Z Authorization: CSOC7TJPLR0OOKIRLGOHVAICUFVV4KQNSO5AEMVJF66Q9ASUAAJG Content-type: application/x-amz-json-1.1 x-amz-target: StorageGateway_20120630.CreateSnapshot { "VolumeARN": "arn:aws:storagegateway:us-east-2:111122223333:gateway/sgw-12A3456B/volume/vol-1122AABB", "SnapshotDescription": "snapshot description" }

Sample Response

HTTP/1.1 200 OK x-amzn-RequestId: CSOC7TJPLR0OOKIRLGOHVAICUFVV4KQNSO5AEMVJF66Q9ASUAAJG Date: Wed, 25 Apr 2012 12:00:02 GMT Content-type: application/x-amz-json-1.1 Content-length: 128 { "VolumeARN": "arn:aws:storagegateway:us-east-2:111122223333:gateway/sgw-12A3456B/volume/vol-1122AABB", "SnapshotId": "snap-78e22663" }

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: