# Incorrect dynamic script source link - AWS EC2

**URL:** <https://forum.ansible.com/t/incorrect-dynamic-script-source-link-aws-ec2/34330>\
**Category:** Ansible Project\
**Tags:** aws\
**Created:** [December 14, 2020, 11:16am UTC](https://forum.ansible.com/t/incorrect-dynamic-script-source-link-aws-ec2/34330 "2020-12-14T11:16:08Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Parth\_Patel](https://avatars.discourse-cdn.com/v4/letter/p/e9a140/32.png) [@Parth\_Patel](https://forum.ansible.com/u/Parth_Patel)\
**Post date:** [December 14, 2020, 11:16am UTC](https://forum.ansible.com/t/incorrect-dynamic-script-source-link-aws-ec2/34330/1 "2020-12-14T11:16:08Z")

</div>

HI Team,

On page [https://ansible-docs.readthedocs.io/zh/stable-2.0/rst/intro\_dynamic\_inventory.html#example-aws-ec2-external-inventory-script](https://ansible-docs.readthedocs.io/zh/stable-2.0/rst/intro_dynamic_inventory.html#example-aws-ec2-external-inventory-script)

Link to ec2 dynamic python inventory script, i see 404 not found error. Can anyone assist me please ?

Thanks,  
Parth

---

<div class="post-metadata">

**Author:** ![Parth\_Patel](https://avatars.discourse-cdn.com/v4/letter/p/e9a140/32.png) [@Parth\_Patel](https://forum.ansible.com/u/Parth_Patel)\
**Post date:** [December 14, 2020, 11:19am UTC](https://forum.ansible.com/t/incorrect-dynamic-script-source-link-aws-ec2/34330/2 "2020-12-14T11:19:18Z")

</div>

Nor the link - [https://github.com/ansible/ansible/tree/devel/contrib/inventory](https://github.com/ansible/ansible/tree/devel/contrib/inventory) works which all users on youtube vedios and web blogs used. May be domain changed ? Neither raw github user content domain worked instead [github.com](http://github.com) in this URL.

---

<div class="post-metadata">

**Author:** ![Akasurde](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/akasurde/32/230_2.png) [@Akasurde](https://forum.ansible.com/u/Akasurde)\
**Post date:** [December 14, 2020, 11:20am UTC](https://forum.ansible.com/t/incorrect-dynamic-script-source-link-aws-ec2/34330/3 "2020-12-14T11:20:01Z")

</div>

Hi Parth,

You are using docs which are not official docs. Also, EC2 external inventory script is replaced by aws\_ec2 inventory plugin.

You can find it here - [https://github.com/ansible-collections/amazon.aws/blob/main/plugins/inventory/aws\_ec2.py](https://github.com/ansible-collections/amazon.aws/blob/main/plugins/inventory/aws_ec2.py)

---

<div class="post-metadata">

**Author:** ![Parth\_Patel](https://avatars.discourse-cdn.com/v4/letter/p/e9a140/32.png) [@Parth\_Patel](https://forum.ansible.com/u/Parth_Patel)\
**Post date:** [December 14, 2020, 11:23am UTC](https://forum.ansible.com/t/incorrect-dynamic-script-source-link-aws-ec2/34330/4 "2020-12-14T11:23:26Z")

</div>

Ahh okay thanks buddy. So below link is official ansible doc site right ?

[https://docs.ansible.com/ansible/latest/user\_guide/intro\_dynamic\_inventory.html](https://docs.ansible.com/ansible/latest/user_guide/intro_dynamic_inventory.html)

Thanks,  
P

---

<div class="post-metadata">

**Author:** ![Akasurde](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/akasurde/32/230_2.png) [@Akasurde](https://forum.ansible.com/u/Akasurde)\
**Post date:** [December 14, 2020, 11:29am UTC](https://forum.ansible.com/t/incorrect-dynamic-script-source-link-aws-ec2/34330/5 "2020-12-14T11:29:22Z")

</div>

Yes, you may want to refer [https://docs.ansible.com/ansible/latest/collections/amazon/aws/aws\_ec2\_inventory.html](https://docs.ansible.com/ansible/latest/collections/amazon/aws/aws_ec2_inventory.html) for aws\_ec2.

---

<div class="post-metadata">

**Author:** ![Akasurde](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/akasurde/32/230_2.png) [@Akasurde](https://forum.ansible.com/u/Akasurde)\
**Post date:** [December 14, 2020, 11:30am UTC](https://forum.ansible.com/t/incorrect-dynamic-script-source-link-aws-ec2/34330/6 "2020-12-14T11:30:09Z")

</div>

Using dynamic inventory plugin - [https://docs.ansible.com/ansible/latest/plugins/inventory.html#using-inventory-plugins](https://docs.ansible.com/ansible/latest/plugins/inventory.html#using-inventory-plugins)

---

<div class="post-metadata">

**Author:** ![Parth\_Patel](https://avatars.discourse-cdn.com/v4/letter/p/e9a140/32.png) [@Parth\_Patel](https://forum.ansible.com/u/Parth_Patel)\
**Post date:** [December 14, 2020, 11:35am UTC](https://forum.ansible.com/t/incorrect-dynamic-script-source-link-aws-ec2/34330/7 "2020-12-14T11:35:04Z")

</div>

Has script been tested and working fine ? I am getting syntax error.

[ansible@ip-172-3xxxx dynamic\_inventory]$ chmod 755 ec2.py  
[ansible@ip-172-3xxxx dynamic\_inventory]$ ./ec2.py  
./ec2.py: line 4: syntax error near unexpected token `(' ./ec2.py: line 4: `from **future** import (absolute\_import, division, print\_function)’

[https://github.com/ansible-collections/amazon.aws/blob/main/plugins/inventory/aws\_ec2.py](https://github.com/ansible-collections/amazon.aws/blob/main/plugins/inventory/aws_ec2.py)

---

<div class="post-metadata">

**Author:** ![Akasurde](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/akasurde/32/230_2.png) [@Akasurde](https://forum.ansible.com/u/Akasurde)\
**Post date:** [December 14, 2020, 1:03pm UTC](https://forum.ansible.com/t/incorrect-dynamic-script-source-link-aws-ec2/34330/8 "2020-12-14T13:03:52Z")

</div>

Hi Parth,

1. Where did you get ec2.py?

2. Why are you doing chmod ?

Please refer [https://docs.ansible.com/ansible/latest/plugins/inventory.html#using-inventory-plugins](https://docs.ansible.com/ansible/latest/plugins/inventory.html#using-inventory-plugins) for using aws\_ec2 dynamic inventory plugin.

---

<div class="post-metadata">

**Author:** ![Parth\_Patel](https://avatars.discourse-cdn.com/v4/letter/p/e9a140/32.png) [@Parth\_Patel](https://forum.ansible.com/u/Parth_Patel)\
**Post date:** [December 14, 2020, 1:07pm UTC](https://forum.ansible.com/t/incorrect-dynamic-script-source-link-aws-ec2/34330/9 "2020-12-14T13:07:15Z")

</div>

Got script from link you gave of github.  
For making script executable doing chmod. Isnt required ??

---

<div class="post-metadata">

**Author:** ![Ashok\_Das](https://avatars.discourse-cdn.com/v4/letter/a/d9b06d/32.png) [@Ashok\_Das](https://forum.ansible.com/u/Ashok_Das)\
**Post date:** [December 14, 2020, 1:11pm UTC](https://forum.ansible.com/t/incorrect-dynamic-script-source-link-aws-ec2/34330/10 "2020-12-14T13:11:33Z")

</div>

You can try this

[https://raw.githubusercontent.com/ansible/ansible/devel/contrib/inventory/ec2.py](https://raw.githubusercontent.com/ansible/ansible/devel/contrib/inventory/ec2.py)  
[https://raw.githubusercontent.com/ansible/ansible/devel/contrib/inventory/ec2.ini](https://raw.githubusercontent.com/ansible/ansible/devel/contrib/inventory/ec2.ini)

---

<div class="post-metadata">

**Author:** ![Parth\_Patel](https://avatars.discourse-cdn.com/v4/letter/p/e9a140/32.png) [@Parth\_Patel](https://forum.ansible.com/u/Parth_Patel)\
**Post date:** [December 14, 2020, 1:32pm UTC](https://forum.ansible.com/t/incorrect-dynamic-script-source-link-aws-ec2/34330/11 "2020-12-14T13:32:56Z")

</div>

Ashok,

I tried as i have mentioned in below mail trail, getting 404 Not found error.

---

<div class="post-metadata">

**Author:** ![Ashok\_Das](https://avatars.discourse-cdn.com/v4/letter/a/d9b06d/32.png) [@Ashok\_Das](https://forum.ansible.com/u/Ashok_Das)\
**Post date:** [December 14, 2020, 1:38pm UTC](https://forum.ansible.com/t/incorrect-dynamic-script-source-link-aws-ec2/34330/12 "2020-12-14T13:38:03Z")

</div>

Hi Partha,

Please try this

[https://raw.githubusercontent.com/ansible/ansible/stable-1.9/plugins/inventory/ec2.py](https://raw.githubusercontent.com/ansible/ansible/stable-1.9/plugins/inventory/ec2.py)

---

<div class="post-metadata">

**Author:** ![Akasurde](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/akasurde/32/230_2.png) [@Akasurde](https://forum.ansible.com/u/Akasurde)\
**Post date:** [December 14, 2020, 2:38pm UTC](https://forum.ansible.com/t/incorrect-dynamic-script-source-link-aws-ec2/34330/13 "2020-12-14T14:38:28Z")

</div>

ec2.py is deprecated and it is based upon a deprecated version of boto.

Please use aws\_ec2 as it is based upon the latest version of a boto and provides additional features.
