V
V
Vadim2019-07-04 20:28:43
Amazon Web Services
Vadim, 2019-07-04 20:28:43

How to call AWS API using temporary credentials?

Good day,
I call the aws cli function
aws sts assume-role --role-arn arn:aws:iam::123456789012:role/OrganizationAccountAccessRole --role-session-name mini-admin
It returns temporary security credentials, including AccessKeyId, SecretAccessKey and SessionToken
is it possible somehow to make all other API calls on behalf of this temporary session? How do I call
aws ec2 describe-instances for example - using the credentials obtained before. Or do I need to enter them into a file and get them out of there? In boto3 it's pretty easy, but how to do it in bash and amazon cli?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Eugene, 2019-07-04
@Viji

https://docs.aws.amazon.com/en_us/cli/latest/userg...
You get credits.
You need to put them in the appropriate environment variables.
The following AWS CLI command will then use them.

I
Ivan Shumov, 2019-07-04
@inoise

if you do it from the console, what's stopping you from adding another profile for aws cli? great option, you just need to be able to bash scripting

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question