Skip to content

start_snapshot async

start_snapshot(
    volume_size: VolumeSize,
    *,
    config_overrides: Optional[AsyncEBSClientConfig] = None,
    parent_snapshot_id: Optional[SnapshotId] = None,
    tags: Optional[Tags] = None,
    description: Optional[Description] = None,
    client_token: Optional[IdempotencyToken] = None,
    encrypted: Optional[Boolean] = None,
    kms_key_arn: Optional[KmsKeyArn] = None,
    timeout: Optional[Timeout] = None,
) -> StartSnapshotResponse

Creates a new Amazon EBS snapshot. The new snapshot enters the pending state after the request completes.

After creating the snapshot, use PutSnapshotBlock to write blocks of data to the snapshot.

You should always retry requests that receive server (5xx) error responses, and ThrottlingException and RequestThrottledException client error responses. For more information see Error retries in the Amazon Elastic Compute Cloud User Guide.

Parameters:

  • volume_size (VolumeSize) –

    The size of the volume, in GiB. The maximum size is 65536 GiB (64 TiB).

  • parent_snapshot_id (Optional[SnapshotId], default: None ) –

    The ID of the parent snapshot. If there is no parent snapshot, or if you are creating the first snapshot for an on-premises volume, omit this parameter.

    You can't specify ParentSnapshotId and Encrypted in the same request. If you specify both parameters, the request fails with ValidationException.

    The encryption status of the snapshot depends on the values that you specify for Encrypted, KmsKeyArn, and ParentSnapshotId, and whether your Amazon Web Services account is enabled for encryption by default. For more information, see Using encryption in the Amazon Elastic Compute Cloud User Guide.

    If you specify an encrypted parent snapshot, you must have permission to use the KMS key that was used to encrypt the parent snapshot. For more information, see Permissions to use Key Management Service keys in the Amazon Elastic Compute Cloud User Guide.

  • tags (Optional[Tags], default: None ) –

    The tags to apply to the snapshot.

  • description (Optional[Description], default: None ) –

    A description for the snapshot.

  • client_token (Optional[IdempotencyToken], default: None ) –

    A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. Idempotency ensures that an API request completes only once. With an idempotent request, if the original request completes successfully. The subsequent retries with the same client token return the result from the original successful request and they have no additional effect.

    If you do not specify a client token, one is automatically generated by the Amazon Web Services SDK.

    For more information, see Idempotency for StartSnapshot API in the Amazon Elastic Compute Cloud User Guide.

  • encrypted (Optional[Boolean], default: None ) –

    Indicates whether to encrypt the snapshot.

    You can't specify Encrypted and ParentSnapshotId in the same request. If you specify both parameters, the request fails with ValidationException.

    The encryption status of the snapshot depends on the values that you specify for Encrypted, KmsKeyArn, and ParentSnapshotId, and whether your Amazon Web Services account is enabled for encryption by default. For more information, see Using encryption in the Amazon Elastic Compute Cloud User Guide.

    To create an encrypted snapshot, you must have permission to use the KMS key. For more information, see Permissions to use Key Management Service keys in the Amazon Elastic Compute Cloud User Guide.

  • kms_key_arn (Optional[KmsKeyArn], default: None ) –

    The Amazon Resource Name (ARN) of the Key Management Service (KMS) key to be used to encrypt the snapshot.

    The encryption status of the snapshot depends on the values that you specify for Encrypted, KmsKeyArn, and ParentSnapshotId, and whether your Amazon Web Services account is enabled for encryption by default. For more information, see Using encryption in the Amazon Elastic Compute Cloud User Guide.

    To create an encrypted snapshot, you must have permission to use the KMS key. For more information, see Permissions to use Key Management Service keys in the Amazon Elastic Compute Cloud User Guide.

  • timeout (Optional[Timeout], default: None ) –

    The amount of time (in minutes) after which the snapshot is automatically cancelled if:

    • No blocks are written to the snapshot.

    • The snapshot is not completed after writing the last block of data.

    If no value is specified, the timeout defaults to 60 minutes.

Raises:

