Using Console
iam-role-last-used
to monitor the last time an IAM role was used.aws:RequestTag
or aws:PrincipalTag
conditions to enforce policies that disable or restrict roles after a period of inactivity.Using CLI
create-role
command to create a role with a specific policy.
attach-role-policy
command to attach a managed policy or put-role-policy
to attach an inline policy.
Using Python