create_snapshot
async
¶
create_snapshot(
*,
config_overrides: Optional[AsyncEC2ClientConfig] = None,
description: Optional[String] = None,
outpost_arn: Optional[String] = None,
volume_id: Optional[VolumeId] = None,
tag_specifications: Optional[TagSpecificationList] = None,
location: Optional[SnapshotLocationEnum] = None,
dry_run: Optional[Boolean] = None,
) -> Snapshot
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.
The location of the source EBS volume determines where you can create the snapshot.
-
If the source volume is in a Region, you must create the snapshot in the same Region as the volume.
-
If the source volume is in a Local Zone, you can create the snapshot in the same Local Zone or in its parent Amazon Web Services Region.
-
If the source volume is on an Outpost, you can create the snapshot on the same Outpost or in its parent Amazon Web Services Region.
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.
When you create a snapshot for an EBS volume that serves as a root device, we recommend that you 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. For more information, see Amazon EBS encryption in the Amazon EBS User Guide.
Parameters:
-
description(Optional[String], default:None) –A description for the snapshot.
-
outpost_arn(Optional[String], default:None) –Only supported for volumes on Outposts. If the source volume is not on an Outpost, omit this parameter.
-
To create the snapshot on the same Outpost as the source volume, specify the ARN of that Outpost. The snapshot must be created on the same Outpost as the volume.
-
To create the snapshot in the parent Region of the Outpost, omit this parameter.
For more information, see Create local snapshots from volumes on an Outpost in the Amazon EBS User Guide.
-
-
volume_id(Optional[VolumeId], default:None) –The ID of the Amazon EBS volume.
-
tag_specifications(Optional[TagSpecificationList], default:None) –The tags to apply to the snapshot during creation.
-
location(Optional[SnapshotLocationEnum], default:None) –Only supported for volumes in Local Zones. If the source volume is not in a Local Zone, omit this parameter.
-
To create a local snapshot in the same Local Zone as the source volume, specify
local. -
To create a regional snapshot in the parent Region of the Local Zone, specify
regionalor omit this parameter.
Default value:
regional -
-
dry_run(Optional[Boolean], default: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 isUnauthorizedOperation.
Raises:
-
UnknownServiceError–The service returned an error code this client does not model.
Examples:
To create a snapshot
This example creates a snapshot of the volume with a volume ID of vol-1234567890abcdef0 and a short description to identify the snapshot.
>>> await client.create_snapshot(volume_id='vol-1234567890abcdef0', description='This is my root volume snapshot.')
Source code in docs_src/capo_ec2/_services/async_ec2.py
12434 12435 12436 12437 12438 12439 12440 12441 12442 12443 12444 12445 12446 12447 12448 12449 12450 12451 12452 12453 12454 12455 12456 12457 12458 12459 12460 12461 12462 12463 12464 12465 12466 12467 12468 12469 12470 12471 12472 12473 12474 12475 12476 12477 12478 12479 12480 12481 12482 12483 12484 12485 12486 12487 12488 12489 12490 12491 12492 12493 12494 12495 12496 12497 12498 12499 12500 12501 12502 12503 12504 12505 | |