Pricing Options for Microservice Deployment (AWS & GCP)

It is impossible to try to compare the pricing of these services without any context, as they are very different technologies, with different pricing plans. So, in this post, we are trying to determine the monthly price of each service in a constant context; our assumptions for all the services lay in the same range.

We also believe that a technology that seems to be the cheapest or the best suited in some contexts, shouldn’t have to be like this in other contexts. 

Basic Assumptions:

  • For scalable instances, we assumed the worst situation where each request is handled alone at a time.
  • Whenever we have a free tier we applied it in the calculation.
  • We assumed you have one project for each service.

Virtual Server Options

Two options here: Google Compute Engine, AWS EC2.

Google Compute Engine

Google Compute Engine is the Infrastructure as a Service component of Google Cloud Platform which is built on the global infrastructure that runs Google’s search engine, Gmail, YouTube, and other services. Google Compute Engine enables users to launch virtual machines on demand.

Virtual machine pricing:

You’re supposed to choose a VM instance that meets your demands from the list provided by Google here. Google charges you for the compute resources (the usage of CPU, and the Memory ‘GB’) consumed by your VM instance monthly.

For the purpose of the price calculation, we assume choosing one of two instances from the standard machine type. While choosing the region to be Frankfurt.

VM TypeVirtual CPUsMemory (GB)Price (Monthly)
n1-standard-113.75$31.27
n1-standard-227.5$62.55

Disk pricing:

Disk typePrice (GB/month)Our needWhat we will pay
Standard provisioned space$0.0402GB$0.080

System image pricing:

Image typePrice (GB/month)Our needWhat we will pay
Custom Image$0.1022 GB$0.204

Network pricing:

Transfer typePrice (per GB)Our needWhat we will pay
Egress$0.12 (for the first TB)10 GB$1.2
IngressFree$0.0

Total Price: 

VMDiskImageNetworkTotal Price
n1-standard-1Standard provisioned 2GBCustom 2GB10 GB out$32.754
n1-standard-2Standard provisioned 2GBCustom 2GB10 GB out$64.034

AWS EC2

Amazon Elastic Compute Cloud forms a central part of Amazon.com’s cloud-computing platform, Amazon Web Services, by allowing users to rent virtual computers on which to run their own computer applications.

On-Demand

With On-Demand instances, you only pay for EC2 instances you use.

Computing price:

For the purpose of the price calculation, we assume choosing one of two instances from the general-purpose machines type. While choosing the region to be Al-Bahrain.

InstancevCPU (count)Memory (GB)StorageSystemPrice/month
t3.small22EBS OnlyLinux$18.323
t3.medium24EBS OnlyLinux$36.646

Data transfer price:

All data transfer IN to Amazon EC2 from the internet: Free.

Data transferred (IN/OUT) between Amazon S3, Amazon Glacier, Amazon DynamoDB, Amazon SES, Amazon SQS, Amazon Kinesis, Amazon ECR, Amazon SNS or Amazon SimpleDB and Amazon EC2 instances in the same AWS Region is free.

Data transfer OUT from Amazon EC2 to the internet:

Price (per GB)Our needWhat we will pay
$0.117 (from over 1 GB to 9.999 TB)10 GB$1.17

Disk storage:

For EBS pricing in detail, refer to here.

Disk typePrice (GB/month)Our needWhat we will pay
General-purpose SSD$0.1212 GB $0.242

Total Price: 

VMDiskSystemNetworkTotal Price/month
t3.small2GB General purpose SSDLinux10 GB out$18.565
t3.medium2GB General purpose SSDLinux10 GB out$36.888

Savings Plans

Savings Plans are a flexible pricing model that offers low prices on EC2 usage, in exchange for a commitment to a consistent amount of usage (measured in $/hour) for a 1 or 3-year term.
When you sign up for a Savings Plan, you will be charged the discounted Savings Plans price for your usage up to your commitment. 

Computing price:

For 1 year commitment, in Al-Bahrain region.

InstancevCPU (count)Memory (GB)StorageSystemPrice/month
t3.small22EBS OnlyLinux$14.965
t3.medium24EBS OnlyLinux$30.003

However, you will be charged for the entire year:

For t3.small you will pay $179.58.

For t3.medium you will pay $360.036.

Data transfer price:

All data transfer IN to Amazon EC2 from the internet: Free.

