# ec2.py with boto profiles

**URL:** <https://forum.ansible.com/t/ec2-py-with-boto-profiles/16100>\
**Category:** Ansible Project\
**Tags:** aws\
**Created:** [September 2, 2014, 4:13pm UTC](https://forum.ansible.com/t/ec2-py-with-boto-profiles/16100 "2014-09-02T16:13:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![KSS](https://avatars.discourse-cdn.com/v4/letter/k/a587f6/32.png) [@KSS](https://forum.ansible.com/u/KSS)\
**Post date:** [September 2, 2014, 4:13pm UTC](https://forum.ansible.com/t/ec2-py-with-boto-profiles/16100/1 "2014-09-02T16:13:11Z")

</div>

Hi,

Are there any plans to update ec2.py so boto profiles can be used where we have multiple aws accounts?

We currently use both awscli and boto using profiles to connection the appropriate credentials. I’ve seen the various ec2 modules now have a ‘profile’ parameter to enable use of boto profiles, but as far as I can tell, ec2.py doesn’t allow for such an option and just relies on boto’s default order of precedence for authentication credentials (falling to the credentials used when no profile parameter is passed).

In the situation where people have multiple aws accounts, how are you using ec2.py for dynamic inventory?

Thanks.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [September 2, 2014, 10:44pm UTC](https://forum.ansible.com/t/ec2-py-with-boto-profiles/16100/2 "2014-09-02T22:44:47Z")

</div>

There’s a pull request for this in the queue, though you could also include your inventories in seperate directories and have different copies of the INI file as a workaround.

(Or use Ansible Tower, which features some very nice graphical inventory sync capabiliies with EC2 – not trying to oversell it, but it’s there, and well done, and can say “only people in team X can deploy to this cloud”, etc, which can be nice)

---

<div class="post-metadata">

**Author:** ![KSS](https://avatars.discourse-cdn.com/v4/letter/k/a587f6/32.png) [@KSS](https://forum.ansible.com/u/KSS)\
**Post date:** [September 3, 2014, 8:16am UTC](https://forum.ansible.com/t/ec2-py-with-boto-profiles/16100/3 "2014-09-03T08:16:16Z")

</div>

Thanks for the reply. I look forward to the version supporting profiles.

As for the workaround, I’m probably just missing something, but I don’t see anything in the ini file that suggests having credentials in there. We need to use different credentials for every AWS account.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [September 3, 2014, 11:41am UTC](https://forum.ansible.com/t/ec2-py-with-boto-profiles/16100/4 "2014-09-03T11:41:39Z")

</div>

Yeah I’m sorry about this one, it uses env vars as is, not settable in the INI file.

Tower solves this by syncing inventory to seperate database groups, so multiple ec2 inventory sources can be mapped to either different inventories or different groups, as you would want.

Merging the boto profile one should provide this feature for you.
