What is Serverless?

According to AWS, serverless is the native architecture of the cloud, which enables you to shift your operational responsibilities to AWS. This, in turn, increases your agility and innovation. Serverless also allows you to build and run applications and services without thinking about servers and eliminates infrastructure management tasks such as cluster provisioning, patching, operating system maintenance, and capacity provisioning.

Despite the name, there are servers involved in a serverless architecture. These servers run your application, although you do not have to manage it.

What is a Container?

According to Docker, a container is a standard unit of software that packages code and its dependencies to make the application run quickly and reliably from one computing environment to another.

Here’s an example image to illustrate the containers and how they are different from VMs:

Serverless vs Containers

Side note, If you don’t know how Docker was created, here’s another image to illustrate the origin 🙂

Serverless vs Containers

Why it’s Important to Understand Both Serverless and Containers?

If you are a Software Architect/Tech Lead that has been tasked with implementing a solution, you will ultimately decide whether to use Serverless or Containers or to implement a hybrid solution according to system requirements. With that in mind, here is a cheat sheet of things you may want to consider before making the decision.

Serverless vs Containers

Can Serverless and Containers Work Together?

Absolutely! Serverless and Container are not mutually exclusive. In fact, you can have a hybrid solution. Be advised, though, that serverless and container each have their own pros and cons. If you plan it correctly, one’s strengths can complement the other’s weaknesses so your final solution leverages the best of both worlds.

Another tool to evaluate in pursuit of a hybrid solution is AWS Fargate. This is a computing engine for Amazon ECS that allows you to run containers without managing servers or clusters. With AWS Fargate, you don’t have to provision, configure, or scale clusters of virtual machines to run containers. This removes the need to choose server types, or decide when to scale clusters or optimize packing. AWS Fargate also removes the requirement that you interact with servers or clusters. Fargate lets you focus on designing and building your applications instead of managing the infrastructure behind them.

Final Thoughts

If you’re struggling to choose between Serverless or Containers, follow Adrian Cockcroft’s advice: “Build Serverless First. If needed, move to containers”

Long term, it’s likely that these two paradigms will converge. Container technologies will eventually become serverless. Take AWS Fargate, for example, which is one of the best case studies the industry currently has. While you can’t truly go wrong with either technology, you will need to decide which is most applicable to your purposes.

(*) Serverless Framework would make the transition from one provider to another easier but still, some functionality will be lost
(**) If you are having issues with Cold Starts in Azure, check out this blog