Data transferred (IN/OUT) between Amazon S3, Amazon Glacier, Amazon DynamoDB, Amazon SES, Amazon SQS, Amazon Kinesis, Amazon ECR, Amazon SNS or Amazon SimpleDB and Amazon EC2 instances in the same AWS Region is free.

Data transfer OUT from Amazon EC2 to the internet:

Price (per GB)Our needWhat we will pay
$0.117 (from over 1 GB to 9.999 TB)10 GB$1.17

Disk storage:

For EBS pricing in detail, refer to here.

Disk typePrice (GB/month)Our needWhat we will pay
General-purpose SSD$0.1212 GB $0.242

Total price: 

VMDiskSystemNetworkTotal Price/month
t3.small2GB General purpose SSDLinux10 GB out$15.207
t3.medium2GB General purpose SSDLinux10 GB out$30.245

Amazon Lightsail

  • If you are new to AWS and looking to deploy some servers for your applications then AWS Lightsail may be the best starting point for you.
  • Unlike Amazon EC2, you are given a nice interface where you can select preconfigured plans that may cover most of your use cases.
  • You also don’t have to worry about determining the cost since the cost is fixed monthly.

For the purpose of the price calculation, we chose the following plans:

SystemCPU (Cores)Memory (GB)SSD Disk (GB)Transfer limit (TB)Price/Month
Linux1260 4$10
Linux24804$20

And there is 1 month Free Tier

Lightsail uses burstable performance instances that provide a baseline level of CPU performance with the additional ability to burst above the baseline.

If you need highly configurable environments and instances with consistently high CPU performance for applications such as video encoding or HPC applications, we recommend you use Amazon EC2.

Amazon Lightsail uses a focused set of features like instances, managed databases and load balancers to make it easier to get started. But that doesn’t mean you’re limited to those options –you can integrate your Lightsail project with some of the 90+ other services in AWS through Amazon VPC peering.
Refer to here for more information about the allowed services.

Batch Jobs 

Computerized batch processing is the running of “jobs that can run without end-user interaction, or can be scheduled to run as resources permit.

Google Preemptible VMs

A part of Google compute engine.

Properties:

  • Affordable, short-lived compute instances suitable for batch jobs and fault-tolerant workloads.
  • Preemptible VMs offer the same machine types and options as regular compute instances and last for up to 24 hours.
  • Preemptible VMs are up to 80% cheaper than regular instances.

Limits:

  • Compute Engine might terminate preemptible instances at any time due to system events. The probability that Compute Engine will terminate a preemptible instance for a system event is generally low, but might vary from day to day and from zone to zone depending on current conditions. 
  • Compute Engine always terminates preemptible instances after they run for 24 hours. Certain actions reset this 24-hour counter.
  • Preemptible instances are finite Compute Engine resources, so they might not always be available.

Compute Pricing:

For the purpose of the price calculation, we assume choosing one of two instances from the standard machine type. While choosing the region to be Frankfurt.


Virtual CPUs (count)Memory (GB)Price (Hourly)
n1-standard-113.75$0.0100
n1-standard-227.5$0.0200

Assuming we run the job every hour for 10 minutes every day in the month, the monthly price would be:

For n1-standard-1: $1.2

For n1-standard-2: $2.4

Disk pricing:

Disk typePrice (GB/month)Our needWhat we will pay
Standard provisioned space$0.0402GB$0.080

System image pricing:

Image typePrice (GB/month)Our needWhat we will pay
Custom Image$0.1022 GB$0.204

Network pricing:

Transfer typePrice (per GB)Our needWhat we will pay
Egress$0.12 (for the first TB)10 GB$1.2
IngressFree$0.0

Total Price: 

VMDiskImageNetworkTotal Price
n1-standard-1Standard provisioned 2GBCustom 2GB10 GB out$1.484
n1-standard-2Standard provisioned 2GBCustom 2GB10 GB out$2.684

AWS EC2 Spot Instances

Cloud service providers invest in hardware resources and then release those resources (often on a per-hour basis) to subscribers. One of the problems with this business model, however, is that at any given time, there are likely to be compute resources that are not being utilized. These resources represent hardware capacity that AWS has paid for but are sitting idle, and not making AWS any money at the moment.

Rather than allowing these computing resources to go to waste, AWS offers them at a substantially discounted rate, with the understanding that if someone needs those resources for running a normal EC2 instance, that instance will take priority over spot instances that are using the hardware resources at a discounted rate.

