Skip to content

Instantly share code, notes, and snippets.

@epequeno
Last active April 16, 2018 13:11
Show Gist options
  • Save epequeno/d12556964b2586c63ddb15b063dfba42 to your computer and use it in GitHub Desktop.
Save epequeno/d12556964b2586c63ddb15b063dfba42 to your computer and use it in GitHub Desktop.
v2 to use v0.32.0 of rusoto_* libs
#[macro_use]
extern crate clap;
extern crate rusoto_core;
extern crate rusoto_ec2;
use clap::App;
use rusoto_core::{EnvironmentProvider, Region};
use rusoto_core::reactor::RequestDispatcher;
use rusoto_ec2::{Ec2Client, DescribeInstancesRequest, Ec2};
fn main() {
let yaml = load_yaml!("cli.yml");
let _matches = App::from_yaml(yaml).get_matches();
let dispatcher = RequestDispatcher::default();
// This forces the app to use credentials in env vars rather than ~/.aws/credentials
let provider = EnvironmentProvider;
let client = Ec2Client::new(dispatcher, provider, Region::UsEast1);
let req = DescribeInstancesRequest::default();
let res = client.describe_instances(&req).sync();
if let Err(e) = res {
println!("{}", e);
} else {
println!("{:?}", res);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment