Skip to content

modify_snapshot_tier

modify_snapshot_tier(
    *,
    config_overrides: Optional[EC2ClientConfig] = None,
    snapshot_id: Optional[SnapshotId] = None,
    storage_tier: Optional[TargetStorageTier] = None,
    dry_run: Optional[Boolean] = None,
) -> ModifySnapshotTierResult

Archives an Amazon EBS snapshot. When you archive a snapshot, it is converted to a full snapshot that includes all of the blocks of data that were written to the volume at the time the snapshot was created, and moved from the standard tier to the archive tier. For more information, see Archive Amazon EBS snapshots in the Amazon EBS User Guide.

Parameters:

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

    The ID of the snapshot.

  • storage_tier (Optional[TargetStorageTier], default: None ) –

    The name of the storage tier. You must specify archive.

  • 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 is UnauthorizedOperation.

Raises:

Source code in docs_src/capo_ec2/_services/ec2.py
def modify_snapshot_tier(
    self,
    *,
    config_overrides: Optional[EC2ClientConfig] = None,
    snapshot_id: Optional["capo_ec2.types.snapshot_id.SnapshotId"] = None,
    storage_tier: Optional[
        "capo_ec2.types.target_storage_tier.TargetStorageTier"
    ] = None,
    dry_run: Optional["capo_ec2.types.boolean.Boolean"] = None,
) -> "capo_ec2.types.modify_snapshot_tier_result.ModifySnapshotTierResult":
    """<p>Archives an Amazon EBS snapshot. When you archive a snapshot, it is converted to a full snapshot that includes all of the blocks of data that were written to the volume at the time the snapshot was created, and moved from the standard tier to the archive tier. For more information, see <a href="https://docs.aws.amazon.com/ebs/latest/userguide/snapshot-archive.html">Archive Amazon EBS snapshots</a> in the <i>Amazon EBS User Guide</i>.</p>

    Args:
        snapshot_id: <p>The ID of the snapshot.</p>
        storage_tier: <p>The name of the storage tier. You must specify <code>archive</code>.</p>
        dry_run: <p>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 <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>

    Raises:
        capo_ec2.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_ec2.types.modify_snapshot_tier_request.ModifySnapshotTierRequest]",
    ) -> OperationResponse[
        "capo_ec2.types.modify_snapshot_tier_result.ModifySnapshotTierResult"
    ]:
        import capo_ec2._operations.amazon_ec2.modify_snapshot_tier

        output, http_response = (
            capo_ec2._operations.amazon_ec2.modify_snapshot_tier.modify_snapshot_tier(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ModifySnapshotTier")
    )
    input_: capo_ec2.types.modify_snapshot_tier_request.ModifySnapshotTierRequest = {}
    if snapshot_id is not None:
        input_["snapshot_id"] = snapshot_id
    if storage_tier is not None:
        input_["storage_tier"] = storage_tier
    if dry_run is not None:
        input_["dry_run"] = dry_run

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output