Spot instances are identical to a normal EC2 instance, except for two things:

  • First, spot instances use a different billing model than a regular EC2 instance does.
  • The other difference is that spot instances are subject to interruption.

Computing price:

For the purpose of the price calculation, we assume choosing one of two instances from the general-purpose machines type. While choosing the region to be Al-Bahrain.

InstancevCPU (count)MemoryStorageSystemDiscountPrice/HourFrequency of Interruption
t3.small22EBS OnlyLinux70%$0.01756998< 5%
t3.medium24EBS OnlyLinux70%$0.0351400210% – 15%

Assuming we are running the job every hour for 10 minutes every day in the month, the monthly price would be:

For t3.small: $2.1083976

For t3.medium: $4.2168024

Data transfer price:

All data transfer IN to Amazon EC2 from the internet: Free.

Data transferred (IN/OUT) between Amazon S3, Amazon Glacier, Amazon DynamoDB, Amazon SES, Amazon SQS, Amazon Kinesis, Amazon ECR, Amazon SNS or Amazon SimpleDB and Amazon EC2 instances in the same AWS Region is free.

Data transfer OUT from Amazon EC2 to the internet:

Price (per GB)Our needWhat we will pay
$0.117 (from over 1 GB to 9.999 TB)10 GB$1.17

Disk storage:

For EBS pricing in detail, refer to here.

Disk typePrice (GB/month)Our needWhat we will pay
General-purpose SSD$0.1212 GB $0.242

Total Price: 

VMDiskSystemNetworkTotal Price/month
t3.smallGeneral-purpose SSD 2 GBLinux10 GB out$2.1083976
t3.mediumGeneral-purpose SSD 2 GBLinux10 GB out$4.2168024

AWS Batch Service

AWS Batch plans, schedules, and executes your batch computing workloads across Amazon EC2 and Spot Instances.

There is no additional charge for AWS Batch. You only pay for the AWS resources (e.g. EC2 instances) you create to store and run your batch jobs.

Serverless Functions

Serverless functions are single-purpose, programmatic functions that are hosted on managed infrastructure. These functions, which are invoked through the Internet, are hosted and maintained by cloud computing companies.

Cloud Functions

Google Cloud Functions is a serverless execution environment for building and connecting cloud services. With Cloud Functions, you write simple, single-purpose functions that are attached to events emitted from your cloud infrastructure and services. Your Cloud Function is triggered when an event being watched is fired.

Invocation pricing:

First 2 million are Free

Beyond 2 million $0.40/per million invocations

Assuming we won’t exceed 2 million invocations, we won’t pay for this.

Compute time: pricing

The free tier provides 400,000 GB-seconds, 200,000 GHz-seconds of compute time and 5GB of Internet egress traffic per month.

  • GB-Seconds: 1 GB-second is 1 second of wallclock time with 1GB of memory provisioned.
    1 GB-second costs $0.0000025
  • GHz-Seconds: 1 GHz-second is 1 second of wallclock time with a 1GHz CPU provisioned.
    1 GHz-second $0.0000100

For the purpose of price calculation we choose the following:

MemoryCPUPrice/100ms
1024MB1.4 GHz$0.000001650

 Assuming we run the function for 14,400 seconds a day, considering the free tier we have monthly:

GB-secondsGHz-secondsPrice/month
32,000 => cost: $0.08404,800 => cost: $4.048$4.128

Networking cost:

Free tier: 5GB Free.

Considering the free tier, we have the following:

Transfer typePrice (per GB)Our needWhat we will pay
Egress$0.12 (for the first TB)10 GB$0.6
IngressFree$0.0

Total price:

Total price monthly for Cloud Functions: $4.728

AWS Lambda

It is an event-driven, serverless computing platform provided by Amazon as a part of Amazon Web Services. It is a computing service that runs code in response to events and automatically manages the computing resources required by that code.

Requests price:

Free usage tier includes 1M free requests per month

Beyond 1M requests, you pay $0.25 per 1M requests

Assuming we won’t exceed 1 million requests, we won’t pay for this.

Compute price:

free usage tier includes 400,000 GB-seconds of compute time per month. 

Beyond 400,000 GB-seconds you pay $0.000020667 for every GB-second.

