amazonka-ec2-2.0: Amazon Elastic Compute Cloud SDK.
Copyright(c) 2013-2023 Brendan Hay
LicenseMozilla Public License, v. 2.0.
MaintainerBrendan Hay
Stabilityauto-generated
Portabilitynon-portable (GHC extensions)
Safe HaskellSafe-Inferred
LanguageHaskell2010

Amazonka.EC2.CreateSnapshot

Description

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 Amazon Web Services 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.

To create a snapshot for Amazon EBS volumes that serve as root devices, you should 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 Elastic Compute Cloud User Guide.

For more information, see Amazon Elastic Block Store and Amazon EBS encryption in the Amazon Elastic Compute Cloud User Guide.

Synopsis

Creating a Request

data CreateSnapshot Source #

See: newCreateSnapshot smart constructor.

Constructors

CreateSnapshot' 

Fields

  • description :: Maybe Text

    A description for the snapshot.

  • dryRun :: Maybe Bool

    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.

  • outpostArn :: Maybe Text

    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 Elastic Compute Cloud User Guide.

  • tagSpecifications :: Maybe [TagSpecification]

    The tags to apply to the snapshot during creation.

  • volumeId :: Text

    The ID of the Amazon EBS volume.

Instances

Instances details
ToHeaders CreateSnapshot Source # 
Instance details

Defined in Amazonka.EC2.CreateSnapshot

ToPath CreateSnapshot Source # 
Instance details

Defined in Amazonka.EC2.CreateSnapshot

ToQuery CreateSnapshot Source # 
Instance details

Defined in Amazonka.EC2.CreateSnapshot

AWSRequest CreateSnapshot Source # 
Instance details

Defined in Amazonka.EC2.CreateSnapshot

Associated Types

type AWSResponse CreateSnapshot #

Generic CreateSnapshot Source # 
Instance details

Defined in Amazonka.EC2.CreateSnapshot

Associated Types

type Rep CreateSnapshot :: Type -> Type #

Read CreateSnapshot Source # 
Instance details

Defined in Amazonka.EC2.CreateSnapshot

Show CreateSnapshot Source # 
Instance details

Defined in Amazonka.EC2.CreateSnapshot

NFData CreateSnapshot Source # 
Instance details

Defined in Amazonka.EC2.CreateSnapshot

Methods

rnf :: CreateSnapshot -> () #

Eq CreateSnapshot Source # 
Instance details

Defined in Amazonka.EC2.CreateSnapshot

Hashable CreateSnapshot Source # 
Instance details

Defined in Amazonka.EC2.CreateSnapshot

type AWSResponse CreateSnapshot Source # 
Instance details

Defined in Amazonka.EC2.CreateSnapshot

type Rep CreateSnapshot Source # 
Instance details

Defined in Amazonka.EC2.CreateSnapshot

type Rep CreateSnapshot = D1 ('MetaData "CreateSnapshot" "Amazonka.EC2.CreateSnapshot" "amazonka-ec2-2.0-48L9RAJvmvzAdBkRegqWCL" 'False) (C1 ('MetaCons "CreateSnapshot'" 'PrefixI 'True) ((S1 ('MetaSel ('Just "description") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Text)) :*: S1 ('MetaSel ('Just "dryRun") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Bool))) :*: (S1 ('MetaSel ('Just "outpostArn") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Text)) :*: (S1 ('MetaSel ('Just "tagSpecifications") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe [TagSpecification])) :*: S1 ('MetaSel ('Just "volumeId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text)))))

newCreateSnapshot Source #

Create a value of CreateSnapshot with all optional fields omitted.

Use generic-lens or optics to modify other optional fields.

The following record fields are available, with the corresponding lenses provided for backwards compatibility:

CreateSnapshot, createSnapshot_description - A description for the snapshot.

$sel:dryRun:CreateSnapshot', createSnapshot_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.

CreateSnapshot, createSnapshot_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 Elastic Compute Cloud User Guide.

CreateSnapshot, createSnapshot_tagSpecifications - The tags to apply to the snapshot during creation.

CreateSnapshot, createSnapshot_volumeId - The ID of the Amazon EBS volume.

Request Lenses

createSnapshot_description :: Lens' CreateSnapshot (Maybe Text) Source #

A description for the snapshot.

