Search code examples
amazon-web-servicesheroku

Usage based billing for hosting a REST API


I currently hosting my website on a combination of Amazon S3 and Cloudfront. These services have a usage-based billing. When there are no users visiting my website, I am paying next to nothing.

Now I wanted to create a simple REST API where users can invite other users. I thought about using node.js or sinatra. But when I want to host that, I need to start at least one EC2 node, which roughly costs 120$ a year. I know both Heroku and AWS have free tier options, but I am explicitly looking for usage-based billing.

Is there a service that allows usage-based billing (eg. number of requests) for a custom REST API?


Solution

  • Well, AWS's API Gateway provides the REST API part, with billing ...

    Low-Cost and Efficient

    With Amazon API Gateway, you pay only for calls made to your APIs and data transfer out. There are no minimum fees or upfront commitments.

    but you'll still have to point it at a back end service. EC2 would incur the costs you mention, but if your 'action' is simple, you may be able to use AWS Lambda. It to is priced based on number of requests and actual compute time.