Sample code for 30+ languages & platforms
Rust

S3 Download Specific Version of File

See more Amazon S3 Examples

Demonstrates how to download a file from the Amazon S3 service using the versionId query parameter.

Note: This example requires Chilkat v9.5.0.89 or later. (A problem regarding AwsSubResources w/ downloads was fixed shortly after the v9.5.0.88 release.)

Chilkat Rust Downloads

Rust

// This requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

let http = chilkat::Http::new();

http.set_aws_access_key("AWS_ACCESS_KEY");
http.set_aws_secret_key("AWS_SECRET_KEY");
http.set_aws_region("us-east-1");
http.set_aws_endpoint("s3.amazonaws.com");
http.set_aws_sub_resources("versionId=x8UPzRsgskmbe55lEQvhLi25PQl2lcFH");

let bucket_name = "chilkat100".to_string();
let object_name = "frenchUtf8.txt".to_string();
let local_file_path = "qa_output/frenchUtf8.txt".to_string();

if http.s3_download_file(&bucket_name, &object_name, &local_file_path).is_err() {
    println!("{}", http.last_error_text());
} else {
    println!("File downloaded.");
}