Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS Lambda Container Image Support Vs Fargate

I'm evaluating a solution approach using Docker containers. Now that lambda is also supporting container images this falls in my consideration too.

I'm evaluating based on the following factors

  1. Pricing model of the 2 services
  2. Cold start issue
  3. Ease of Lamda integration with other AWS services
  4. Ease of offline development with docker containers (i think it's not that relevant now)

Any other factor I need to consider between the 2 services?

like image 535
Kapoor Avatar asked Dec 19 '20 13:12

Kapoor


1 Answers

Although both services allow you to run Docker images now, they both have different application types they target.

Typically, you want a Docker container to run for while and not just a few seconds. Furthermore, you often would have the "whole" application in a Docker image.

Lambda offers you short running compute power (seconds to minutes) for small tasks, not a whole application (they are called Lambda functions). So comparing them using your "metrics" might not be the right approach.

First, you need to find out for how long you want your containers to run. If the answer is longer than 900 seconds, you don't need to compare Fargate to AWS Lambda, since Lambda can only run for a maximum of 900 seconds.

Second, you need to check what you actually want to run in the container. As I said before, Lambdas are made for small, short running functions, not "hosting" whole applications (e.g. web servers with Node/Rails/Django apps). If you want to run a whole application on Lambda, you would need to decompose it. Static files on S3 etc., and backend API with AWS API Gateway and AWS Lambda.

That said, if you really want your containers to run less than 900s and want to compare between the two, then here are a few more ideas:

  1. Amount of available resources (memory, vCPU)
  2. Ease of deployment (depends on your development practices)
  3. How well can they be tested?
  4. How familiar is your team with either technology?
  5. Differences in security models? How easy is it to secure?

Some of those depend heavily on your experience, team and your practices, but should be factored in.

like image 65
Jens Avatar answered Oct 04 '22 02:10

Jens