More Info:

Roles which have access to services but have not used in past several days should be looked into and cleaned up.

Risk Level

Medium

Address

Security

Compliance Standards

CISAWS

Triage and Remediation

How to Prevent

To prevent Role Service Inactivity in IAM using the AWS Management Console, follow these steps:

  1. Enable Access Advisor:

    • Navigate to the IAM dashboard in the AWS Management Console.
    • Select the “Roles” tab.
    • Choose the specific role you want to monitor.
    • Go to the “Access Advisor” tab to review the services that the role has accessed and the last accessed time.
    • Regularly review this information to identify and take action on inactive roles.
  2. Set Up CloudWatch Alarms:

    • Go to the CloudWatch dashboard.
    • Create a new alarm based on IAM metrics.
    • Set the alarm to trigger if a role has not been used for a specified period.
    • Configure notifications to alert administrators when the alarm is triggered.
  3. Enable AWS Config Rules:

    • Navigate to the AWS Config dashboard.
    • Ensure that AWS Config is enabled in your account.
    • Add a managed rule such as iam-role-last-used to monitor the last time an IAM role was used.
    • Set up notifications for compliance changes to be alerted when a role becomes inactive.
  4. Implement IAM Role Policies:

    • Go to the IAM dashboard and select the “Roles” tab.
    • Choose the role you want to configure.
    • Attach a policy that includes conditions to limit the role’s permissions based on time or usage.
    • Use the aws:RequestTag or aws:PrincipalTag conditions to enforce policies that disable or restrict roles after a period of inactivity.

By following these steps, you can proactively monitor and manage IAM role activity to prevent role service inactivity in AWS.

Additional Reading: