Interview Prep/Ansible/Security and Secrets

What IAM permissions does the `aws_ec2` inventory plugin need?

IntermediateProductionSecurity and Secrets
Answer

Read-only, scoped to describe calls:

{
  "Version": "2012-10-17",
  "Statement": [{
    "Effect": "Allow",
    "Action": ["ec2:DescribeInstances", "ec2:DescribeRegions"],
    "Resource": "*"
  }]
}

Describe actions do not support resource-level restrictions, so Resource: "*" is required. Attach the policy to an instance role on the control node or a CI role assumed through OIDC. Do not reuse an admin's access keys for inventory, and set regions: explicitly so DescribeRegions is not needed.

All Ansible questions Roadmap: Ansible

More on Security and Secrets