create_disk_from_snapshot
¶
create_disk_from_snapshot(
disk_name: ResourceName,
availability_zone: NonEmptyString,
size_in_gb: integer,
*,
config_overrides: Optional[LightsailClientConfig] = None,
disk_snapshot_name: Optional[ResourceName] = None,
tags: Optional[TagList] = None,
add_ons: Optional[AddOnRequestList] = None,
source_disk_name: Optional[string] = None,
restore_date: Optional[string] = None,
use_latest_restorable_auto_snapshot: Optional[boolean] = None,
) -> CreateDiskFromSnapshotResult
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:
-
disk_name(ResourceName) –The unique Lightsail disk name (
my-disk). -
disk_snapshot_name(Optional[ResourceName], default:None) –The name of the disk snapshot (
my-snapshot) from which to create the new storage disk.Constraint:
-
This parameter cannot be defined together with the
source disk nameparameter. Thedisk snapshot nameandsource disk nameparameters are mutually exclusive.
-
-
availability_zone(NonEmptyString) –The Availability Zone where you want to create the disk (
us-east-2a). Choose the same Availability Zone as the Lightsail instance where you want to create the disk.Use the GetRegions operation to list the Availability Zones where Lightsail is currently available.
-
size_in_gb(integer) –The size of the disk in GB (
32). -
tags(Optional[TagList], default:None) –The tag keys and optional values to add to the resource during create.
Use the
TagResourceaction to tag a resource after it's created. -
add_ons(Optional[AddOnRequestList], default:None) –An array of objects that represent the add-ons to enable for the new disk.
-
source_disk_name(Optional[string], default:None) –The name of the source disk from which the source automatic snapshot was created.
Constraints:
-
This parameter cannot be defined together with the
disk snapshot nameparameter. Thesource disk nameanddisk snapshot nameparameters are mutually exclusive. -
Define this parameter only when creating a new disk from an automatic snapshot. For more information, see the Amazon Lightsail Developer Guide.
-
-
restore_date(Optional[string], default:None) –The date of the automatic snapshot to use for the new disk. Use the
get auto snapshotsoperation to identify the dates of the available automatic snapshots.Constraints:
-
Must be specified in
YYYY-MM-DDformat. -
This parameter cannot be defined together with the
use latest restorable auto snapshotparameter. Therestore dateanduse latest restorable auto snapshotparameters are mutually exclusive. -
Define this parameter only when creating a new disk from an automatic snapshot. For more information, see the Amazon Lightsail Developer Guide.
-
-
use_latest_restorable_auto_snapshot(Optional[boolean], default:None) –A Boolean value to indicate whether to use the latest available automatic snapshot.
Constraints:
-
This parameter cannot be defined together with the
restore dateparameter. Theuse latest restorable auto snapshotandrestore dateparameters are mutually exclusive. -
Define this parameter only when creating a new disk from an automatic snapshot. For more information, see the Amazon Lightsail Developer Guide.
-
Raises:
-
AccessDeniedException–Lightsail throws this exception when the user cannot be authenticated or uses invalid credentials to access a resource.
-
AccountSetupInProgressException–Lightsail throws this exception when an account is still in the setup in progress state.
-
InvalidInputException–Lightsail throws this exception when user input does not conform to the validation rules of an input field.
Domain and distribution APIs are only available in the N. Virginia (
us-east-1) Amazon Web Services Region. Please set your Amazon Web Services Region configuration tous-east-1to create, view, or edit these resources. -
NotFoundException–Lightsail throws this exception when it cannot find a resource.
-
OperationFailureException–Lightsail throws this exception when an operation fails to execute.
-
RegionSetupInProgressException–Lightsail throws this exception when an operation is performed on resources in an opt-in Region that is currently being set up.
-
ServiceException–A general service exception.
-
UnauthenticatedException–Lightsail throws this exception when the user has not been authenticated.
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_lightsail/_services/lightsail.py
1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 | |