create_disk
async
¶
create_disk(
disk_name: ResourceName,
availability_zone: NonEmptyString,
size_in_gb: integer,
*,
config_overrides: Optional[AsyncLightsailClientConfig] = None,
tags: Optional[TagList] = None,
add_ons: Optional[AddOnRequestList] = None,
) -> CreateDiskResult
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.
Parameters:
-
disk_name(ResourceName) –The unique Lightsail disk name (
my-disk). -
availability_zone(NonEmptyString) –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 regionsoperation 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.
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/async_lightsail.py
1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 | |