Start your AWS journey with serverless

Ready to learn AWS? Start with serverless! It lets you build and scale apps without managing servers, making it the simplest and most efficient way to dive into cloud development.

Provisioned vs serverless services

AWS pricing is generally a pay-as-you-go model from the perspective of the AWS account holder.

The more AWS resources you use, the higher your costs, but not all services are created equal.

AWS has a class of services called ‘serverless compute’ which charges based on actual usage such as the number of requests and compute time. The more traditional AWS services are called provisioned services.

Provisioned Services

Traditional AWS services like EC2 charge based on provisioned resources, requiring you to pay for instances even if they aren’t fully utilized.

For example, let’s say you have a web application that reads the meta data associated with an image showing an end user how much information they give away about themselves when they upload an image to Instagram.

Developing this API using the on-demand pricing of a t4g.small EC2 instance in US-WEST-1 would cost $0.02 per hour ($0.48 cents a day or $14.40 per month) which doesn’t sound too bad, at first! In practice only one of two things will happen.

Option 1: no one uses your application

  • If no one uses your application, and it sits idling for weeks/months/years which you make changes to the front end / promoting it all the while incurring a $14.00 per month EC2 charge on your AWS bill.

Option 2: small / moderate user activity

  • Your application starts to gain traction, and you quickly realize that a single t4g.small EC2 instance isn’t processing all your user requests and/or your EC2 starts throwing out of memory error messages s you have to either scale up or scale out. If you scale up your bill starts to look something like this:

    • t4g.medium - $28.80 per month
    • t4g.large - $57.60 per month
    • t4g.xlarge - $115.20 per month
    • t4g.2xlarge - $230.40 per month

If you scale out to provide some level of redundancy then you will likely need to learn about containerization, networking, and Kubernetes. This comes with its own range of challenges and can easily result in the over-provisioning of EC2 resources thus incurring higher costs. As a developer, you will spend more and more time & energy into monitoring your AWS infrastructure than developing new features or products.

Serverless Services

Serverless services on the other hand are only charged based on the amount of service invocations and compute power, nothing more and nothing less.

Let’s look at the image processing example from earlier using AWS Lambda functions, and for the sake of fairness we will ignore lambda’s free-tier limits.

Option 1: no one uses your application

  • Since no one is using your application, you are not incurring any lambda related costs.

Option 2: small / moderate user activity

  • AWS Lambda is designed for applications to be deployed at scale, which means that AWS will scale up and down on your behalf and you are only charged for the duration and compute used to process each user request.

For example, if you have roughly 10,000 requests per day or 300,000 requests per month on average. You decide to allocate 512 Mbs of memory per lambda invocation and it takes about 1 second to process each request. THIs would mean is costs roughly $2.56 per month to service the 300,000 requests.

AWS will take care of all scaling requirements, so you don’t need to worry about networking routing rules or scaling up your cluster to meet an increase in demand. AWS takes care of all that headache for you so you can spend more time developing out new features or products rather than managing infrastructure.

  • There are some soft limits imposed on the number of lambda functions that can be concurrently invoked within a specific AWS region, but this can easily be adjusted via a service ticket if required.

AWS provides a wide range of services to many different target audiences so don’t try to eat the AWS elephant all at once. Start with serverless, evaluate your compute needs and make educated decisions before moving into provisioned services.