Why are Tags so valuable?
Knowing how to use Tags for your resources in AWS it’s crucial for your success in the Cloud. It looks like a simple feature just for the label. It is. However, behind the tags, some practices also can even save your money! It’s worth remembering that the feature of Tagging exists for any cloud provider, so continue reading that it will be helpful.
What is a Tag?
The tags are defined by two values, which we call, Key and Value. Also, You could assign any value for both. Later in this article, you will see some ideas for Tagging your resources in the Cloud.
Also, tags are metadata used to describe any other data. On AWS, almost all resources and products support Tag, and of curse, there is a big reason for that.
Why should you start using tags?
So, before understanding why tags are so valuable, let’s see why we should use them.
The tags’ main goal is to make our life easier by filtering and finding resources. Sometimes, we don’t remember the exact name of an EC2 or Load Balance; for example, it’s easier to know which tags those resources have and filter by them.
For example, if you add a specific tag to your resources to identify which environment (Dev, QA, or Production) this resource belongs, it will be easier to filter them. Also, avoid mistakes like killing a wrong EC2 instance from another environment. Trust me, that happens, even with the best’s 🙂
Keep tracking the Cost.
The second most important idea that makes us tag all resources is to keep tracking the Cost. For example, we can easily create a report and discover which environment costs more. Or, if you are looking to reduce costs, tags are your best friend!
Take advantage of AWS Resource Groups.
You can use resource groups to manage your AWS resources. AWS Resource Groups is the service that allows you to handle and automate activities on enormous numbers of resources at one time. For example, you can use Resource Group to perform a task against a set of resources that belongs to the same Group by Tag.
For example, the tasks could be:
- Executing updates or security patches.
- Install a new release for your application.
- Configure firewall rules, like opening or closing ports.
- Retrieve logs and monitoring data for a group of instances.
Also, using the Tag Editor is an excellent feature because we can select different instances, even for other regions, together!
Good Example of Tags
Let’s see some examples of tag ideas to apply to your resources in the Cloud. Give us a picture, then; why are Tags so valuable?
Environment: Define which environment this resource belongs to. Maybe Dev, QA, Demo, or Production.
Customer: It depends on your scenario. If you deploy servers to specific customers, it’s a great idea to map them. Then, later, you can check the costs to see if this customer is worth keeping or not.
Owner: We can use this Tag to locate the Owner of this server. For example, maybe you want to track who asks for this server so that later, you can go back to this person and ask some questions. Sometimes, I already present a situation where, when I ask the Owner, they told me that server wasn’t needed anymore, saving us some dollars.
Project: If you work by project or milestones, it’s worth tagging your resources, for example, for new projects that are still in Prove of Concept (POC). If you are a project manager, it may be helpful to see a Report Cost later and identify which project you need to review the costs and improve your estimation for new projects.
Terraform: Regardless of which tools you use to automate the provisioning of your resources in the Cloud. In this Tag, for example, if we use: Terraform=True, it means that an automated process created this resource. So we can distinguish the resources that we created manually.
Contact: This Tag is vital. Who do we need to call if some bad happens? You can specify the telephone number or email; for someone from DevOps or Operations, it could also be the Owner or not; it’s up to you or your scenario.
URL: It’s very often that you ask yourself, what is the URL that we access this server? For example, if the resource is a web server, it’s pretty helpful to have that kind of information so that we can quickly discover the URL we can call in the web browser and test if the server is running fine. Also, if you are exporting some reports, it’s a valuable column.
Purpose: Here, you can give a high-level explanation what is the goal of this resource. That could help people who don’t know why we need that server.
How to create Tags on Scale
Create a small group of tags for a few servers; it’s straightforward and fast. However, sometimes it’s the scenario most of the time. When we are talking about big companies, with hundreds or even thousands of servers spread, sometimes in different regions or accounts, it’s not an easy task.
Because of that high number of resources relying on automation, it’s crucial. All cloud providers provide at least one API that we call and create tags programmatically.
Also, in the Infrastructure as Code Tools community, you can find solutions already used for big companies that help us automate, provision the resources in the Cloud, and assign the tags we need without any headache. For example, you can use Terraform to create tags using a few lines of code.
Conclusion
To summarize what we have learned:
- Tracking resources. Easier to filter if you don’t remember the resource name.
- Logically grouping different resources also help to filter a set of resources, for example, the same project or environment.
- Analyze the Cost for a specific tag.
- Create a process or pipeline that you can incorporate and automate using tools like Terraform to create tags for you.