AWS Lambda function, Is It right for you?
I have recently worked on AWS Lambda function as well as OpenFaas to develop and deploy serverless function. I have learned some thing that I would like to share it with you guys.
Advantages of AWS lambda function
- It can scale infinitely(as given in documentation)
- Very easy and simple to create lambda function
- Easy integration with other AWS services(eg S3, SQS, SNS, API Gateway etc.)
- Easy logging availability with CloudWatch(which helps greatly)
- Allows you to use polyglot(i.e. multiple programing language uses) when developing lambda function.
- Needless to say, you don’t need any server to manage for it, Its handled by AWS.
Disadvantages of AWS Lambda function
- Payload limitation(10MB maximum)
- Difficult to test your API(Need more resources)
- Does not allows to write to disk(write permission denied), so if you want to do some CSV/PDF manipulation then it has to be in-memory.
- Need to understand SAM or some other deployment tools to make your life easier, Otherwise deployment with AWS lambda is hell(If you have many lambda function).
At first glance, AWS Lambda function looks very cool and indeed it is. But I think It comes down to what you want to achieve with it. If you want to run some asynchronous operation
For example, You can run as many instance of AWS Lambda function you want parallelly, but if you have any dependencies which does not scale very well(for example DB connection(Max 1000 Concurrent connection)), then I don’t think there is any reason to consider scalability as a pro when considering developing microservices.
So I think if you are considering AWS lambda for creating E-commerce platform(Which heavily deals with database), then I would advise you to consider some other alternative(like NodeJS with Kubernetes) which will allow database connection pooling, But if you want to do some Report generation(PDF/CSV) or some Image Manipulation then Lambda function would be better.
Note: If you are using Windows platform for developing Lambda function with Golang, then I would suggest you to use WSL 2(It will help you greatly).
Thanks for reading…