Halodoc uses AWS as its cloud service provider to enhance scalability and availability. Our company leverages a range of AWS services in both staging and production environments. However, managing these resources across all of our environments was a challenge until we began to tag AWS resources. By applying tags consistently across all of our resources, we gained greater visibility and control over our infrastructure, enabling us to manage our resources more efficiently and effectively.
As your AWS infrastructure grows, managing resources can become increasingly complex. This is especially true in organizations with multiple teams, where it can be challenging to determine which team is spending the most on infrastructure. By using standard tags on AWS resources, evaluating the cost allocation for individual teams becomes much simpler.
This article explains what AWS resource tagging is, its benefits, limitations, the tagging conventions used and the best practice followed at Halodoc.
What is AWS resource tagging in bulk?
A tag is an optional, user-defined key-value combination that provides additional information about a resource. Bulk tagging is a technique that allows you to apply metadata to multiple resources simultaneously.
Tagging is an optional step that AWS users have encountered while provisioning resources through the console. Since AWS lists this step as optional, most of the times we skip this step during resource configuration. But tags are critical when it comes to cost allocation.
Advantages of AWS resource tagging
Tags are in a format of metadata that helps track the creator, purpose, and environment of a specific resource. Different organizations use tags to filter, manage, and organize their resources using naming conventions at their preferred choice, but the purpose of it is same for all.
AWS Cost Explorer allows customers to use tags to filter AWS resource usage, create billing dashboards and monthly usage reports. By using tags to categorize resources, we can gain a more granular understanding of costs and identify areas where the spending is more.
Tags themselves don't provide any answers. But we can arrive at answers for these questions.
- Who created the resource?
- Why was this resource created?
- Which department is making use of this resource?
- Which environment does this resource belong to?
- Which cost centre does this resource belong to?
- Who is the owner of this resource?
Limitations of AWS resource tagging
Resource tagging can be a powerful tool but there are few limitations to consider.
- AWS allows only 50 user defined tags.
- For some AWS services, resource tagging is not offered (Eg: AWS account root user and IAM users, Elastic IP addresses, etc ).
- AWS tags are case sensitive, meaning that "tag" and "Tag" are treated as separate entities.
- AWS has certain tags that are designated for their own use, and these tags are identified by a prefix of "aws:". It is not possible to delete or modify these system-generated tags.
- Each tag key can only have a single value associated with it.
- Tag key and value can be max of 128 and 256 Unicode characters respectively.
Halodoc's tagging conventions
Halodoc employs standard tags to filter resources by department, cost centre, owner, and environment, allowing us to provide monthly cloud infrastructure costs for individual departments. By analyzing cash flow of different departments, excluding infrastructure costs, we can assess their financial performance and promptly alert the appropriate business group if a department's expenses exceed a pre-determined threshold. This enables us to keep track of expenses and optimize our cloud infrastructure costs.
Here are some of the standard tags used at Halodoc:
- CostCenter : team_a, team_b, team_c
- Department : department_a, department_b, department_c
- Environment : dev, staging, pre-prod, prod
- Owner : owner_name
Halodoc's standard tagging practice
Halodoc, a prominent healthcare platform in Indonesia, leveraged multiple AWS tools to swiftly tag its cloud infrastructure resources. AWS offers various methods for tagging resources, including through the AWS Management Console, AWS CLI, and third-party tagging tools. By employing a combination of techniques, resources were efficiently tagged, allowing for a quick completion of the process. Additionally, AWS SCP rules were enforced to maintain tagging compliance and naming conventions. Over the next few minutes, we'll take a closer look at these strategies and explore how they helped Halodoc optimize its cloud infrastructure cost management.
Terraform is an infrastructure-as-code (IAC) tool that enables cloud resource creation and management. With Terraform, users can streamline their infrastructure using a modular approach and create or tag resources using code to eliminate the possibility of manual errors. This approach allows for tagging multiple resources at once, making it easy to add tags to existing resources or create new ones with pre-defined tagging conventions using just a few lines of code. After making changes to the resources via Terraform, users can plan and apply the changes. More information on using Terraform to create cloud resources can be found here.
The process of creating tags in Terraform is very simple using JSON data interchange format. Most AWS resources support this tagging approach, which involves using key/value pairs separated by equals. Terraform also enables the use of variables in place of values, but not keys.
Halodoc's best tagging practice emphasize the importance of proper resource tagging and recommend the use of terraform for resource creation and tagging. Alternatively instead of terraform other tools such as AWS Tag Editor and aws-tagger can be used to ensure efficient resource tagging.
The benefits of tagging in AWS cannot be overstated. By implementing a consistent tagging strategy across your organization, you can greatly simplify the process of managing and organizing your cloud infrastructure resources. Standard naming conventions and a well-organized tagging system can help you quickly identify resources, reduce manual effort, and optimize your cloud usage and costs.
In addition to the benefits mentioned above, tagging also allows you to create custom views in AWS Cost Explorer that provide additional insights and visibility into your cloud infrastructure. These custom views can help you make informed decisions about resource allocation, cost optimization, and budgeting. This has helped Halodoc maintain higher level visibility on infrastructure spend and business unit wise profitability.
In conclusion, implementing a consistent tagging strategy is a key best practice for managing your cloud infrastructure in AWS. By taking the time to tag your resources using standard naming conventions and a well-organized tagging system, you can greatly simplify resource and cost management.
Scalability, reliability, and maintainability are the three pillars that govern what we build at Halodoc Tech. We are actively looking for engineers at all levels and if solving hard problems with challenging requirements is your forte, please reach out to us with your resumé at firstname.lastname@example.org
Halodoc is the number 1 all around Healthcare application in Indonesia. Our mission is to simplify and bring quality healthcare across Indonesia, from Sabang to Merauke. We connect 20,000+ doctors with patients in need through our Tele-consultation service. We partner with 3500+ pharmacies in 100+ cities to bring medicine to your doorstep. We've also partnered with Indonesia's largest lab provider to provide lab home services, and to top it off we have recently launched a premium appointment service that partners with 500+ hospitals that allow patients to book a doctor appointment inside our application. We are extremely fortunate to be trusted by our investors, such as the Bill & Melinda Gates Foundation, Singtel, UOB Ventures, Allianz, GoJek, Astra, Temasek, and many more. We recently closed our Series C round and In total have raised around USD$180 million for our mission. Our team works tirelessly to make sure that we create the best healthcare solution personalized for all of our patient's needs, and are continuously on a path to simplify healthcare for Indonesia.