We have a large number of EC2 instances in our infrastructure and we use tags to help us organize and configure those instances. For our aircom infrastructure, our instances use tags containing the string ‘aircom’. For example, the main aircom instances are tagged with just ‘aircom’, while supporting instances are tagged with something like ‘aircom_emulation’. Recently, I was looking for an overview of just our aircom instances in particular, so I headed over to the handy AWS EC2 Dashboard and entered ‘aircom’ into the instance filter. This is where the problem with our tagging system first became apparent. I got a long list of all our instances with aircom anywhere in the tags, which was not helpful. Wishing for a better list, but not wanting to re-tag all of our instances, I looked up tag filters in the AWS docs. Luckily AWS filters support regular expressions. Appending ‘$’ to the search string tells the filter to match the end of the string, so using ‘aircom$’ gave me the results I was looking for.
There are a bunch of advanced filtering techniques listed in the documentation, and I found it helpful to skim through that entire page. One search type I know I’ll be using a lot is inverse search. Prefixing a ‘!’ before any search string will return everything that doesn’t match that string. Let’s say I wanted to ensure that I didn’t make any changes to production machines while browsing around the EC2 Dashboard. I could add a ‘!production’ filter and feel secure that I won’t be messing around with our production servers.
Navigating the EC2 Dashboard is an important part of my job, and little tricks like this invariably make my job easier, and provide peace of mind as I go through my day.