Skip to main content

Crate coldsnap

Crate coldsnap 

Source
Expand description

A library that uses the Amazon EBS direct APIs to work with snapshots.

§Examples

Downloading a snapshot into a disk image:

use coldsnap::SnapshotDownloader;
use aws_sdk_ebs::Client as EbsClient;
use std::path::Path;

let client = EbsClient::new(&aws_config::from_env().region("us-west-2").load().await);
let downloader = SnapshotDownloader::new(client);
let path = Path::new("./disk.img");

downloader.download_to_file("snap-1234", &path, None, None, None)
    .await
    .expect("failed to download snapshot");

Uploading a disk image into a snapshot:

use coldsnap::SnapshotUploader;
use aws_sdk_ebs::Client as EbsClient;
use std::path::Path;

let client = EbsClient::new(&aws_config::from_env().region("us-west-2").load().await);
let uploader = SnapshotUploader::new(client);
let path = Path::new("./disk.img");

let snapshot_id = uploader.upload_from_file(&path, None, None, None, None, None, None, None)
        .await
        .expect("failed to upload snapshot");

Waiting for a snapshot to be completed:

use coldsnap::SnapshotWaiter;
use aws_sdk_ec2::Client as Ec2Client;

let client = Ec2Client::new(&aws_config::from_env().region("us-west-2").load().await);
let waiter = SnapshotWaiter::new(client);

waiter.wait_for_completed("snap-1234")
        .await
        .expect("failed to wait for snapshot");

Structs§

DownloadError
SnapshotDownloader
SnapshotUploader
SnapshotWaiter
Allows you to wait for snapshots to come to a desired state in the region associated with the given Ec2Client.
UploadError
WaitError
WaitParams

Enums§

CheckpointBehavior
Specify how checkpointing should be handled for resumable downloads.
UploadZeroBlocks
Specify how blocks of all zeroes should be handled.