Day 7 of AWS essentials

Day 7 of AWS essentials

Container Services

EC2 is great for all sorts of different use cases, from running basic web servers, to running high-performance computing clusters. That being said, though EC2 is incredibly flexible, reliable and scalable, depending on your use case, you might be looking at alternatives for your compute capacity. For example, let's say you are looking for a way to run containers at scale on AWS. Containers can provide you with efficiency and portability. In this context, I am specifically referring to containers like docker containers or containers that use the containered runtime.

Containers are portable because everything an application needs to run, including the application code, dependencies, and configuration are all packaged up together as one executable, which is the container itself. Since everything is self-contained, it means that you can expect your containers to behave the same way across different environments, like development, QA, and production. AWS offers container services like Amazon Elastic Container Service, otherwise known as ECS, or Amazon Elastic Kubernetes Service, otherwise known as EKS. Both of these services are container orchestration tools.

AWS offers a broad spectrum of compute offerings that give you the flexibility to choose the right tool for the job. As mentioned earlier, the three main categories of compute are virtual machines (VMs), containers, and serverless. No one-size-fits-all compute service exists because it depends on your needs.
The key is to understand what each option offers. Then you can build an appropriate cloud architecture for your use case. In this section, you will learn about containers and how to run them. Containers can host a variety of different workloads, including web applications, lift and shift migrations, distributed applications, and streamlining of development, test, and production environments.

Containers

Although containers are often referred to as a new technology, the idea started in the 1970s with certain UNIX kernels (the central core of the operating system) having the ability to separate their processes through isolation. At the time, this was configured manually, making operations complex. A container is a standardized unit that packages your code and its dependencies. This package is designed to run reliably on any platform, because the container creates its own independent environment. With containers, workloads can be carried from one place to another, such as from development to production or from on-premises environments to the cloud.

Difference between VMs and containers

Containers share the same operating system and kernel as the host that they exist on. But virtual machines contain their own operating system. Each virtual machine must maintain a copy of an operating system, which results in a degree of wasted resources. A container is more lightweight. Containers spin up quicker, almost instantly. This difference in startup time becomes instrumental when designing applications that must scale quickly during I/O bursts.

Managing containers with Amazon ECS

Amazon ECS is an end-to-end container orchestration service that helps you spin up new containers. With Amazon ECS, your containers are defined in a task definition that you use to run an individual task or a task within a service. You have the option to run your tasks and services on a serverless infrastructure that's managed by another AWS service called AWS Fargate. Alternatively, for more control over your infrastructure, you can run your tasks and services on a cluster of EC2 instances that you manage.

When the Amazon ECS container instances are up and running, you can perform actions that include, but are not limited to, the following:

  • Launching and stopping containers

  • Getting cluster state

  • Scaling in and out

  • Scheduling the placement of containers across your cluster

  • Assigning permissions

  • Meeting availability requirements

Using Kubernetes with Amazon EKS

Kubernetes is a portable, extensible, open-source platform for managing containerized workloads and services. By bringing software development and operations together by design, Kubernetes created a rapidly growing ecosystem that is very popular and well established in the market. if you already use Kubernetes, you can use Amazon EKS to orchestrate the workloads in the AWS Cloud. Amazon EKS is a managed service that you can use to run Kubernetes on AWS without needing to install, operate, and maintain your own Kubernetes control plane or nodes. Amazon EKS is conceptually similar to Amazon ECS, but with the following differences:

  • In Amazon ECS, the machine that runs the containers is an EC2 instance that has an ECS agent installed and configured to run and manage your containers. This instance is called a container instance. In Amazon EKS, the machine that runs the containers is called a worker node or Kubernetes node.

  • An ECS container is called a task. An EKS container is called a pod.

  • Amazon ECS runs on AWS native technology. Amazon EKS runs on Kubernetes.

Amazon EKS Customers | Managed Kubernetes Service | Amazon Web Services