Source code in docs_src/capo_ebs/_services/async_ebs.py
async def start_snapshot(
    self,
    volume_size: "capo_ebs.types.volume_size.VolumeSize",
    *,
    config_overrides: Optional[AsyncEBSClientConfig] = None,
    parent_snapshot_id: Optional["capo_ebs.types.snapshot_id.SnapshotId"] = None,
    tags: Optional["capo_ebs.types.tags.Tags"] = None,
    description: Optional["capo_ebs.types.description.Description"] = None,
    client_token: Optional[
        "capo_ebs.types.idempotency_token.IdempotencyToken"
    ] = None,
    encrypted: Optional["capo_ebs.types.boolean.Boolean"] = None,
    kms_key_arn: Optional["capo_ebs.types.kms_key_arn.KmsKeyArn"] = None,
    timeout: Optional["capo_ebs.types.timeout.Timeout"] = None,
) -> "capo_ebs.types.start_snapshot_response.StartSnapshotResponse":
    """<p>Creates a new Amazon EBS snapshot. The new snapshot enters the <code>pending</code> state after the request completes. </p> <p>After creating the snapshot, use <a href="https://docs.aws.amazon.com/ebs/latest/APIReference/API_PutSnapshotBlock.html"> PutSnapshotBlock</a> to write blocks of data to the snapshot.</p> <note> <p>You should always retry requests that receive server (<code>5xx</code>) error responses, and <code>ThrottlingException</code> and <code>RequestThrottledException</code> client error responses. For more information see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/error-retries.html">Error retries</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>.</p> </note>

    Args:
        volume_size: <p>The size of the volume, in GiB. The maximum size is <code>65536</code> GiB (64 TiB).</p>
        parent_snapshot_id: <p>The ID of the parent snapshot. If there is no parent snapshot, or if you are creating the first snapshot for an on-premises volume, omit this parameter.</p> <p>You can't specify <b>ParentSnapshotId</b> and <b>Encrypted</b> in the same request. If you specify both parameters, the request fails with <code>ValidationException</code>.</p> <p>The encryption status of the snapshot depends on the values that you specify for <b>Encrypted</b>, <b>KmsKeyArn</b>, and <b>ParentSnapshotId</b>, and whether your Amazon Web Services account is enabled for <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html#encryption-by-default"> encryption by default</a>. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebsapis-using-encryption.html"> Using encryption</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>.</p> <important> <p>If you specify an encrypted parent snapshot, you must have permission to use the KMS key that was used to encrypt the parent snapshot. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebsapi-permissions.html#ebsapi-kms-permissions"> Permissions to use Key Management Service keys</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>.</p> </important>
        tags: <p>The tags to apply to the snapshot.</p>
        description: <p>A description for the snapshot.</p>
        client_token: <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. Idempotency ensures that an API request completes only once. With an idempotent request, if the original request completes successfully. The subsequent retries with the same client token return the result from the original successful request and they have no additional effect.</p> <p>If you do not specify a client token, one is automatically generated by the Amazon Web Services SDK.</p> <p>For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-direct-api-idempotency.html"> Idempotency for StartSnapshot API</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>.</p>
        encrypted: <p>Indicates whether to encrypt the snapshot.</p> <p>You can't specify <b>Encrypted</b> and <b> ParentSnapshotId</b> in the same request. If you specify both parameters, the request fails with <code>ValidationException</code>.</p> <p>The encryption status of the snapshot depends on the values that you specify for <b>Encrypted</b>, <b>KmsKeyArn</b>, and <b>ParentSnapshotId</b>, and whether your Amazon Web Services account is enabled for <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html#encryption-by-default"> encryption by default</a>. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebsapis-using-encryption.html"> Using encryption</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>.</p> <important> <p>To create an encrypted snapshot, you must have permission to use the KMS key. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebsapi-permissions.html#ebsapi-kms-permissions"> Permissions to use Key Management Service keys</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>.</p> </important>
        kms_key_arn: <p>The Amazon Resource Name (ARN) of the Key Management Service (KMS) key to be used to encrypt the snapshot.</p> <p>The encryption status of the snapshot depends on the values that you specify for <b>Encrypted</b>, <b>KmsKeyArn</b>, and <b>ParentSnapshotId</b>, and whether your Amazon Web Services account is enabled for <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html#encryption-by-default"> encryption by default</a>. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebsapis-using-encryption.html"> Using encryption</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>.</p> <important> <p>To create an encrypted snapshot, you must have permission to use the KMS key. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebsapi-permissions.html#ebsapi-kms-permissions"> Permissions to use Key Management Service keys</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>.</p> </important>
        timeout: <p>The amount of time (in minutes) after which the snapshot is automatically cancelled if:</p> <ul> <li> <p>No blocks are written to the snapshot.</p> </li> <li> <p>The snapshot is not completed after writing the last block of data.</p> </li> </ul> <p>If no value is specified, the timeout defaults to <code>60</code> minutes.</p>

    Raises:
        capo_ebs.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
        capo_ebs.errors.concurrent_limit_exceeded_exception.ConcurrentLimitExceededException: <p>You have reached the limit for concurrent API requests. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-accessing-snapshot.html#ebsapi-performance">Optimizing performance of the EBS direct APIs</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>.</p>
        capo_ebs.errors.conflict_exception.ConflictException: <p>The request uses the same client token as a previous, but non-identical request.</p>
        capo_ebs.errors.internal_server_exception.InternalServerException: <p>An internal error has occurred. For more information see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/error-retries.html">Error retries</a>.</p>
        capo_ebs.errors.request_throttled_exception.RequestThrottledException: <p>The number of API requests has exceeded the maximum allowed API request throttling limit for the snapshot. For more information see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/error-retries.html">Error retries</a>.</p>
        capo_ebs.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource does not exist.</p>
        capo_ebs.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>Your current service quotas do not allow you to perform this action.</p>
        capo_ebs.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints of the EBS direct APIs.</p>
        capo_ebs.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_ebs.types.start_snapshot_request.StartSnapshotRequest]",
    ) -> AsyncOperationResponse[
        "capo_ebs.types.start_snapshot_response.StartSnapshotResponse"
    ]:
        import capo_ebs._operations.ebs.start_snapshot

        (
            output,
            http_response,
        ) = await capo_ebs._operations.ebs.start_snapshot.async_start_snapshot(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_ebs.types.start_snapshot_request.StartSnapshotRequest",
    ) -> dict[str, Any]:
        import capo_ebs.types.start_snapshot_request

        return capo_ebs.types.start_snapshot_request.redact_sensitive(input_)

    def _redact_output(
        output: "capo_ebs.types.start_snapshot_response.StartSnapshotResponse",
    ) -> dict[str, Any]:
        import capo_ebs.types.start_snapshot_response

        return capo_ebs.types.start_snapshot_response.redact_sensitive(output)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "StartSnapshot",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_ebs.types.start_snapshot_request.StartSnapshotRequest = {
        "volume_size": volume_size
    }
    if parent_snapshot_id is not None:
        input_["parent_snapshot_id"] = parent_snapshot_id
    if tags is not None:
        input_["tags"] = tags
    if description is not None:
        input_["description"] = description
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if encrypted is not None:
        input_["encrypted"] = encrypted
    if kms_key_arn is not None:
        input_["kms_key_arn"] = kms_key_arn
    if timeout is not None:
        input_["timeout"] = timeout

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output