maximus
maximus

Reputation: 608

Ansible: apply IAM role to ec2 machine while deployment using ansible

I am planning to use Ansible as solution for deploying ec2 machines. I have attached IAM role for the master machine with appropriate permissions. I can attach security groups, tags, elastic IP etc by defining tags in playbook.
Now, while deploying a new ec2 instance using playbook, can I attach a specific IAM role, for example, which has access to a given S3 bukcet or so.

Upvotes: 0

Views: 1086

Answers (1)

helloV
helloV

Reputation: 52375

Yes. It is possible. The parameter is called instance_profile_name

instance_profile_name - Name of the IAM instance profile to use.

- ec2:
    key_name: mykey
    group: databases
    instance_type: t2.micro
    instance_profile_name: S3Role
    ...

Upvotes: 3

Related Questions