Limit switch role by Time
Limit switch role by Time
- Access the IAM console page at the link https://console.aws.amazon.com/iam/home#/home with Admin user rights
- In the left navigation pane, select Roles, then select the newly created IAM Role lab44-RoleFullAccess
- In the Trust relationships tab, click Edit trust relationship, add Condition as shown below, then click Update Trust Policy
"DateGreaterThan": {
"aws:CurrentTime": "2026-07-16T00:00:00Z"
},
"DateLessThan": {
"aws:CurrentTime": "2026-07-16T07:00:00Z"
}

- Return to the login session of the user No-permission-user, perform the switch role again, you will receive the error message as shown below because the time when you perform the Switch has been outside the allowed time range.
