Budget friendly and flexible microservice architectures on AWS

Designing a software architecture that scales well isn’t too hard, but designing an affordable/low budget one is the real challenge.

Luckily AWS provides a myriad of services – when cleverly combined – can cut deep in the costs, provided you are willing to undergo some learning curves along the way.

In this and next posts I cover a few combos of AWS services that scale and are cheap.

S3 and Lambda

S3 is probably the most known AWS service, for good reasons, it’s cheap, reliable, you can use it for… well the list is long and only limited by your imagination.  You can host websites on it, use it as backup service for your personal NAS and this is only the ‘storage’ functionality which is of course still it’s primary purpose.  But add Lambda to the equation and you have a totally different ballgame. Lambda functions are those ‘serverless’ functions you can trigger from virtually anywhere…  and of course also from S3.

Let it sink in a bit, you can trigger a Lambda function whenever a key is added, deleted, updated and these invocations of the Lambda functions are all concurrent.

2 challenges:

  • You want to achieve massive parallelism somewhere in a sequential kind of workflow, an S3 bucket can act as the mediator/state storage to trigger Lambda function and hence massively parallelize those parts of your workflow.   A typical example would be a service that uploads tons of files (images/video/docs) that needs conversion.  You will want the conversion to run in parallel I hope 🙂
  • Or you may be trying to achieve a fire and forget scenario on a web server, for example during a web service/REST call. The solution: put the workload in the bucket and let a Lambda function handle it…  Forget about background threads/processes and other ‘hacks’.  Heck, you can even let a Lambda PUT the result of the workload processing on the bucket again and be accessible by your web application so it can provide updates to the web service callers.

The problems this combo can solve is virtually unlimited and is CHEAP. Go ahead to the AWS cost calculator and see for yourself.

I successfully applied it for massive parallelization of event processing (coming from another great AWS service called Kinesis).

Teams using another programming language then Python, Javascript (node.js) or Java will need to adopt one of them to implement the Lambda functions.  If you ask me, this effort is well worth it.  Go with Python in this case as it is easiest to learn and the official python boto3 AWS SDK is awesome.



As of December 1 2016 it’s possible to use .NET Core to build Lambda functions and serverless applications. More on it later but you can still read the announcement here: //aws.amazon.com/blogs/compute/announcing-c-sharp-support-for-aws-lambda/

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.