disks
Creates, updates, deletes, gets or lists a disks resource.
Overview
| Name | disks |
| Type | Resource |
| Id | aws.lightsail.disks |
Fields
The following fields are returned by SELECT queries:
- get_disk
- get_disks
| Name | Datatype | Description |
|---|---|---|
name | string | The unique name of the disk. (pattern: <code>\w[\w-]*\w</code>) |
add_ons | array | An array of objects representing the add-ons enabled on the disk. |
arn | string | The Amazon Resource Name (ARN) of the disk. (pattern: <code>.\S.</code>) |
attached_to | string | The resources to which the disk is attached. (pattern: <code>\w[\w-]*\w</code>) |
attachment_state | string | (Discontinued) The attachment state of the disk. In releases prior to November 14, 2017, this parameter returned attached for system disks in the API response. It is now discontinued, but still included in the response. Use isAttached instead. |
auto_mount_status | string | The status of automatically mounting a storage disk to a virtual computer. This parameter only applies to Lightsail for Research resources. (Failed, Pending, Mounted, NotMounted) |
created_at | string (date-time) | The date when the disk was created. |
gb_in_use | integer | (Discontinued) The number of GB in use by the disk. In releases prior to November 14, 2017, this parameter was not included in the API response. It is now discontinued. |
iops | integer | The input/output operations per second (IOPS) of the disk. |
is_attached | boolean | A Boolean value indicating whether the disk is attached. |
is_system_disk | boolean | A Boolean value indicating whether this disk is a system disk (has an operating system loaded on it). |
location | object | The AWS Region and Availability Zone where the disk is located. |
path | string | The disk path. |
resource_type | string | The Lightsail resource type (Disk). (ContainerService, Instance, StaticIp, KeyPair, InstanceSnapshot, Domain, PeeredVpc, LoadBalancer, LoadBalancerTlsCertificate, Disk, DiskSnapshot, RelationalDatabase, RelationalDatabaseSnapshot, ExportSnapshotRecord, CloudFormationStackRecord, Alarm, ContactMethod, Distribution, Certificate, Bucket) |
size_in_gb | integer | The size of the disk in GB. |
state | string | Describes the status of the disk. (pending, error, available, in-use, unknown) |
support_code | string | The 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. |
tags | array | The tag keys and optional values for the resource. For more information about tags in Lightsail, see the Amazon Lightsail Developer Guide. |
| Name | Datatype | Description |
|---|---|---|
name | string | The unique name of the disk. (pattern: <code>\w[\w-]*\w</code>) |
add_ons | array | An array of objects representing the add-ons enabled on the disk. |
arn | string | The Amazon Resource Name (ARN) of the disk. (pattern: <code>.\S.</code>) |
attached_to | string | The resources to which the disk is attached. (pattern: <code>\w[\w-]*\w</code>) |
attachment_state | string | (Discontinued) The attachment state of the disk. In releases prior to November 14, 2017, this parameter returned attached for system disks in the API response. It is now discontinued, but still included in the response. Use isAttached instead. |
auto_mount_status | string | The status of automatically mounting a storage disk to a virtual computer. This parameter only applies to Lightsail for Research resources. (Failed, Pending, Mounted, NotMounted) |
created_at | string (date-time) | The date when the disk was created. |
gb_in_use | integer | (Discontinued) The number of GB in use by the disk. In releases prior to November 14, 2017, this parameter was not included in the API response. It is now discontinued. |
iops | integer | The input/output operations per second (IOPS) of the disk. |
is_attached | boolean | A Boolean value indicating whether the disk is attached. |
is_system_disk | boolean | A Boolean value indicating whether this disk is a system disk (has an operating system loaded on it). |
location | object | The AWS Region and Availability Zone where the disk is located. |
path | string | The disk path. |
resource_type | string | The Lightsail resource type (Disk). (ContainerService, Instance, StaticIp, KeyPair, InstanceSnapshot, Domain, PeeredVpc, LoadBalancer, LoadBalancerTlsCertificate, Disk, DiskSnapshot, RelationalDatabase, RelationalDatabaseSnapshot, ExportSnapshotRecord, CloudFormationStackRecord, Alarm, ContactMethod, Distribution, Certificate, Bucket) |
size_in_gb | integer | The size of the disk in GB. |
state | string | Describes the status of the disk. (pending, error, available, in-use, unknown) |
support_code | string | The 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. |
tags | array | The 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:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_disk | select | region | Returns information about a specific block storage disk. | |
get_disks | select | region | Returns information about all block storage disks in your AWS account and region. | |
create_disk | insert | region, diskName, availabilityZone, sizeInGb | Creates a block storage disk that can be attached to an Amazon Lightsail instance in the same Availability Zone (us-east-2a). The create disk operation supports tag-based access control via request tags. For more information, see the Amazon Lightsail Developer Guide. | |
attach_disk | update | region, diskName, instanceName, diskPath | Attaches a block storage disk to a running or stopped Lightsail instance and exposes it to the instance with the specified disk name. The attach disk operation supports tag-based access control via resource tags applied to the resource identified by disk name. For more information, see the Amazon Lightsail Developer Guide. | |
detach_disk | update | region, diskName | Detaches a stopped block storage disk from a Lightsail instance. Make sure to unmount any file systems on the device within your operating system before stopping the instance and detaching the disk. The detach disk operation supports tag-based access control via resource tags applied to the resource identified by disk name. For more information, see the Amazon Lightsail Developer Guide. | |
delete_disk | delete | region | Deletes the specified block storage disk. The disk must be in the available state (not attached to a Lightsail instance). The disk may remain in the deleting state for several minutes. The delete disk operation supports tag-based access control via resource tags applied to the resource identified by disk name. For more information, see the Amazon Lightsail Developer Guide. | |
create_disk_from_snapshot | exec | region, diskName, availabilityZone, sizeInGb | Creates a block storage disk from a manual or automatic snapshot of a disk. The resulting disk can be attached to an Amazon Lightsail instance in the same Availability Zone (us-east-2a). The create disk from snapshot operation supports tag-based access control via request tags and 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.
| Name | Datatype | Description |
|---|---|---|
region | string | AWS region (default: us-east-1) |
SELECT examples
- get_disk
- get_disks
Returns information about a specific block storage disk.
SELECT
name,
add_ons,
arn,
attached_to,
attachment_state,
auto_mount_status,
created_at,
gb_in_use,
iops,
is_attached,
is_system_disk,
location,
path,
resource_type,
size_in_gb,
state,
support_code,
tags
FROM aws.lightsail.disks
WHERE region = '{{ region }}' -- required
;
Returns information about all block storage disks in your AWS account and region.
SELECT
name,
add_ons,
arn,
attached_to,
attachment_state,
auto_mount_status,
created_at,
gb_in_use,
iops,
is_attached,
is_system_disk,
location,
path,
resource_type,
size_in_gb,
state,
support_code,
tags
FROM aws.lightsail.disks
WHERE region = '{{ region }}' -- required
;
INSERT examples
- create_disk
- Manifest
Creates a block storage disk that can be attached to an Amazon Lightsail instance in the same Availability Zone (us-east-2a). The create disk operation supports tag-based access control via request tags. For more information, see the Amazon Lightsail Developer Guide.
INSERT INTO aws.lightsail.disks (
diskName,
availabilityZone,
sizeInGb,
tags,
addOns,
region
)
SELECT
'{{ diskName }}' /* required */,
'{{ availabilityZone }}' /* required */,
{{ sizeInGb }} /* required */,
'{{ tags }}',
'{{ addOns }}',
'{{ region }}'
RETURNING
operations
;
# Description fields are for documentation purposes
- name: disks
props:
- name: region
value: "{{ region }}"
description: Required parameter for the disks resource.
- name: diskName
value: "{{ diskName }}"
description: |
The unique Lightsail disk name (my-disk).
- name: availabilityZone
value: "{{ availabilityZone }}"
description: |
The Availability Zone where you want to create the disk (us-east-2a). Use the same Availability Zone as the Lightsail instance to which you want to attach the disk. Use the get regions operation to list the Availability Zones where Lightsail is currently available.
- name: sizeInGb
value: {{ sizeInGb }}
description: |
The size of the disk in GB (32).
- name: tags
description: |
The tag keys and optional values to add to the resource during create. Use the TagResource action to tag a resource after it's created.
value:
- key: "{{ key }}"
value: "{{ value }}"
- name: addOns
description: |
An array of objects that represent the add-ons to enable for the new disk.
value:
- addOnType: "{{ addOnType }}"
autoSnapshotAddOnRequest:
snapshotTimeOfDay: "{{ snapshotTimeOfDay }}"
stopInstanceOnIdleRequest:
threshold: "{{ threshold }}"
duration: "{{ duration }}"
UPDATE examples
- attach_disk
- detach_disk
Attaches a block storage disk to a running or stopped Lightsail instance and exposes it to the instance with the specified disk name. The attach disk operation supports tag-based access control via resource tags applied to the resource identified by disk name. For more information, see the Amazon Lightsail Developer Guide.
UPDATE aws.lightsail.disks
SET
diskName = '{{ diskName }}',
instanceName = '{{ instanceName }}',
diskPath = '{{ diskPath }}',
autoMounting = {{ autoMounting }}
WHERE
region = '{{ region }}' --required
AND diskName = '{{ diskName }}' --required
AND instanceName = '{{ instanceName }}' --required
AND diskPath = '{{ diskPath }}' --required
RETURNING
operations;
Detaches a stopped block storage disk from a Lightsail instance. Make sure to unmount any file systems on the device within your operating system before stopping the instance and detaching the disk. The detach disk operation supports tag-based access control via resource tags applied to the resource identified by disk name. For more information, see the Amazon Lightsail Developer Guide.
UPDATE aws.lightsail.disks
SET
diskName = '{{ diskName }}'
WHERE
region = '{{ region }}' --required
AND diskName = '{{ diskName }}' --required
RETURNING
operations;
DELETE examples
- delete_disk
Deletes the specified block storage disk. The disk must be in the available state (not attached to a Lightsail instance). The disk may remain in the deleting state for several minutes. The delete disk operation supports tag-based access control via resource tags applied to the resource identified by disk name. For more information, see the Amazon Lightsail Developer Guide.
DELETE FROM aws.lightsail.disks
WHERE region = '{{ region }}' --required
;
Lifecycle Methods
- create_disk_from_snapshot
Creates a block storage disk from a manual or automatic snapshot of a disk. The resulting disk can be attached to an Amazon Lightsail instance in the same Availability Zone (us-east-2a). The create disk from snapshot operation supports tag-based access control via request tags and resource tags applied to the resource identified by disk snapshot name. For more information, see the Amazon Lightsail Developer Guide.
EXEC aws.lightsail.disks.create_disk_from_snapshot
@region='{{ region }}' --required
@@json=
'{
"diskName": "{{ diskName }}",
"diskSnapshotName": "{{ diskSnapshotName }}",
"availabilityZone": "{{ availabilityZone }}",
"sizeInGb": {{ sizeInGb }},
"tags": "{{ tags }}",
"addOns": "{{ addOns }}",
"sourceDiskName": "{{ sourceDiskName }}",
"restoreDate": "{{ restoreDate }}",
"useLatestRestorableAutoSnapshot": {{ useLatestRestorableAutoSnapshot }}
}'
;