When to use AWS Lambda and when to use Kubernetes (EKS)?

5/29/2019

We are trying to evaluate the best ways to scale our J2EE web application and use hosting services with AWS. Are there reasons why we would use the Lambda service over Kubernetes (EKS)? Although it seems that Lambda can scale functional units, I'm not clear why anyone would use that as a substitute for Kubernetes, given Kubernetes can replicate containers based on performance metrics.

-- Dave
amazon-eks
amazon-web-services
aws-lambda
jakarta-ee
kubernetes

1 Answer

5/30/2019

They serve different purpose. If you want to have horizontal scalability on a "ec2/pod/container" level and handle the availibility yourself (through k8s of course), go for Kubernetes.

If you have a straight forward function doing a particular thing and you don't want to bother yourself with operating costs of having to manage a cluster or packaging it, then you can let Lambda handle it for you (at the time of writing, you would pay 20 US cents per Million call). It is just another abstraction on top of a system that is probably similar to Kubernetes scaling your function per needs.

The goal of all these technologies provided by the big cloud providers are to remove any overhead between you and the code. Infrastructure is the worst one. Serverless is to Kubernetes what Kubernetes is to containers.

To take your decision, take the following into consideration:

  • Does your budget covers operation and maintenance of infrastructure
  • Do you have the expertise in Kubernetes
  • How much would it cost to re-design your J2EE app into serverless ready code
  • Your timeline (of course...)
  • Based on the AWS resources you will use, how much do you save or not by implementing a k8s cluster (database service?, EBS, EC2s, etc.)
-- gumol
Source: StackOverflow