Assuming we run the function for 14,400 seconds a day, considering the free tier we have monthly:

GB-secondsPrice/Month
32,000 => cost: $0.661344$0.661344

Data transfer price:

All data transfer IN to Amazon EC2 from the internet: Free.

Data transferred (IN/OUT) between Amazon S3, Amazon Glacier, Amazon DynamoDB, Amazon SES, Amazon SQS, Amazon Kinesis, Amazon ECR, Amazon SNS or Amazon SimpleDB and Amazon EC2 instances in the same AWS Region is free.

Data transfer OUT from Amazon EC2 to the internet:

Price (per GB)Our needWhat we will pay
$0.117 (from over 1 GB to 9.999 TB)10 GB$1.17

Total Price:

Total price monthly for AWS Lambda: $0.661344

Serverless Containers

The term Serverless Containers represents the idea that customers can now run containers without having to manage the actual servers or compute infrastructure that the containers are running on. 

GCP Run

A GCP’s service for running stateless containers on a fully managed environment.

Requests pricing:

Free tier: 2 million requests free.

Beyond 2 million requests you pay $0.40 /million requests.

Assuming we won’t exceed 1 million requests, we won’t pay for this.

Compute pricing:

For a given container instance, billable time occurs when

  • The container instance is starting
  • At least one request is being processed by the container instance

You are billed only for the CPU and memory allocated while a request is active on a container instance, rounded up to the nearest 100 milliseconds. 

Cloud Run allocates 1 vCPU per container instance, and this cannot be changed. 

Each Cloud Run container instance by default gets 256 MiB of memory. You can change this up to a maximum of 2 GiB.

CPU:

Free tier: First 180,000 vCPU-seconds free

Beyond 180,000 vCPU-seconds you pay $0.00002400 /vCPU-seconds

Memory:

Free trier: First 360,000 GB-seconds free

Beyond 360,000 GB-seconds you pay $0.00000250 / GB-second

Assuming we are consuming 600MB memory for each request, and our request takes 1 second to be handled.

Assuming we run the container on 600 requests every hour a day, each request takes 1s processing time, considering the free tier we have monthly:

GB-secondsGHz-secondsPrice/month
252,000 => costs: $6.0480 => costs: $0$6.048

Total price:

GCP Run total monthly price: $6.048

Conclusion

The following table summarizes your pricing options on AWs and GCP for our assumed context:

  • Low computing power.
  • 1 second processing time per request.
  • 14,400 requests a day.
  • runs once each hour (for the offline batch job).
  • 600 MB memory.
  • 10 GB data transfer out to the internet.
  • 2 GB disk.
  • 2 GB system image.
Service NamePrice/Month (USD)TechnologyProperties
Compute Engine$32.754Virtual servers
– Real-time response- Always run
AWS EC2 on-demand$18.565 (+ $1.17 if having out AWS data transfer)Virtual servers
– Real-time response- Always run
AWS EC2 Savings Plans$15.207 (+ $1.17 if having out AWS data transfer)Virtual servers
– Real-time response- Always run.
– Pay for a commitment.
Amazon Lightsail$10Virtual servers
– Real-time response- Always run- Limitations on data transfering & not all AWS services can be accessed
Google Preemptible VMs$1.484Batch Jobs
– Offline- The instance can be terminated (AWS batch makes it possible to run jobs on a normal EC2 instance that can’t be terminated) – Runs on-demand
AWS EC2 Spot Instances$2.1083976 (+ $1.17 if having out AWS data transfer)Batch Jobs
– Offline- The instance can be terminated (AWS batch makes it possible to run jobs on a normal EC2 instance that can’t be terminated) – Runs on-demand
Cloud Functions$4.728Serverless Functions
– Real-time response- Cold start- Strict limitations on languages, resources, package size, processing time, etc.- Event trigger- Runs on-demand
AWS Lambda$0.661344 (+ $1.17 if having out AWS data transfer)Serverless Functions
– Real-time response- Cold start- Strict limitations on languages, resources, package size, processing time, etc.- Event trigger- Runs on-demand
Cloud Run$6.048Serverless Containers
– Real-time response- Cold start- More freedom than functions- Event trigger- Runs on-demand

Do you know that we use all this and other AI technologies in our app? Look at what you’re reading now applied in action. Try our Almeta News app. You can download it from Google Play or Apple’s App Store.

Leave a Reply

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