Skip to Content

Mastering Cost Allocation for Reserved Instances: Challenges, Metrics, and Solutions – Part 2

Santanu De
November 24, 2023

Challenges with Reserved Instances

In the world of cloud computing, managing, and optimizing costs can be a complex undertaking, especially when it comes to reserved instances (RIs). One of the key challenges faced by organizations is the allocation of costs for RIs, particularly when these resources are shared among various stakeholders, such as different departments. In this discussion, we’ll explore the challenges and potential solutions related to cost allocation for reserved instances.

For instance, let’s examine a scenario where multiple departments within an organization are the primary stakeholders for a set of reserved cloud resources. The central challenge lies in accurately determining each department’s utilization of these reserved resources.

Calculating Usage Metrics

To address the challenge of determining the actual usage of reserved instances (RIs), it is essential to track usage over a specific time period. This process involves monitoring various metrics and parameters tailored to your organization’s unique requirements. Here are some key usage metrics to consider:

 1. CPU% Usage:

  • To accurately calculate CPU% usage, closely monitor the CPU utilization of the resources associated with the reserved instances. These resources may include virtual machines (VMs), containers, or other computing assets.
  • For example, if your organization has RIs for a group of VMs utilized by different departments, track the average CPU utilization of each VM over a specified time frame.
  • Calculate the total CPU% usage for each department by averaging the CPU utilization of all VMs tagged for that department. This computation provides a percentage representing the CPU usage allocated to each department.

 2. Number of Transactions for Applications:

  • To determine the number of transactions for applications, focus on monitoring application-specific metrics. These metrics could encompass data such as requests per second, transactions per minute, or other pertinent information.
  • For example, let’s say the Sales department runs a web application. In this scenario, you would monitor metrics such as the number of HTTP requests processed by that application. Meanwhile, the Marketing department might operate a different application with its distinct set of relevant metrics.
  •  Calculate the total number of transactions for each department by aggregating the applicable metrics from the application logs or monitoring data.

 3. Number of Users Logged-In from Different Departments:

  • To assess the number of users logged in from different departments; maintain a vigilant watch over user authentication and session data.
  • If your organization employs a centralized authentication system, keep track of the number of user logins or active sessions for each department.
  • Calculate the total number of users logged in from each department by aggregating the authentication or session data.

These calculations can be carried out using monitoring and analytics tools specific to your cloud provider (e.g., CloudWatch in AWS, Azure Monitor in Azure, Stackdriver in GCP) or third-party monitoring and analytics solutions. Once you’ve gathered usage data for each department, you can proceed with the allocation of RI costs based on their respective utilization percentages. This approach ensures that each department is billed according to its actual resource consumption, promoting precise and equitable cost allocation.

Well-Known Criteria to Calculate Usage of Reserved Instances

When assessing the utilization of reserved instances (RIs), it’s crucial to take into account a range of criteria tailored to your organization’s chosen resources and services. These criteria can differ based on your cloud provider and the reserved resource types. Here are some commonly employed criteria for calculating RI usage:

1. Resource-Specific Metrics – Calculate RI usage based on resource-specific metrics, such as CPU utilization, memory usage, network data transfer rates, disk I/O operations, and storage usage. These metrics are resource-dependent and vary according to the services you use.

2. Instance Hours – Measure usage based on the number of instance hours used by your reserved instances. This method is commonly used for VMs and similar resources. For example, track the hours an EC2 instance was active and compare it to the total hours in the billing period.

3. Data Transfer – For services involving data transfer, calculate usage based on the volume of data transferred, particularly outbound data transfer to the internet. Different cloud providers charge for data transfer, so monitoring this is crucial.

4. Requests or Transactions – Calculate usage based on the number of requests, transactions, or API calls processed by a service. This criterion is pertinent for serverless computing platforms like AWS Lambda or Azure Functions.

5. DB Instance Hours – For reserved database instances, such as Amazon RDS, calculate usage based on the number of hours the database instance is active.

6. Storage Capacity – Assess usage for reserved storage instances, such as Amazon S3, Azure Blob Storage, or Google Cloud Storage, based on the amount of storage capacity used.

7. Redshift Clusters – Calculate usage for Amazon Redshift clusters based on the number of cluster hours and the number of nodes in use.

8. Custom Application Metrics – For custom applications and services, define specific usage metrics tailored to your business needs. This may include metrics like the number of documents processed, widgets manufactured, or user sessions.

9. Authentication and User Sessions – For applications with user authentication, calculate RI usage based on the number of users logged in or the number of active user sessions.

10. Function Execution Time – In serverless computing platforms like AWS Lambda or Azure Functions, measure usage based on the duration of function execution (execution time in milliseconds).

