Director - Head of Cloud Engineering at Tenerity India
By Abhishek Jain
In the ever-evolving landscape of cloud computing, cost management stands as a formidable challenge. We embarked on a mission to streamline cost allocation in our multi-tenant cloud environment.
Our approach revolved around creating a systematic method to fairly distribute shared costs among our diverse client base, and the story of this journey is both enlightening and instructive. Our intention was to provide our product teams with insights into the client usage patterns and costs incurred, fostering a cooperative approach to cost optimization.
As avid users of AWS, we recognized the significance of efficient cost allocation mechanisms to maintain transparency and optimize resource usage. Our strategy to implement Cost Allocation was underpinned by the use of AWS Accounts, Projects, and Resource Groups, coupled with meticulous Resource Tagging. These mechanisms formed the bedrock of our endeavor to navigate the complexities of shared cost allocation.
We have a defined tagging process in place which includes automation that checks for tag compliance. However, we must put a guardrail through the service or security control policy to proactively check resources. We haven’t implemented the remediation, but it is in the pipeline. Our cost allocation strategy is largely driven by our (1) product and (2) application tags.
Addressing the choice between chargeback and showback, we opted for the latter – showback. Our intention was to provide our clients with insights into their respective usage patterns and costs incurred, fostering a cooperative approach to cost optimization.
For our shared cost allocation strategy, we employed a variable proportional approach, which hinged on the relative percentage of costs and usage. This methodology effectively distributed expenses, reflecting the diverse utilization patterns of our shared resources. We use requests coming for the application to inform where to allocate costs. A tenant which is responsible for 50% of requests will receive half of the costs, this approach solves most of our cost allocation challenges.
Our story’s pivotal chapter centered on the challenge posed by allocating costs across multiple tenant applications within a complex ecosystem. With distinct websites and shared underlying components, isolating the cost contributions of individual clients became a daunting task.
However, creative thinking flourished from the logs that recorded these exchanges. Each application log contained a ‘tenant ID’ field, a treasure trove of insight that would become the cornerstone of our allocation strategy. Drawing inspiration from these logs, we meticulously analyzed traffic patterns across applications. This analysis allowed us to decipher the percentage share of each tenant in the overall system traffic.
Armed with this vital information, we engineered a custom script to harness the power of AWS APIs. By fetching daily cost metrics based on our resource tags, we compiled an accurate representation of resource expenditure. Our innovative twist was to intertwine the percentage traffic data with the captured cost metrics. The result was a proportionate distribution of costs, reflective of each client’s actual usage. This ingenious union of log data, AWS API insights, and traffic percentage transformed our cloud cost allocation landscape.
As we reflect on our journey, we stand united with a newfound visibility into client-wise costs on our shared systems. Cloud cost allocation underscores the importance of adaptability, resourcefulness, and collaboration in conquering the complexities of cloud economics. This story stands as a testament to the evolving landscape of cloud cost management, where data-driven insights drive equitable cost allocation and foster lasting client relationships.