I'm trying to create temporary(?) credentials using an IAM role. From what I learned in the package's GitHub issues, they implemented the feature for Rust but I just can't figure where it is.
The equivalent code in NodeJS is:
import * as aws from 'aws-sdk'
ecsCredentials = new aws.ECSCredentials()
await ecsCredentials.getPromise()
aws.config.credentials = ecsCredentials
I ended up doing:
use aws_config::ecs::EcsCredentialsProvider;
// When run in AWS, this uses the execution role to create temporary credentials.
let credentials_provider_builder = EcsCredentialsProvider::builder();
let creadentials_provider = credentials_provider_builder.build();
let credentials = creadentials_provider.credentials();
// Convert to Config object and connect.
let conf = aws_config::from_env().credentials_provider(credentials).region("us-east-1").load().await;
let conf = Config::new(&conf);
let client = Client::from_conf(conf);