Tailor your usage calculations to the specifics of the services and resources for which you’ve reserved instances. Different services and applications exhibit unique usage patterns and relevant metrics. By choosing the appropriate criteria for your organization, you can accurately allocate costs based on actual usage, optimize your reserved instance investments, and gain greater control over your cloud spending.

For instance, let’s now calculate usage and allocate costs for the following scenario:

Department A uses application AA, Department B uses application BB, Department C uses application CC. The average execution time for a request is 0.3 seconds for AA, 0.6 seconds for BB, 0.9 seconds for CC. The CPU usage is 40% for both AA and BB while CC has a CPU usage of 20%. The number of requests per hour is 10000 for AA, 5000 for BB and 1000 for CC. Calculate usage for cost allocation for dept A, B and C. The total cost for the Reserved Instance (RI) is $12,000 per month.

Solution: To calculate the usage for cost allocation among departments A, B, and C, you can utilize the provided data, including average execution times, CPU usage, and the number of requests per hour for each application. Here’s how you can calculate the usage for each department:
1. Calculate the total usage of reserved instances (RIs) based on the provided metrics for each department:

   – For Department A (AA application):

     – Average execution time: 0.3 seconds

     – CPU usage: 40%

     – Number of requests per hour: 10,000

     Usage for AA = (Average execution time * CPU usage) * Number of requests per hour

     Usage for AA = (0.3 sec * 0.40) * 10,000 requests/hour

     Usage for AA = 1,200 seconds/hour

   – For Department B (BB application):

     – Average execution time: 0.6 seconds

     – CPU usage: 40%

     – Number of requests per hour: 5,000

     Usage for BB = (Average execution time * CPU usage) * Number of requests per hour

     Usage for BB = (0.6 sec * 0.40) * 5,000 requests/hour

     Usage for BB = 1,200 seconds/hour

   – For Department C (CC application):

     – Average execution time: 0.9 seconds

     – CPU usage: 20%

     – Number of requests per hour: 1,000

     Usage for CC = (Average execution time * CPU usage) * Number of requests per hour

     Usage for CC = (0.9 sec * 0.20) * 1,000 requests/hour

     Usage for CC = 180 seconds/hour

2. Calculate the monthly usage for each department based on their hourly usage:

   Usage for AA per month = Usage for AA per hour * Hours in a month

   Usage for AA per month = 1,200 seconds/hour * (30 days * 24 hours/day)

   Usage for AA per month = 864,000 seconds/month

   Usage for BB per month = Usage for BB per hour * Hours in a month

   Usage for BB per month = 1,200 seconds/hour * (30 days * 24 hours/day)

   Usage for BB per month = 864,000 seconds/month

   Usage for CC per month = Usage for CC per hour * Hours in a month

   Usage for CC per month = 180 seconds/hour * (30 days * 24 hours/day)

   Usage for CC per month = 129,600 seconds/month

3. Calculate the cost allocation for each department based on their monthly usage and the total cost of the RI:

   – Total cost for the RI is $12,000 per month.

   Cost allocation for AA = (Usage for AA per month / Total monthly usage) * Total cost

   Cost allocation for AA = (864,000 seconds / (864,000 seconds + 864,000 seconds + 129,600 seconds)) * $12,000

   Cost allocation for AA ≈ $8,919

   Cost allocation for BB = (Usage for BB per month / Total monthly usage) * Total cost

   Cost allocation for BB = (864,000 seconds / (864,000 seconds + 864,000 seconds + 129,600 seconds)) * $12,000

   Cost allocation for BB ≈ $8,919

   Cost allocation for CC = (Usage for CC per month / Total monthly usage) * Total cost

   Cost allocation for CC = (129,600 seconds / (864,000 seconds + 864,000 seconds + 129,600 seconds)) * $12,000

   Cost allocation for CC ≈ $1,162

So, based on the provided metrics and the total cost of the RI, the cost allocation for Department A is approximately $8,919, for Department B is approximately $8,919, and for Department C is approximately $1,162 per month.

Conclusion

In the complex world of cloud computing, managing costs, especially with Reserved Instances (RIs), is challenging. Accurate cost allocation among departments sharing resources is crucial. By tracking and calculating usage metrics tailored to an organization’s needs and utilizing known criteria, organizations can optimize RI investments and achieve precise cost allocation, aligning costs with actual resource consumption.

About the author

Senior Manager | India
Santanu De is a Senior architect having around 20+ years IT experience working on various technologies in Microsoft stack. He has worked on multiple cloud migration and modernization programs and architected many IT Solutions. Santanu has worked with various clients globally for digitally transforming client’s IT landscape using latest cloud technologies like Azure.

    Comments

    Leave a Reply

    Your email address will not be published. Required fields are marked *