# IAM policy example: read EC2 inventory, with a least privilege rewrite

Facts read 16 Nov 2026. Page reviewed 16 Nov 2026.

Allows a principal to describe EC2 instances, volumes, security groups and other resources in the account, which is the usual read-only inventory need. The Describe wildcard expands to 195 actions. The rewrite lists seven describe calls that an inventory script needs.

```json
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "DescribeAll",
      "Effect": "Allow",
      "Action": "ec2:Describe*",
      "Resource": "*"
    }
  ]
}
```

## What it allows

- Allows every EC2 action that starts with Describe on all resources.
- Most Describe actions do not support resource-level restrictions, so the resource is the wildcard.

- Allows 195 actions (ec2:Describe*) on every resource.

Checks:
- No flags.

The wildcard returns metadata through 195 actions, including network layout, key pair names and instance attributes.

## Least privilege rewrite

```json
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "DescribeInventory",
      "Effect": "Allow",
      "Action": [
        "ec2:DescribeInstances",
        "ec2:DescribeVolumes",
        "ec2:DescribeSnapshots",
        "ec2:DescribeSecurityGroups",
        "ec2:DescribeSubnets",
        "ec2:DescribeVpcs",
        "ec2:DescribeTags"
      ],
      "Resource": "*"
    }
  ]
}
```

The rewrite lists seven describe calls. Attribute calls such as DescribeInstanceAttribute and key pair lookups are removed. The resource stays a wildcard because these actions lack resource-level support.

- Allows 7 actions (ec2:DescribeInstances, ec2:DescribeVolumes, ec2:DescribeSnapshots, ec2:DescribeSecurityGroups, ec2:DescribeSubnets, ec2:DescribeVpcs, ec2:DescribeTags) on every resource.

Checks:
- No flags.

- [Paste it into the workbench](/)
- [Every EC2 action and its access level](/actions/ec2/)

## Related pages

- [IAM policy example: start and stop tagged EC2 instances](/examples/ec2-start-stop-own-tagged-instances/)
- [IAM policy example: limit EC2 actions to one Region](/examples/ec2-actions-in-one-region/)
- [IAM policy example: launch EC2 instances in one subnet](/examples/ec2-run-instances-in-one-subnet/)
- [All of them](/examples/)

## Sources

- IAM User Guide: EC2 access in a specific Region: https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_examples_ec2_region.html (read 16 Nov 2026)
- IAM User Guide: EC2 instances in a specific subnet: https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_examples_ec2_instances-subnet.html (read 16 Nov 2026)
- AWS Service Authorization Reference, programmatic access (fetched 16 Nov 2026): https://docs.aws.amazon.com/service-authorization/latest/reference/service-reference.html (read 16 Nov 2026)

Last reviewed 16 Nov 2026. Canonical: https://iampolicygenerator.com/examples/ec2-describe-read-only/

This site is not affiliated with Amazon Web Services. AWS service and product names are used only to describe AWS services.
