We're migrating away from Ansible to Puppet Bolt and the fact that Ansible updates broke the old ec2.py inventory script expedited that process. While that inventory script was quite rudimentary, it was able to automatically add human-readable names to the EC2 instance names. So, for example, you could target a node using "server_example_org" if the Name tag was set to "server.example.org".
Puppet Bolt's aws_inventory seemed to lack that feature, but after taking a good look at its code this was just a case of missing documentation, which I fixed in this PR. Here's an example of inventory.yaml for Bolt that maps the value of the "Name" tag to the name of the Bolt target:
groups:
- name: aws
targets:
- _plugin: aws_inventory
region:
_plugin: env_var
var: AWS_DEFAULT_REGION
target_mapping:
name: tags.Name
uri: public_ip_address
This makes your inventory much nicer and more usable for humans:
$ bolt inventory show
Targets
frontend.example.org
backend.example.org
db.example.org
--- snip ---
Now you can target a node trivially using its name instead of IP:
$ bolt command run "uname" --target=frontend.example.org