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.
More on Security and Secrets
How do you set up a secure automation user and SSH access?BeginnerHow do you give the automation user sudo with least privilege?IntermediateWhat are the alternatives to Ansible Vault for secrets, and when do you use them?IntermediateHow do you read AWS Secrets Manager and SSM parameters in a playbook?IntermediateHow do you integrate HashiCorp Vault with Ansible?AdvancedHow do you stop secrets from leaking into logs and output?Beginner