Skip to main content

disk_snapshots

Creates, updates, deletes, gets or lists a disk_snapshots resource.

Overview

Namedisk_snapshots
TypeResource
Idaws.lightsail.disk_snapshots

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
namestringThe name of the disk snapshot (my-disk-snapshot). (pattern: <code>\w[\w-]*\w</code>)
arnstringThe Amazon Resource Name (ARN) of the disk snapshot. (pattern: <code>.\S.</code>)
created_atstring (date-time)The date when the disk snapshot was created.
from_disk_arnstringThe Amazon Resource Name (ARN) of the source disk from which the disk snapshot was created. (pattern: <code>.\S.</code>)
from_disk_namestringThe unique name of the source disk from which the disk snapshot was created. (pattern: <code>\w[\w-]*\w</code>)
from_instance_arnstringThe Amazon Resource Name (ARN) of the source instance from which the disk (system volume) snapshot was created. (pattern: <code>.\S.</code>)
from_instance_namestringThe unique name of the source instance from which the disk (system volume) snapshot was created. (pattern: <code>\w[\w-]*\w</code>)
is_from_auto_snapshotbooleanA Boolean value indicating whether the snapshot was created from an automatic snapshot.
locationobjectThe AWS Region and Availability Zone where the disk snapshot was created.
progressstringThe progress of the snapshot.
resource_typestringThe Lightsail resource type (DiskSnapshot). (ContainerService, Instance, StaticIp, KeyPair, InstanceSnapshot, Domain, PeeredVpc, LoadBalancer, LoadBalancerTlsCertificate, Disk, DiskSnapshot, RelationalDatabase, RelationalDatabaseSnapshot, ExportSnapshotRecord, CloudFormationStackRecord, Alarm, ContactMethod, Distribution, Certificate, Bucket)
size_in_gbintegerThe size of the disk in GB.
statestringThe status of the disk snapshot operation. (pending, completed, error, unknown)
support_codestringThe support code. Include this code in your email to support when you have questions about an instance or another resource in Lightsail. This code enables our support team to look up your Lightsail information more easily.
tagsarrayThe tag keys and optional values for the resource. For more information about tags in Lightsail, see the Amazon Lightsail Developer Guide.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_disk_snapshotselectregionReturns information about a specific block storage disk snapshot.
get_disk_snapshotsselectregionReturns information about all block storage disk snapshots in your AWS account and region.
create_disk_snapshotinsertregion, diskSnapshotNameCreates a snapshot of a block storage disk. You can use snapshots for backups, to make copies of disks, and to save data before shutting down a Lightsail instance. You can take a snapshot of an attached disk that is in use; however, snapshots only capture data that has been written to your disk at the time the snapshot command is issued. This may exclude any data that has been cached by any applications or the operating system. If you can pause any file systems on the disk long enough to take a snapshot, your snapshot should be complete. Nevertheless, if you cannot pause all file writes to the disk, you should unmount the disk from within the Lightsail instance, issue the create disk snapshot command, and then remount the disk to ensure a consistent and complete snapshot. You may remount and use your disk while the snapshot status is pending. You can also use this operation to create a snapshot of an instance's system volume. You might want to do this, for example, to recover data from the system volume of a botched instance or to create a backup of the system volume like you would for a block storage disk. To create a snapshot of a system volume, just define the instance name parameter when issuing the snapshot command, and a snapshot of the defined instance's system volume will be created. After the snapshot is available, you can create a block storage disk from the snapshot and attach it to a running instance to access the data on the disk. The create disk snapshot operation supports tag-based access control via request tags. For more information, see the Amazon Lightsail Developer Guide.
delete_disk_snapshotdeleteregionDeletes the specified disk snapshot. When you make periodic snapshots of a disk, the snapshots are incremental, and only the blocks on the device that have changed since your last snapshot are saved in the new snapshot. When you delete a snapshot, only the data not needed for any other snapshot is removed. So regardless of which prior snapshots have been deleted, all active snapshots will have access to all the information needed to restore the disk. The delete disk snapshot operation supports tag-based access control via resource tags applied to the resource identified by disk snapshot name. For more information, see the Amazon Lightsail Developer Guide.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
regionstringAWS region (default: us-east-1)

SELECT examples

Returns information about a specific block storage disk snapshot.

SELECT
name,
arn,
created_at,
from_disk_arn,
from_disk_name,
from_instance_arn,
from_instance_name,
is_from_auto_snapshot,
location,
progress,
resource_type,
size_in_gb,
state,
support_code,
tags
FROM aws.lightsail.disk_snapshots
WHERE region = '{{ region }}' -- required
;

INSERT examples

Creates a snapshot of a block storage disk. You can use snapshots for backups, to make copies of disks, and to save data before shutting down a Lightsail instance. You can take a snapshot of an attached disk that is in use; however, snapshots only capture data that has been written to your disk at the time the snapshot command is issued. This may exclude any data that has been cached by any applications or the operating system. If you can pause any file systems on the disk long enough to take a snapshot, your snapshot should be complete. Nevertheless, if you cannot pause all file writes to the disk, you should unmount the disk from within the Lightsail instance, issue the create disk snapshot command, and then remount the disk to ensure a consistent and complete snapshot. You may remount and use your disk while the snapshot status is pending. You can also use this operation to create a snapshot of an instance's system volume. You might want to do this, for example, to recover data from the system volume of a botched instance or to create a backup of the system volume like you would for a block storage disk. To create a snapshot of a system volume, just define the instance name parameter when issuing the snapshot command, and a snapshot of the defined instance's system volume will be created. After the snapshot is available, you can create a block storage disk from the snapshot and attach it to a running instance to access the data on the disk. The create disk snapshot operation supports tag-based access control via request tags. For more information, see the Amazon Lightsail Developer Guide.

INSERT INTO aws.lightsail.disk_snapshots (
diskName,
diskSnapshotName,
instanceName,
tags,
region
)
SELECT
'{{ diskName }}',
'{{ diskSnapshotName }}' /* required */,
'{{ instanceName }}',
'{{ tags }}',
'{{ region }}'
RETURNING
operations
;

DELETE examples

Deletes the specified disk snapshot. When you make periodic snapshots of a disk, the snapshots are incremental, and only the blocks on the device that have changed since your last snapshot are saved in the new snapshot. When you delete a snapshot, only the data not needed for any other snapshot is removed. So regardless of which prior snapshots have been deleted, all active snapshots will have access to all the information needed to restore the disk. The delete disk snapshot operation supports tag-based access control via resource tags applied to the resource identified by disk snapshot name. For more information, see the Amazon Lightsail Developer Guide.

DELETE FROM aws.lightsail.disk_snapshots
WHERE region = '{{ region }}' --required
;