use aws_config::default_provider::credentials::DefaultCredentialsChain;
use aws_config::sts::AssumeRoleProvider;
use aws_types::region::Region;
#[tokio::main]
async fn main() {
let credentials_provider = DefaultCredentialsChain::builder().build().await;
let assume_role_arn = "TARGET_ROLE_ARN";
let assume_role_provider = AssumeRoleProvider::builder(assume_role_arn)
.region(Region::new("ap-northeast-1"))
.build(credentials_provider);
let aws_config = aws_config::from_env()
.region("ap-northeast-1")
.credentials_provider(assume_role_provider)
.load()
.await;
let client = aws_sdk_route53::Client::new(&aws_config);
let hosted_zones = client.list_hosted_zones().send().await.unwrap();
for hz in hosted_zones.hosted_zones.unwrap() {
println!("{}", hz.name.unwrap());
}
}
More than 1 year has passed since last update.
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme