Skip to main content

replace_root_volume_tasks

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

Overview

Namereplace_root_volume_tasks
TypeResource
Idaws.ec2.replace_root_volume_tasks

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
complete_timestringThe time the task completed.
delete_replaced_root_volumebooleanIndicates whether the original root volume is to be deleted after the root volume replacement task completes.
image_idstringThe ID of the AMI used to create the replacement root volume.
instance_idstringThe ID of the instance for which the root volume replacement task was created.
replace_root_volume_task_idstringThe ID of the root volume replacement task.
snapshot_idstringThe ID of the snapshot used to create the replacement root volume.
start_timestringThe time the task was started.
tagsstringThe tags assigned to the task.
task_statestringThe state of the task. The task can be in one of the following states: pending - the replacement volume is being created. in-progress - the original volume is being detached and the replacement volume is being attached. succeeded - the replacement volume has been successfully attached to the instance and the instance is available. failing - the replacement task is in the process of failing. failed - the replacement task has failed but the original root volume is still attached. failing-detached - the replacement task is in the process of failing. The instance might have no root volume attached. failed-detached - the replacement task has failed and the instance has no root volume attached.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
describe_replace_root_volume_tasksselectregionReplaceRootVolumeTaskId, Filter, MaxResults, NextToken, DryRunDescribes a root volume replacement task. For more information, see Replace a root volume in the Amazon EC2 User Guide.
create_replace_root_volume_taskinsertInstanceId, regionSnapshotId, ClientToken, DryRun, TagSpecification, ImageId, DeleteReplacedRootVolume, VolumeInitializationRate, VolumeIdReplaces the EBS-backed root volume for a running instance with a new volume that is restored to the original root volume's launch state, that is restored to a specific snapshot taken from the original root volume, that is restored from an AMI that has the same key characteristics as that of the instance, or that is replaced by a specified volume. For more information, see Replace a root volume in the Amazon EC2 User 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
InstanceIdstringThe ID of the instance for which to replace the root volume.
regionstringAWS region (default: us-east-1)
ClientTokenstringUnique, case-sensitive identifier you provide to ensure the idempotency of the request. If you do not specify a client token, a randomly generated token is used for the request to ensure idempotency. For more information, see Ensuring idempotency.
DeleteReplacedRootVolumebooleanIndicates whether to automatically delete the original root volume after the root volume replacement task completes. To delete the original root volume, specify true. If you choose to keep the original root volume after the replacement task completes, you must manually delete it when you no longer need it.
DryRunbooleanChecks 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.
FilterarrayFilter to use: instance-id - The ID of the instance for which the root volume replacement task was created.
ImageIdstringThe ID of the AMI to use to restore the root volume. The specified AMI must have the same product code, billing information, architecture type, and virtualization type as that of the instance. If you want to restore the replacement volume from a specific snapshot, if you want to restore it to its launch state, or if you want to replace the root volume with a specified volume, omit this parameter.
MaxResultsintegerThe maximum number of items to return for this request. To get the next page of items, make another request with the token returned in the output. For more information, see Pagination.
NextTokenstringThe token returned from a previous paginated request. Pagination continues from the end of the items returned by the previous request.
ReplaceRootVolumeTaskIdarrayThe ID of the root volume replacement task to view.
SnapshotIdstringThe ID of the snapshot from which to restore the replacement root volume. The specified snapshot must be a snapshot that you previously created from the original root volume. If you want to restore the replacement root volume to the initial launch state, if you want to restore the replacement root volume from an AMI, or if you want to replace the root volume with a specified volume, omit this parameter.
TagSpecificationarrayThe tags to apply to the root volume replacement task.
VolumeIdstringThe ID of the volume to use as the replacement root volume. The specified volume must be in the same Availability Zone as the instance, must be in the available state, and must not be attached to an instance. If the original root volume is encrypted, the specified volume must also be encrypted. If you want to restore the replacement root volume from a specific snapshot, an AMI, or to its launch state, omit this parameter.
VolumeInitializationRateinteger (int64)Specifies the Amazon EBS Provisioned Rate for Volume Initialization (volume initialization rate), in MiB/s, at which to download the snapshot blocks from Amazon S3 to the replacement root volume. This is also known as volume initialization. Specifying a volume initialization rate ensures that the volume is initialized at a predictable and consistent rate after creation. Omit this parameter if: You want to create the volume using fast snapshot restore. You must specify a snapshot that is enabled for fast snapshot restore. In this case, the volume is fully initialized at creation. If you specify a snapshot that is enabled for fast snapshot restore and a volume initialization rate, the volume will be initialized at the specified rate instead of fast snapshot restore. You want to create a volume that is initialized at the default rate. For more information, see Initialize Amazon EBS volumes in the Amazon EC2 User Guide. Valid range: 100 - 300 MiB/s

SELECT examples

Describes a root volume replacement task. For more information, see Replace a root volume in the Amazon EC2 User Guide.

SELECT
complete_time,
delete_replaced_root_volume,
image_id,
instance_id,
replace_root_volume_task_id,
snapshot_id,
start_time,
tags,
task_state
FROM aws.ec2.replace_root_volume_tasks
WHERE region = '{{ region }}' -- required
AND ReplaceRootVolumeTaskId = '{{ ReplaceRootVolumeTaskId }}'
AND Filter = '{{ Filter }}'
AND MaxResults = '{{ MaxResults }}'
AND NextToken = '{{ NextToken }}'
AND DryRun = '{{ DryRun }}'
;

INSERT examples

Replaces the EBS-backed root volume for a running instance with a new volume that is restored to the original root volume's launch state, that is restored to a specific snapshot taken from the original root volume, that is restored from an AMI that has the same key characteristics as that of the instance, or that is replaced by a specified volume. For more information, see Replace a root volume in the Amazon EC2 User Guide.

INSERT INTO aws.ec2.replace_root_volume_tasks (
InstanceId,
region,
SnapshotId,
ClientToken,
DryRun,
TagSpecification,
ImageId,
DeleteReplacedRootVolume,
VolumeInitializationRate,
VolumeId
)
SELECT
'{{ InstanceId }}',
'{{ region }}',
'{{ SnapshotId }}',
'{{ ClientToken }}',
'{{ DryRun }}',
'{{ TagSpecification }}',
'{{ ImageId }}',
'{{ DeleteReplacedRootVolume }}',
'{{ VolumeInitializationRate }}',
'{{ VolumeId }}'
RETURNING
complete_time,
delete_replaced_root_volume,
image_id,
instance_id,
replace_root_volume_task_id,
snapshot_id,
start_time,
tags,
task_state
;