CreateSnapshot - Amazon Elastic Compute Cloud

CreateSnapshot

Creates a snapshot of an EBS volume and stores it in Amazon S3. You can use snapshots for backups, to make copies of EBS volumes, and to save data before shutting down an instance.

You can create snapshots of volumes in a Region and volumes on an Outpost. If you create a snapshot of a volume in a Region, the snapshot must be stored in the same Region as the volume. If you create a snapshot of a volume on an Outpost, the snapshot can be stored on the same Outpost as the volume, or in the Region for that Outpost.

When a snapshot is created, any AWS Marketplace product codes that are associated with the source volume are propagated to the snapshot.

You can take a snapshot of an attached volume that is in use. However, snapshots only capture data that has been written to your Amazon EBS volume at the time the snapshot command is issued; this might exclude any data that has been cached by any applications or the operating system. If you can pause any file systems on the volume long enough to take a snapshot, your snapshot should be complete. However, if you cannot pause all file writes to the volume, you should unmount the volume from within the instance, issue the snapshot command, and then remount the volume to ensure a consistent and complete snapshot. You may remount and use your volume while the snapshot status is pending.

When you create a snapshot for an EBS volume that serves as a root device, we recommend that you stop the instance before taking the snapshot.

Snapshots that are taken from encrypted volumes are automatically encrypted. Volumes that are created from encrypted snapshots are also automatically encrypted. Your encrypted volumes and any associated snapshots always remain protected.

You can tag your snapshots during creation. For more information, see Tag your Amazon EC2 resources in the Amazon EC2 User Guide.

For more information, see Amazon EBS and Amazon EBS encryption in the Amazon EBS User Guide.

Request Parameters

The following parameters are for this specific action. For more information about required and optional parameters that are common to all actions, see Common Query Parameters.

Description

A description for the snapshot.

Type: String

Required: No

DryRun

Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

Type: Boolean

Required: No

OutpostArn

The Amazon Resource Name (ARN) of the Outpost on which to create a local snapshot.

  • To create a snapshot of a volume in a Region, omit this parameter. The snapshot is created in the same Region as the volume.

  • To create a snapshot of a volume on an Outpost and store the snapshot in the Region, omit this parameter. The snapshot is created in the Region for the Outpost.

  • To create a snapshot of a volume on an Outpost and store the snapshot on an Outpost, specify the ARN of the destination Outpost. The snapshot must be created on the same Outpost as the volume.

For more information, see Create local snapshots from volumes on an Outpost in the Amazon EBS User Guide.

Type: String

Required: No

TagSpecification.N

The tags to apply to the snapshot during creation.

Type: Array of TagSpecification objects

Required: No

VolumeId

The ID of the Amazon EBS volume.

Type: String

Required: Yes

Response Elements

The following elements are returned by the service.

completionDurationMinutes
Note

Only for snapshot copies created with time-based snapshot copy operations.

The completion duration requested for the time-based snapshot copy operation.

Type: Integer

completionTime

The time stamp when the snapshot was completed.

Type: Timestamp

dataEncryptionKeyId

The data encryption key identifier for the snapshot. This value is a unique identifier that corresponds to the data encryption key that was used to encrypt the original volume or snapshot copy. Because data encryption keys are inherited by volumes created from snapshots, and vice versa, if snapshots share the same data encryption key identifier, then they belong to the same volume/snapshot lineage. This parameter is only returned by DescribeSnapshots.

Type: String

description

The description for the snapshot.

Type: String

encrypted

Indicates whether the snapshot is encrypted.

Type: Boolean

kmsKeyId

The Amazon Resource Name (ARN) of the AWS KMS key that was used to protect the volume encryption key for the parent volume.

Type: String

outpostArn

The ARN of the Outpost on which the snapshot is stored. For more information, see Amazon EBS local snapshots on Outposts in the Amazon EBS User Guide.

Type: String

ownerAlias

The AWS owner alias, from an Amazon-maintained list (amazon). This is not the user-configured AWS account alias set using the IAM console.

Type: String

ownerId

The ID of the AWS account that owns the EBS snapshot.

Type: String

progress

The progress of the snapshot, as a percentage.

Type: String

requestId

The ID of the request.

Type: String

restoreExpiryTime

Only for archived snapshots that are temporarily restored. Indicates the date and time when a temporarily restored snapshot will be automatically re-archived.

Type: Timestamp

snapshotId

The ID of the snapshot. Each snapshot receives a unique identifier when it is created.

Type: String

sseType

Reserved for future use.

Type: String

Valid Values: sse-ebs | sse-kms | none

startTime

The time stamp when the snapshot was initiated.

Type: Timestamp

status

The snapshot state.

Type: String

Valid Values: pending | completed | error | recoverable | recovering

statusMessage

Encrypted Amazon EBS snapshots are copied asynchronously. If a snapshot copy operation fails (for example, if the proper AWS KMS permissions are not obtained) this field displays error state details to help you diagnose why the error occurred. This parameter is only returned by DescribeSnapshots.

Type: String

storageTier

The storage tier in which the snapshot is stored. standard indicates that the snapshot is stored in the standard snapshot storage tier and that it is ready for use. archive indicates that the snapshot is currently archived and that it must be restored before it can be used.

Type: String

Valid Values: archive | standard

tagSet

Any tags assigned to the snapshot.

Type: Array of Tag objects

transferType
Note

Only for snapshot copies.

Indicates whether the snapshot copy was created with a standard or time-based snapshot copy operation. Time-based snapshot copy operations complete within the completion duration specified in the request. Standard snapshot copy operations are completed on a best-effort basis.

  • standard - The snapshot copy was created with a standard snapshot copy operation.

  • time-based - The snapshot copy was created with a time-based snapshot copy operation.

Type: String

Valid Values: time-based | standard

volumeId

The ID of the volume that was used to create the snapshot. Snapshots created by the CopySnapshot action have an arbitrary volume ID that should not be used for any purpose.

Type: String

volumeSize

The size of the volume, in GiB.

Type: Integer

Errors

For information about the errors that are common to all actions, see Common client error codes.

Examples

Example

This example creates a snapshot of the volume with the ID vol-1234567890abcdef0.

Sample Request

https://ec2.amazonaws.com/?Action=CreateSnapshot &VolumeId=vol-1234567890abcdef0 &Description=Daily+Backup &AUTHPARAMS

Sample Response

<CreateSnapshotResponse xmlns="http://ec2.amazonaws.com/doc/2016-11-15/"> <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId> <snapshotId>snap-1234567890abcdef0</snapshotId> <volumeId>vol-1234567890abcdef0</volumeId> <status>pending</status> <startTime>YYYY-MM-DDTHH:MM:SS.000Z</startTime> <progress>60%</progress> <ownerId>111122223333</ownerId> <volumeSize>30</volumeSize> <description>Daily Backup</description> </CreateSnapshotResponse>

See Also

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