Skip to content

EC2  >  Operations  >  create_replace_root_volume_task

create_replace_root_volume_task

Operation

create_replace_root_volume_task async

create_replace_root_volume_task(input: CreateReplaceRootVolumeTaskInput, plugins: list[Plugin] | None = None) -> CreateReplaceRootVolumeTaskOutput

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.

Parameters:

Name Type Description Default
input CreateReplaceRootVolumeTaskInput

An instance of CreateReplaceRootVolumeTaskInput.

required
plugins list[Plugin] | None

A list of callables that modify the configuration dynamically. Changes made by these plugins only apply for the duration of the operation execution and will not affect any other operation invocations.

None

Returns:

Type Description
CreateReplaceRootVolumeTaskOutput

An instance of CreateReplaceRootVolumeTaskOutput.

Input

CreateReplaceRootVolumeTaskInput dataclass

Bases: _SerdeShape

Dataclass for CreateReplaceRootVolumeTaskInput structure.

Attributes

client_token class-attribute instance-attribute
client_token: str | None = ...

Unique, 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.

delete_replaced_root_volume class-attribute instance-attribute
delete_replaced_root_volume: bool | None = ...

Indicates 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.

dry_run class-attribute instance-attribute
dry_run: bool | None = ...

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.

image_id class-attribute instance-attribute
image_id: str | None = ...

The 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.

instance_id class-attribute instance-attribute
instance_id: str | None = ...

The ID of the instance for which to replace the root volume.

snapshot_id class-attribute instance-attribute
snapshot_id: str | None = ...

The 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.

tag_specifications class-attribute instance-attribute
tag_specifications: list[TagSpecification] | None = ...

The tags to apply to the root volume replacement task.

volume_id class-attribute instance-attribute
volume_id: str | None = ...

The 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.

volume_initialization_rate class-attribute instance-attribute
volume_initialization_rate: int | None = ...

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.

Note: 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

Output

CreateReplaceRootVolumeTaskOutput dataclass

Bases: _SerdeShape

Dataclass for CreateReplaceRootVolumeTaskOutput structure.

Attributes

replace_root_volume_task class-attribute instance-attribute
replace_root_volume_task: ReplaceRootVolumeTask | None = ...

Information about the root volume replacement task.

response_metadata class-attribute instance-attribute
response_metadata: ResponseMetadata = ...

Metadata about the response that produced this output. Use this to recover the request identifiers a service's support team needs in order to investigate a call. Members of the metadata are individually optional.