EC2 Instances - Tagging Best Practices

EC2 Instances

Naming for EC2 instances is a good place to start. Most organizations have already recognized the need to standardize on server hostnames, and have existing practices in effect. For example, an organization might create hostnames based on several components, such as physical location, environment type (development, test, production), role/purpose, application ID, and a unique identifier:

First, note that the various components of a hostname construction process like this are great candidates for individual AWS tags – if they were important in the past, they’ll likely be important in the future. Even if these elements are captured as separate, individual tags, it’s still reasonable to continue to use this style of server naming to maintain consistency, and substituting a different physical location code to represent AWS or an AWS region.

However, if you’re moving away from treating your virtual instances like pets and more like cattle (which is recommended), you’ll want to automate the assignment of server names to avoid having to assign them manually. As an alternative, you could simply use the AWS instance-id (which is globally unique) for your server names.

In either case, if you’re also creating DNS names for servers, it’s a good idea to associate the value used for the Name tag with the Fully Qualified Domain Name (FQDN) for the EC2 instance. So, if your instance name is phlpwcspweb3, the FQDN for the server could be phlpwcspweb3.anycompany.com. If you’d rather use the instance-id for the Name tag, then you should use that in your FQDN (for example, i-06599a38675.anycompany.com).