With the AWS CLI you can assume a role using the --profile parameter:

aws --profile <profile_name> <service> <command>


aws --profile admin s3 ls s3://mybucket/

That profile can be an AWS role that os to be assumed. My problem with that is that the session of the role is only valid for one hour by default. Is there a way of explicitly setting the session duration without using the sts service directly?


You can set a maximum duration of up to 12 hours in the IAM Role config:

enter image description here

Hope that helps.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.