Deploying your Node REST API to a dedicated server can be costlier at times, considering you have to pay a fixed cost whether or not the server is used to its full potential. Then configuring, scaling, getting https certificates and managing these servers will also be a tedious task.
With serverless you don't have to manage any infrastructure, the provider will handle it. So let's now compare some of the serverless product offerings,
1. AWS API Gateway + AWS Lambda
The API gateway acts as a front door which handles all the tasks involved in accepting and processing of concurrent API calls, authorization and access control, data validations, monitoring, and API version management.Then it passes the data to AWS Lambda where you can code your business logic.
But your development time may increase by choosing the method as you have to use two different services and you also have to use another service from AWS called as SAM(Serverless Application Management) to ease your deployment and to test your app locally.
Pricing
API Gateway
Lambda
2. Google Cloud Funtions
Cloud functions are event-driven serverless compute platforms with which you can create a function. These functions can be invoked via a URL.
Google Cloud functions internally uses express, so we can use this to create REST APIs. But cloud functions often have cold start issues and minimal compute time. So it is better to create multiple functions to split your resources if you have a big API.
Google Cloud Functions Pricing
3. Google Cloud Run
Google cloud run is a beta product which runs stateless containerized applications and there are no language limitations. To deploy a node REST API you just need a include a docker file in the root directory of your app and build the container. To build container images you can run docker on your device or you can choose Gcloud CLI.
This is one the best methods if you wish to go serverless as you can even deploy your existing APIs developed with express, hapi , etc.,
Google Cloud Functions Pricing
Resources
https://aws.amazon.com/api-gateway/pricing/
https://aws.amazon.com/lambda/pricing/
https://cloud.google.com/functions/pricing
https://cloud.google.com/run/pricing
Top comments (0)