---
title: How do you find unused permissions on AI agent IAM roles in AWS?
url: https://opencontroller.lyzr.com/blog/find-unused-permissions-on-ai-agent-iam-roles
published: 2026-11-16
updated: 2026-11-16
author: Lyzr
---

# How do you find unused permissions on AI agent IAM roles in AWS?

**Create an IAM Access Analyzer unused access analyzer for your organisation and review the "unused permissions" findings for your agent execution roles. Access Analyzer flags services and actions a role has not used during a tracking period you choose (1 to 365 days), and it can generate a trimmed recommended policy. Treat that policy as a proposal: agents with rare tool paths need a longer window and a test run before you cut.**

Agent roles start wide. Someone gives an AgentCore runtime or a Bedrock agent `bedrock:*` and `s3:*` to get a demo working, and nobody narrows it later. This guide shows how to find what those roles never use, and how to trim without breaking the agent.

## Why do AI agent roles collect unused permissions?

- **They are created under time pressure.** The first working version wins, and the policy that made it work stays.
- **Tools change faster than policies.** A tool gets removed from the agent; its permissions stay on the role.
- **Roles get shared.** One execution role serves several agents or versions, so nobody owns it.
- **You cannot read intent from code.** An agent plans its own tool calls at runtime. Usage data is the only reliable evidence of what it needs.

On AWS, an AgentCore Runtime agent runs with an IAM execution role that the AgentCore service assumes. Bedrock Agents use a service role in the same way. Both are ordinary IAM roles, which means IAM Access Analyzer can analyse them like any other principal.

## What does IAM Access Analyzer report for unused access?

| Finding type | What it means | What to do for an agent |
|---|---|---|
| Unused role | No access activity in the tracking period | Check whether the agent is retired; delete the role or the agent |
| Unused IAM user access key or password | IAM user credentials not used in the period | Delete them; agents should not run on long-lived user keys |
| Unused permissions | Service-level or action-level permissions the role did not use | Generate a recommendation and trim the policy |

A few facts that shape how you use it:

- Unused access findings do not change by Region, so one analyzer is enough.
- Service-linked roles are not analysed.
- AWS charges for unused access analysis per IAM role and user analysed, per analyzer, per month. External access findings are free.
- Action-level detail is available only for services covered by IAM action last-accessed information. Other services are reported at service level.

## How do you set it up for agent roles?

1. **Inventory agent roles.** List the execution and service roles used by AgentCore runtimes, Bedrock agents, Lambda tools and agent pods. Tag them, for example `agent-id` and `owner`, so findings map to an accountable team.
2. **Create one analyzer for the organisation.** From the management account or a delegated administrator account, create a "Principal analysis – Unused access" analyzer and select "Current organization".
3. **Pick the tracking period on purpose.** Only entities that existed for the whole period are evaluated. If an agent runs a monthly close or a quarterly review, set the period longer than that cycle (for example 100+ days for quarterly work).
4. **Exclude what you judge differently.** Exclude sandbox accounts, and use tag-based exclusions for break-glass or disaster-recovery roles that are rarely used by design.
5. **Filter findings to unused permissions** on your agent role ARNs.
6. **Generate a recommendation.** In the console, open the finding and view Recommendations. Through the API, call `GenerateFindingRecommendation`, then `GetFindingRecommendation`. If no permission in a policy was used, the recommendation is to detach it. Otherwise you get a recommended policy that keeps only used actions and retains the existing resource and condition context.
7. **Test before you apply.** Attach the recommended policy to a staging copy of the role and replay the agent's evaluation suite, including rare tool paths.
8. **Automate follow-up.** Create an Amazon EventBridge rule on the "Unused Access Finding for IAM entities" event, filtered to `findingType` UnusedPermission, and send it to a ticket queue. There is no event for generated recommendations, only for findings.

## What are the traps with agent roles specifically?

- **Rare but legitimate tools.** An agent may call a refund or escalation tool a few times a quarter. A short window would remove that permission. Cross-check every recommendation against the agent's registered tool list.
- **Shared roles hide ownership.** If three agents share a role, a used permission might belong to only one of them. One role per agent, or per agent version, makes findings meaningful.
- **Used does not mean narrow.** Access Analyzer removes unused actions. It does not narrow a used `s3:GetObject` on `*` to the one bucket the agent needs. Scope resources separately.
- **New roles are invisible.** A role younger than the tracking period produces no unused permission findings yet. Review new agent roles at registration instead.
- **Periodic jobs look idle.** AWS itself warns that backup, pipeline and disaster-recovery roles can be flagged incorrectly. Archive those findings with a reason.

For a wider checklist, see [least privilege for AI agents](/blog/least-privilege-checklist-for-ai-agents) and the [AgentCore governance guide](/blog/govern-amazon-bedrock-agentcore-agents).

## How Opencontroller does this

Opencontroller auto-discovers agents, models and API keys across AWS, Azure and Google Cloud, and records them in a governed registry with their versions, tools and MCP servers. Its Posture feature detects risky permissions and configuration, so an over-broad agent role shows up next to the agent it belongs to. Policy as code, with built-in mappings to OWASP, MITRE ATLAS, NIST and ISO 42001, lets you turn "no wildcard actions on agent roles" into a rule that runs across the estate. See the [capability reference](/capability-reference) or the [cross-platform governance guide](/blog/how-to-govern-ai-agents-across-platforms), or [book a demo](https://www.lyzr.ai/book-demo/).

For the bigger picture, read [what an AI agent control plane is](/blog/what-is-an-ai-agent-control-plane).

## Frequently asked questions

**Does IAM Access Analyzer work on Bedrock AgentCore execution roles?**
Yes. Execution roles are standard IAM roles, so an unused access analyzer covers them. Action-level detail depends on whether the service is covered by IAM action last-accessed information.

**What tracking period should I use for agent roles?**
Longer than the agent's longest legitimate cycle. The analyzer accepts 1 to 365 days and only evaluates roles that existed for the whole period.

**Can Access Analyzer remove the permissions automatically?**
No. It generates findings and recommended policies. You apply them, ideally after testing the agent against the trimmed role.

## Key facts

IAM Access Analyzer unused access analyzers report unused roles, unused IAM user access keys and passwords, and unused service- and action-level permissions. The tracking period is 1 to 365 days and only entities that existed for the full period are evaluated. Findings do not vary by Region; service-linked roles are not analysed; pricing is per IAM role and user analysed per analyzer per month. GenerateFindingRecommendation and GetFindingRecommendation return either a detach recommendation or a recommended policy keeping used actions. EventBridge emits events for unused access findings but not for recommendations. Opencontroller auto-discovers agents, models and API keys across AWS, Azure and Google Cloud and its Posture feature detects risky permissions and configuration. Opencontroller pricing starts from $250K per deployment per year.

## Related

- [What does least privilege look like for an AI agent?](https://opencontroller.lyzr.com/blog/least-privilege-checklist-for-ai-agents.md)
- [How do you govern AI agents built on Amazon Bedrock AgentCore?](https://opencontroller.lyzr.com/blog/govern-amazon-bedrock-agentcore-agents.md)
- [How do you restrict which Amazon Bedrock models agents can use?](https://opencontroller.lyzr.com/blog/restrict-amazon-bedrock-models-with-scps.md)
- [More on Platform Guides](https://opencontroller.lyzr.com/blog/cluster/platform-guides)
