I want to change the session duration of iam role credentials to 12 hours

Viewed 772

I made a role and by using this commend

aws sts assume-role --role-arn arn:aws:iam::xxxxxxxxxxxxrole/rolename --role-session-name s3sdawx

i got credentials After obtaining temporary credentials with the command I accessed s3 with these credentials!

by the way Token expires after 1 hour. So, as shown in the picture, I changed the maximum session duration to 12 hours, got the temporary credentials through the above command again and tried to apply it again, but it still expires after 1 hour! I wonder what method should be used to extend it to 12 hours!

1 Answers

You have to add --duration-seconds 43200 to your command:

aws sts assume-role --role-arn arn:aws:iam::xxxxxxxxxxxxrole/rolename --role-session-name s3sdawx --duration-seconds 43200
Related