createSnapshot_dryRun :: Lens' CreateSnapshot (Maybe Bool) Source #

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.

createSnapshot_outpostArn :: Lens' CreateSnapshot (Maybe Text) Source #

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 Elastic Compute Cloud User Guide.

createSnapshot_tagSpecifications :: Lens' CreateSnapshot (Maybe [TagSpecification]) Source #

The tags to apply to the snapshot during creation.

createSnapshot_volumeId :: Lens' CreateSnapshot Text Source #

The ID of the Amazon EBS volume.

Destructuring the Response

data Snapshot Source #

Describes a snapshot.

See: newSnapshot smart constructor.

Constructors

Snapshot' 

Fields

  • dataEncryptionKeyId :: Maybe Text

    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.

  • kmsKeyId :: Maybe Text

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

  • outpostArn :: Maybe Text

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

  • ownerAlias :: Maybe Text

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

  • restoreExpiryTime :: Maybe ISO8601

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

  • stateMessage :: Maybe Text

    Encrypted Amazon EBS snapshots are copied asynchronously. If a snapshot copy operation fails (for example, if the proper Key Management Service (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.

  • storageTier :: Maybe 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.

  • tags :: Maybe [Tag]

    Any tags assigned to the snapshot.

  • snapshotId :: Text

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

  • ownerId :: Text

    The ID of the Amazon Web Services account that owns the EBS snapshot.

  • volumeId :: Text

    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.

  • volumeSize :: Int

    The size of the volume, in GiB.

  • description :: Text

    The description for the snapshot.

  • startTime :: ISO8601

    The time stamp when the snapshot was initiated.

  • progress :: Text

    The progress of the snapshot, as a percentage.

  • state :: SnapshotState

    The snapshot state.

  • encrypted :: Bool

    Indicates whether the snapshot is encrypted.

Instances

Instances details
FromXML Snapshot Source # 
Instance details

Defined in Amazonka.EC2.Types.Snapshot

Generic Snapshot Source # 
Instance details

Defined in Amazonka.EC2.Types.Snapshot

Associated Types

type Rep Snapshot :: Type -> Type #

Methods

from :: Snapshot -> Rep Snapshot x #

to :: Rep Snapshot x -> Snapshot #

Read Snapshot Source # 
Instance details

Defined in Amazonka.EC2.Types.Snapshot

Show Snapshot Source # 
Instance details

Defined in Amazonka.EC2.Types.Snapshot

NFData Snapshot Source # 
Instance details

Defined in Amazonka.EC2.Types.Snapshot

Methods

rnf :: Snapshot -> () #

Eq Snapshot Source # 
Instance details

Defined in Amazonka.EC2.Types.Snapshot

Hashable Snapshot Source # 
Instance details

Defined in Amazonka.EC2.Types.Snapshot

Methods

hashWithSalt :: Int -> Snapshot -> Int #

hash :: Snapshot -> Int #

type Rep Snapshot Source # 
Instance details

Defined in Amazonka.EC2.Types.Snapshot

type Rep Snapshot = D1 ('MetaData "Snapshot" "Amazonka.EC2.Types.Snapshot" "amazonka-ec2-2.0-48L9RAJvmvzAdBkRegqWCL" 'False) (C1 ('MetaCons "Snapshot'" 'PrefixI 'True) ((((S1 ('MetaSel ('Just "dataEncryptionKeyId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Text)) :*: S1 ('MetaSel ('Just "kmsKeyId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Text))) :*: (S1 ('MetaSel ('Just "outpostArn") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Text)) :*: S1 ('MetaSel ('Just "ownerAlias") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Text)))) :*: ((S1 ('MetaSel ('Just "restoreExpiryTime") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe ISO8601)) :*: S1 ('MetaSel ('Just "stateMessage") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Text))) :*: (S1 ('MetaSel ('Just "storageTier") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe StorageTier)) :*: S1 ('MetaSel ('Just "tags") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe [Tag]))))) :*: (((S1 ('MetaSel ('Just "snapshotId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text) :*: S1 ('MetaSel ('Just "ownerId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text)) :*: (S1 ('MetaSel ('Just "volumeId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text) :*: S1 ('MetaSel ('Just "volumeSize") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Int))) :*: ((S1 ('MetaSel ('Just "description") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text) :*: S1 ('MetaSel ('Just "startTime") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 ISO8601)) :*: (S1 ('MetaSel ('Just "progress") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text) :*: (S1 ('MetaSel ('Just "state") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 SnapshotState) :*: S1 ('MetaSel ('Just "encrypted") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Bool)))))))

