Skip to main content
Ansible EC2 inventory
=====================

This Python module is based on the [original Ansible EC2 inventory
script](https://raw.githubusercontent.com/ansible/ansible/devel/contrib/inventory/ec2.py)
that is linked in the [Ansible
docs](http://docs.ansible.com/ansible/intro_dynamic_inventory.html#example-aws-ec2-external-inventory-script).

The Python module in this repo fixes a few issues by being

- installable via `pip` / PyPi: no need to place code from the Ansible
repo in your inventory.
- extendable for your needs: the class `Ec2Inventory` can be used as a
base class for customizations.

Installation
------------

pip install ansible-ec2-inventory

Usage
-----

### As a script

ansible-ec2-inventory --config ec2.ini

*Note:* if you want to provide a boto profile, prefix the command with
`AWS_PROFILE=myprofile`.

### As a Python module

Example:

``` {.python}
from ansible_ec2_inventory import Ec2Inventory
import json

def main():
# get path of ec2.ini
path = os.path.dirname(os.path.realpath(__file__))

# get inventory
ec2inventory = Ec2Inventory(configfile=path + '/ec2.ini')
data = ec2inventory.get_inventory()

# print json
print(json.dumps(data, sort_keys=True, indent=2))

if __name__ == '__main__':
main()
```

Metadata

Release files for ansible-ec2-inventory 0.1.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ansible-ec2-inventory 0.1.8
File Size Uploaded Provenance
ansible-ec2-inventory-0.1.8.tar.gz 13.9 kB Without provenance Details

Release files / ansible-ec2-inventory-0.1.8.tar.gz

Download URL ansible-ec2-inventory-0.1.8.tar.gz
Size 13.9 kB
Tags Source
SHA-256 checksum
How to use checksums
d1ad5bc371cea5b729635f1e8ef1f17737144bd4140b819e8719d052a6025f7d
BLAKE2b-256 checksum
How to use checksums
88d240aafcb87a7b97a0196dd7aa76fb19db9c303659bd7d0d8051800b737d08
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for ansible-ec2-inventory 0.1.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page