Revoke role sessions
See the temporary credentials a role's token exchanges issued, and end every one that is still live.
Each exchange of an OIDC token for a role creates a session with its own temporary access key, live for at most one hour. Revoking ends them before they expire. Replace role-id with the role's id.
Prerequisites
- To see the sessions:
iam:GetRoleon the role. - To revoke them:
iam:RevokeRoleSessionson the role, and in the console alsoiam:GetRoleto open the role's page. Withoutiam:RevokeRoleSessions, Revoke all is not shown. - In the console, also
iam:ListRolesto open Roles (without it the list says you do not have permission to list roles).
See the sessions
- Open Identity, then choose Roles, and open the role.
- Choose Sessions.
The heading says how many credentials are live. The list shows the 10 newest sessions, each with the token's subject, the session name, its age, and live or expired.
dcloud iam roles list-sessions role-id --limit 50GET /iam/api/roles/role-id/sessions?limit=50The API answers with the sessions, newest first (limit 1 to 200, default 50), and active, the
number of live credentials. Each new exchange removes the role's sessions that expired more than a
day ago.
Revoke every live session
- On the role's Sessions tab, choose Revoke all.
The page says how many live credentials were revoked. Revoke all appears only while at least one credential is live.
dcloud iam roles revoke-sessions role-idPOST /iam/api/roles/role-id/sessions/revokeResult
Every live session key of the role is deactivated at once, and temporary S3 credentials those
sessions created are deleted. A request with a revoked key is refused with 401
Invalid or inactive access key. Revoking does not change the trust policy: a job that exchanges a
new token gets a new session. To stop that too, remove or change the trust policy (see
Set a trust policy).