AWS EC2 instances have a unique identifier (Instance ID). But as this is a random combination of alphanumeric characters, it's impossible to immediately know what this instance is for.
This is why tags can be created. In the following example a tag with the key "Name" was added to the selected EC2 instance. We gave this instance the name "onl-radoaie25-p".
However using these tags on the aws command line is somewhat unclear. The man page (aws ec2 describe-instances help) mentions --filters that can be applied on tags:
At the bottom of the filters list, the following options show up:
tag:<key> - The key/value combination of a tag assigned to the re-
source. Use the tag key in the filter name and the tag value as
the filter value. For example, to find all resources that have a
tag with the key Owner and the value TeamA , specify tag:Owner for
the filter name and TeamA for the filter value.
tag-key - The key of a tag assigned to the resource. Use this fil-
ter to find all resources that have a tag with a specific key, re-
gardless of the tag value.
The description leaves you rather baffled than with more knowledge how to use the "Name" tag in the filter.
Finally GitHub user garnaat gave the best example how to correctly use a Name tag with the --filter option:
aws ec2 describe-instances --filter Name=tag:Name,Values=ADS-prod-ads
In this example, a tag "Name" with a value of "ADS-prod-ads" is used. In our situation we have the Name value "onl-radoaie25-p", so let's use this:
ck@mintp ~ $ aws ec2 describe-instances --filter Name=tag:Name,Values=onl-radoaie25-p
And finally only this particular EC2 instance is showing up in the response.
No comments yet.
AWS Android Ansible Apache Apple Atlassian BSD Backup Bash Bluecoat CMS Chef Cloud Coding Consul Containers CouchDB DB DNS Database Databases Docker ELK Elasticsearch Filebeat FreeBSD Galera GlusterFS Grafana Graphics HAProxy HTML Hacks Hardware Icinga Icingaweb Icingaweb2 Influx Internet Java KVM Kibana Kodi Kubernetes LXC Linux Logstash Mac Macintosh Mail MariaDB Minio MongoDB Monitoring Multimedia MySQL NFS Nagios Network Nginx OSSEC OTRS Office PGSQL PHP Perl Personal PostgreSQL Postgres PowerDNS Proxmox Proxy Python Rancher Rant Redis Roundcube SSL Samba Seafile Security Shell SmartOS Solaris Surveillance Systemd TLS Tomcat Ubuntu Unix VMWare VMware Varnish Virtualization Windows Wireless Wordpress Wyse ZFS Zoneminder