How can I estimate computing cost and charge customers afterwards?

0

I'm developing a web-based platform for users to run their own weather forecast. They can configure and run forecasts based on a set of parameters, thereby impacting the final computing cost.

I ran a few tests to get a range estimate based on a set of main parameters and now want to build a fairer logic based on how much it actually cost (+ small margin).

What I'd like to understand is how can I get the cost of a given simulation? For example user 123 utilised 4x c7i instances for 60 minutes, and stored 100 Go data for 7 days: How to actually retrieve these metrics and associate it to user 123 to then charge the customer, and issue them an invoice?

Thank you

Florian
已提问 2 个月前791 查看次数
2 回答
1

To accurately calculate the cost of a simulation and associate it with a specific user, you can use AWS Cost Explorer and AWS Cost and Usage Reports. Here's a high-level overview of the process:

Enable AWS Cost and Usage Reports: https://docs.aws.amazon.com/cur/latest/userguide/cur-create.html

Configure Cost Allocation Tags: Set up cost allocation tags to tag resources with specific user identifiers. You can assign tags to EC2 instances, storage, and other resources used in your simulations. Tags allow you to associate costs with specific users or projects. https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/activating-tags.html https://docs.aws.amazon.com/tag-editor/latest/userguide/tagging.html

Use AWS Cost Explorer: AWS Cost Explorer provides a graphical interface for analyzing your AWS costs. You can use Cost Explorer to filter costs by tags, such as user IDs, and view detailed cost breakdowns by service, instance type, and other dimensions. https://docs.aws.amazon.com/cost-management/latest/userguide/ce-what-is.html

Retrieve Cost Data Programmatically: https://docs.aws.amazon.com/cost-management/latest/userguide/ce-api.html Calculate Simulation Costs: Once you have retrieved the cost data associated with a specific user's simulations, you can calculate the total cost based on the resources used (e.g., EC2 instance hours, storage usage) and the applicable AWS pricing rates.

https://docs.aws.amazon.com/pricing-calculator/latest/userguide/what-is-pricing-calculator.html

Issue Invoices: Finally, use the calculated cost data to generate invoices for your customers. You can include detailed information about the simulations run by each user, the associated costs, and any applicable taxes or fees.

profile picture
专家
已回答 2 个月前
profile picture
专家
已审核 2 个月前
0

For estimating computing costs and then charging customers, follow these steps:

  • Ensure every c7i instance and S3 bucket and bucket objects (or other storage services used) involved in the simulation is tagged with a unique identifier for the user, such as UserID:123. This facilitates tracking usage per user.
  • With the resources tagged, use AWS Cost Explorer to filter costs by the tag UserID:123. Cost Explorer allows you to view and analyze AWS costs over time by service, tag, and other dimensions. You can retrieve the cost of running the c7i instances for 60 minutes and the cost of storing 100 GB of data for 7 days.
  • Apply the pricing information from the AWS Pricing Calculator or the AWS Price List API to the usage metrics obtained from Cost Explorer. Include your markup or margin to cover overheads and profit.
  • Optionally, use AWS Lambda functions triggered on a schedule to automatically calculate costs after a simulation ends. The Lambda function can query Cost Explorer data, calculate the total cost, and then update a database with billing information for user 123.
  • Use the billing information stored from the previous step to generate an invoice.

If this has answered your question or was helpful, accepting the answer would be greatly appreciated. Thank you!

profile picture
专家
已回答 2 个月前
profile picture
专家
已审核 2 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则