Sub topic 3
Permission sets and account assignments
This chapter assumes you know what an AWS account and an IAM role are, and that you have an IAM Identity Center instance with at least one user. You will see how Identity Center decides which roles a person can use in which accounts. The next chapter turns that into CLI configuration.
The problem a permission set solves
With IAM users, you create a user in each account and attach policies to it. With Identity Center, you define a person once. You then describe what that person may do in each account, and Identity Center creates the roles that carry out that description.
A permission set is a reusable template of permissions. It holds:
- Zero or more AWS managed policies, such as
ReadOnlyAccess. - An optional inline policy.
- An optional permissions boundary.
- A session duration, from 1 to 12 hours.
A permission set does nothing until you assign it.
Account assignments
An account assignment links three things: a principal (a user or a group), a permission set, and a target AWS account. When you create one, Identity Center provisions an IAM role in that account. The role name starts with AWSReservedSSO_ and includes the permission set name. Identity Center manages this role. Do not edit or delete it yourself.
The same permission set can produce different roles in different accounts. You can also give one person several permission sets in one account. Each one becomes a separate role, and the person picks one at sign-in.
What the CLI sees
The CLI configuration from the spine uses two values that come straight from assignments:
sso_account_id = 111122223333
sso_role_name = ReadOnlyAccesssso_account_id names the account. sso_role_name is the permission set name, not the full AWSReservedSSO_... role name. A profile can only point at an account and permission set that the signed-in user is assigned to. If the pairing does not exist, sign-in succeeds but the credential request fails.
Assign to groups, not individuals
You can assign a permission set to a user directly, but groups scale better. When someone changes teams, you change their group membership once instead of editing many assignments. Groups also make audits simpler, because "who can reach prod?" becomes a question about a few groups.
Changing a permission set later
If you edit a permission set that is already assigned, Identity Center must push the change to every account that uses it. The console shows the affected accounts as needing reprovisioning. Until that finishes, the roles keep the old policy.
Credentials the CLI already holds are not recalled. They keep working with the old permissions until they expire. This is another reason to keep the session duration short for sensitive accounts.
Common mistakes
| Symptom | Likely cause |
|---|---|
| Account or role missing from the `aws configure sso` list | The user has no assignment for it |
| Error that the role does not exist or cannot be used | `sso_role_name` holds the wrong name, or the assignment was removed |
| New permissions have no effect | The permission set was not reprovisioned, or old credentials are still cached |
| Access works in one account but not another | The assignment exists only for one account |
Exercise
A user is assigned the permission set ReadOnlyAccess in the dev account only. Their profile for the prod account uses sso_role_name = ReadOnlyAccess. Sign-in works. What happens when they run a command with the prod profile, and how do you fix it?
Show answer
The CLI cannot get role credentials for prod, because the user has no assignment there. Sign-in only proves who the user is. To fix it, create an account assignment for the user (or one of their groups) with the ReadOnlyAccess permission set in the prod account.