- Newest
- Most votes
- Most comments
IAM role allow you to set the maximum session duration on role level and when assuming that role you can specify how long you want to assume that role for (i.e your current session duration). You can specify 1 hour on both and then in your Java app you can request the credentials again every hour and keep them cached in your app for 1 hour.
For more information please check: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html
For Java SDK the Credentials object has the expiration() method which can tell you when the credentials are expiring. For more information please check following examples
https://docs.aws.amazon.com/code-samples/latest/catalog/javav2-sts-src-main-java-com-example-sts-AssumeRole.java.html https://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/prog-services-sts.html
Thanks for the detailed help. I like the fact of expiring it as well so I can pass on those options to the dev team.
Thank you again.
Relevant content
- asked 2 years ago
- asked 3 months ago
- AWS OFFICIALUpdated 7 months ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated a month ago
- AWS OFFICIALUpdated 2 years ago