newSnapshot Source #

Create a value of Snapshot with all optional fields omitted.

Use generic-lens or optics to modify other optional fields.

The following record fields are available, with the corresponding lenses provided for backwards compatibility:

$sel:dataEncryptionKeyId:Snapshot', snapshot_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.

$sel:kmsKeyId:Snapshot', snapshot_kmsKeyId - The Amazon Resource Name (ARN) of the Key Management Service (KMS) KMS key that was used to protect the volume encryption key for the parent volume.

$sel:outpostArn:Snapshot', snapshot_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 Elastic Compute Cloud User Guide.

$sel:ownerAlias:Snapshot', snapshot_ownerAlias - The Amazon Web Services owner alias, from an Amazon-maintained list (amazon). This is not the user-configured Amazon Web Services account alias set using the IAM console.

$sel:restoreExpiryTime:Snapshot', snapshot_restoreExpiryTime - Only for archived snapshots that are temporarily restored. Indicates the date and time when a temporarily restored snapshot will be automatically re-archived.

$sel:stateMessage:Snapshot', snapshot_stateMessage - Encrypted Amazon EBS snapshots are copied asynchronously. If a snapshot copy operation fails (for example, if the proper Key Management Service (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.

$sel:storageTier:Snapshot', snapshot_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.

$sel:tags:Snapshot', snapshot_tags - Any tags assigned to the snapshot.

$sel:snapshotId:Snapshot', snapshot_snapshotId - The ID of the snapshot. Each snapshot receives a unique identifier when it is created.

$sel:ownerId:Snapshot', snapshot_ownerId - The ID of the Amazon Web Services account that owns the EBS snapshot.

$sel:volumeId:Snapshot', snapshot_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.

$sel:volumeSize:Snapshot', snapshot_volumeSize - The size of the volume, in GiB.

$sel:description:Snapshot', snapshot_description - The description for the snapshot.

$sel:startTime:Snapshot', snapshot_startTime - The time stamp when the snapshot was initiated.

$sel:progress:Snapshot', snapshot_progress - The progress of the snapshot, as a percentage.

$sel:state:Snapshot', snapshot_state - The snapshot state.

$sel:encrypted:Snapshot', snapshot_encrypted - Indicates whether the snapshot is encrypted.

Response Lenses

snapshot_dataEncryptionKeyId :: Lens' Snapshot (Maybe Text) Source #

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.

snapshot_kmsKeyId :: Lens' Snapshot (Maybe Text) Source #

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

snapshot_outpostArn :: Lens' Snapshot (Maybe Text) Source #

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

snapshot_ownerAlias :: Lens' Snapshot (Maybe Text) Source #

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

snapshot_restoreExpiryTime :: Lens' Snapshot (Maybe UTCTime) Source #

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

snapshot_stateMessage :: Lens' Snapshot (Maybe Text) Source #

Encrypted Amazon EBS snapshots are copied asynchronously. If a snapshot copy operation fails (for example, if the proper Key Management Service (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.

snapshot_storageTier :: Lens' Snapshot (Maybe StorageTier) Source #

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.

snapshot_tags :: Lens' Snapshot (Maybe [Tag]) Source #

Any tags assigned to the snapshot.

snapshot_snapshotId :: Lens' Snapshot Text Source #

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

snapshot_ownerId :: Lens' Snapshot Text Source #

The ID of the Amazon Web Services account that owns the EBS snapshot.

snapshot_volumeId :: Lens' Snapshot Text Source #

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.

snapshot_volumeSize :: Lens' Snapshot Int Source #

The size of the volume, in GiB.

snapshot_description :: Lens' Snapshot Text Source #

The description for the snapshot.

snapshot_startTime :: Lens' Snapshot UTCTime Source #

The time stamp when the snapshot was initiated.

snapshot_progress :: Lens' Snapshot Text Source #

The progress of the snapshot, as a percentage.

snapshot_encrypted :: Lens' Snapshot Bool Source #

Indicates whether the snapshot is encrypted.