Sub topic 7
Session duration and relay state
This chapter assumes you can create a permission set and know that Identity Center provisions an IAM role from it in each assigned account. Two permission set settings control what happens after a user picks an account in the access portal: how long the role session lasts, and where the browser lands.
Session duration
Session duration sets how long credentials for the role last before the user must get new ones. It is an ISO 8601 duration, such as PT1H or PT8H. The minimum is one hour, the maximum is 12 hours, and the default is one hour.
When you provision the permission set, Identity Center uses this value as the maximum session duration of the role it creates in each account. Choose it by the risk of the role:
- Short durations (
PT1HtoPT4H) suit administrative or write-capable roles. A leaked credential expires sooner. - Longer durations (
PT8HtoPT12H) suit read-only or day-to-day roles. They spare users from signing in repeatedly.
The session duration is separate from the access portal session. The portal session controls how long a user stays signed in to the portal itself. It is an Identity Center instance setting, not a permission set setting. A user with a valid portal session can still get new role credentials after a role session expires.
Relay state
Relay state is a URL that the user is sent to after signing in to an account through the portal. Without it, the user lands on the console home page. With it, the user goes to a specific service page or Region. The URL must point to the AWS Management Console.
For example, a permission set for database operators can open the RDS console in one Region:
aws sso-admin update-permission-set \
--instance-arn "$INSTANCE_ARN" \
--permission-set-arn "$PS_ARN" \
--session-duration PT8H \
--relay-state "https://us-east-1.console.aws.amazon.com/rds/home?region=us-east-1"Relay state only changes where the browser lands. It grants no access. A user whose policies do not allow RDS still sees an access-denied page there.
Applying changes
Updating either setting changes the permission set in Identity Center. It does not change the roles that already exist in the accounts. Re-provision to push the change:
aws sso-admin provision-permission-set \
--instance-arn "$INSTANCE_ARN" \
--permission-set-arn "$PS_ARN" \
--target-type ALL_PROVISIONED_ACCOUNTSSessions that are already running keep their original expiry. New sessions use the new value.
Common errors
- A new duration has no effect. You updated the permission set but did not re-provision it.
- A value is rejected. Use ISO 8601 form (
PT4H, not4h) and stay between one and 12 hours. - The relay state is ignored or fails. Check that the URL is a full AWS console URL, including
https://.
Exercise
You change a permission set's session duration from PT1H to PT8H. Existing users still see sessions that expire after one hour. What did you probably forget, and what do chained roles do to the limit?
Show answer
You did not re-provision the permission set, so the roles in the accounts still have the old maximum session duration. Run provision-permission-set with --target-type ALLPROVISIONEDACCOUNTS. Sessions that are already running keep their old expiry. Role chaining caps the chained session at one hour regardless of this setting.