I am using the AWS SDK for Rust to assume a role for making a request under a new account.
As shown in the Python example from the docs, I'm looking for credentials like aws_access_key_id
, aws_secret_access_key
and aws_session_token
,
However, the Rust example looks different, and doesn't seem to surface the underlying credentials.
How can I get the credentials for my assumed role using the AWS SDK for Rust?
The Rust example isn't the best (as it's admittedly in preview) & also has an argument named
role_name
when it really should berole_arn
...That said, to obtain the access key ID, secret access key & session token - just like the Python example - use the
ProvideCredentials
method of theAssumeRoleProvider
.Here is a complete yet minimal working Rust CLI app to demonstrate the above: