# AWS Inventory seems to using script, not plugin

**URL:** <https://forum.ansible.com/t/aws-inventory-seems-to-using-script-not-plugin/34014>\
**Category:** AWX Project\
**Tags:** aws, awx\
**Created:** [October 12, 2020, 6:57pm UTC](https://forum.ansible.com/t/aws-inventory-seems-to-using-script-not-plugin/34014 "2020-10-12T18:57:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Guy\_Matz1](https://avatars.discourse-cdn.com/v4/letter/g/b5e925/32.png) [@Guy\_Matz1](https://forum.ansible.com/u/Guy_Matz1)\
**Post date:** [October 12, 2020, 6:57pm UTC](https://forum.ansible.com/t/aws-inventory-seems-to-using-script-not-plugin/34014/1 "2020-10-12T18:57:16Z")

</div>

Hi! I’m trying to get an inventory from AWS and I don’t see anywhere to enter in the information I have in my aws\_ec2.yaml file . . . Is it possible that I’m looking at a version that uses the old script instead? Here’s what I’m seeing

 ![Screen Shot 2020-10-12 at 2.56.05 PM.png](https://us1.discourse-cdn.com/ansible/original/2X/3/3ccf8ca66cca0803910ce377b9be69d990e29b22.png)

Aren’t there supposed to be fields for region, Instance FIlter, Only Group By, etc? Anyone have any idea what I’m doing wrong?

Thanks!  
Guy

```auto
 ______________ 
< AWX 15.0.0 >
 -------------- 
        \ ^__^
         \ (oo)\ _______
            (__) A )\/\
                >>----w |
                >> >>

```

Ansible 2.9.13

---

<div class="post-metadata">

**Author:** ![Bill\_Nottingham1](https://avatars.discourse-cdn.com/v4/letter/b/58f4c7/32.png) [@Bill\_Nottingham1](https://forum.ansible.com/u/Bill_Nottingham1)\
**Post date:** [October 12, 2020, 7:20pm UTC](https://forum.ansible.com/t/aws-inventory-seems-to-using-script-not-plugin/34014/2 "2020-10-12T19:20:40Z")

</div>

Guy Matz (guymatz@gmail.com) said:

> Hi! I'm trying to get an inventory from AWS and I don't see anywhere to  
> enter in the information I have in my aws\_ec2.yaml file . . . Is it  
> possible that I'm looking at a version that uses the old script instead?

The configuration goes in the source variables.

Bill

---

<div class="post-metadata">

**Author:** ![Guy\_Matz1](https://avatars.discourse-cdn.com/v4/letter/g/b5e925/32.png) [@Guy\_Matz1](https://forum.ansible.com/u/Guy_Matz1)\
**Post date:** [October 12, 2020, 8:46pm UTC](https://forum.ansible.com/t/aws-inventory-seems-to-using-script-not-plugin/34014/3 "2020-10-12T20:46:06Z")

</div>

That seemed to work! One little hitch: Does anyone know how I can get ansible\_hostname to use tag:Name? The code below works on CLI but not in AWX:

# see [https://docs.ansible.com/ansible/latest/plugins/inventory/aws\_ec2.html](https://docs.ansible.com/ansible/latest/plugins/inventory/aws_ec2.html)

plugin: aws\_ec2  
strict: True  
#cache: yes  
regions:

- us-east-1
- us-west-1
- us-west-2

# keyed\_groups may be used to create custom groups

keyed\_groups:

- prefix: arch  
key: ‘architecture’
- key: tags[‘Env’]|default(‘NA’)  
prefix: tag\_Env
- key: tags[‘Role’]|default(‘NA’)  
prefix: tag\_Role  
groups:  
aws: true  
atlassian: “‘confluence’ in tags|replace(‘-’, ‘_‘) or ‘jira’ in tags|replace(’-', '_’)”  
confluence: “‘confluence’ in tags|replace(‘-’, ‘_‘)"  
jira: "‘jira’ in tags|replace(’-', '_’)”  
prime: “‘prime’ in tags|replace(‘-’, ‘_‘)"  
squish: "‘testcenter’ in tags|replace(’-', '_’)”  
pomerium: “‘_pom’ in tags|replace(‘-’, '_’)”  
bastion: “‘true’ in tags[‘Bastion’]|default(‘false’)|replace(‘-’, ‘\_’)”

# NOT using hostnames in favor of jinja below (ansible\_ssh\_host)

#hostnames:

# - private-ip-address

# - private-dns-name

# - dns-name

# - network-interface.addresses.association.public-ip

## Set individual variables with compose

compose:  
ansible\_user: tags[‘User’]|default(‘centos’)  
ansible\_ssh\_private\_key\_file: key\_name|default(‘no\_key’)|regex\_replace(‘^(.\*)$’, ‘~/.ssh/\1.pem’)  
ansible\_ssh\_host: public\_ip\_address  
if (  
private\_ip\_address is not defined  
or  
private\_ip\_address.startswith(‘10.’)  
or  
(tags[‘Env’] is defined and tags[‘Env’]==‘test’)  
)  
and (public\_ip\_address is defined)  
else  
private\_ip\_address
