Sample code for 30+ languages & platforms
Rust

S3 Delete Bucket

See more Amazon S3 Examples

Demonstrates how to delete a bucket.

Chilkat Rust Downloads

Rust

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

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

// Insert your access key here:
http.set_aws_access_key("ABQXXABC83ABCDEFVQXX");

// Insert your secret key here:
http.set_aws_secret_key("XXXXYYYYabcdABCD12345678xxxxyyyyzzzz");

http.set_keep_response_body(true);

if http.s3_delete_bucket("chilkattestbucket").is_err() {
    println!("{}", http.last_error_text());
    // Also examine the error response body from AWS:
    println!("{}", http.last_response_body());
} else {
    println!("Bucket deleted.");
}