Module 1: Containers and Serverless Compute on AWS
AWS AppRunner is a fully-managed AWS compute service that makes it easy for developers to quickly deploy web applications and APIs, at scale and with no prior infrastructure experience required.
In this module, you will:
- Learn about containers and serverless.
- Survey the AWS compute services that support containers and serverless.
- Understand how to determine when AWS App Runner is a good fit for your workloads.
Two popular themes today are containers and serverless. Containers make it easier to manage your underlying infrastructure, whether on premises or in the cloud. Nearly 80% of all containers in the cloud run on AWS today. Serverless manages infrastructure for you, letting your team focus its attention on business priorities. AWS provides multiple services for containers and serverless, and choosing the right one for your use case can be determined after examining some key considerations.
To understand containers, let's first talk about virtual machines so we can contrast them. In the days when physical servers were dominant, a server was a singular environment. It came with a certain amount of memory, storage, and networking hardware, ran a specific operating system, and served one organization. Then virtualization came along, which made it possible to emulate a computer in software. Now your "server" could be a virtual machine (VM), tailored with the operating system and resources your organization and application require. A software layer called a hypervisor creates, runs, and manages VMs and relates them to physical hardware, with high efficiency. The physical server can run multiple VMs for multiple tenants, which lowers overall infrastructure costs. Today, VMs are dominant in the enterprise, and foundational to cloud computing.
Containers provide some of the same benefits as VMs, but are more portable and efficient. Containers are a way to package an app along with its dependencies, libraries, and settings. Multiple containers share a host operating system and run as isolated processes. Whereas VMs virtualize the hardware and are usually measured in gigabytes, containers virtualize the operating system and are usually measured in megabytes. That makes them lightweight, portable and efficient. Containers are particularly well-suited for microservices, with a shared philosophy of lightweight, independent software components.
More so than VMs, containers change the way developers work because they are designed as a unit of software deployment. Developers build containers and deploy them as part of their work. Containers and virtual machines aren't an either-or choice. You can often use them together, giving you the best of both worlds. The many AWS services that support containers are running them on virtual machines.
Containers share an operating system installed on the server and run as resource-isolated processes, ensuring quick, reliable, and consistent deployments, regardless of environment. Whether you deploy locally on your laptop or to production, the experience will remain the same, aside from secrets and environment settings.
Reference: AWS Containers
Types of Containers
Docker is a software platform that allows you to build, test, and deploy applications quickly. Docker defines a container as “a sandboxed process on your machine that is isolated from all other processes on the host machine. That isolation leverages kernel namespaces and control groups, features that have been in Linux for a long time. Docker has worked to make these capabilities approachable and easy to use.”
Benefits of using Docker include shipping code faster, standardizing application operations, seamlessly moving code, and saving money through efficient resource utilization. On average, Docker users ship software 7x more frequently than non-Docker users. You can standardize your operations for deploying, troubleshooting, and rolling back containers. Moving from local machines to production is simple and straightforward. You can run more code on each server with containers, saving you money.
Modern .NET applications (written in .NET Core 3.1 or .NET 5+) can run on Linux, and are compatible with Docker containers.
AWS services that support Docker containers include AWS App Runner, Amazon Elastic Container Service (ECS), and Amazon Elastic Kubernetes Service (EKS), AWS Fargate on ECS or EKS, and AWS Lambda.
Reference: AWS Docker
Docker Linux containers run on Linux hosts. Modern .NET applications (written in .NET Core 3.1 or .NET 5+) can run on Linux containers, but not legacy .NET Framework applications, which require Windows.
AWS services that support Linux containers include AWS App Runner, Amazon Elastic Container Service (ECS), Amazon Elastic Kubernetes Service (EKS), AWS Fargate on ECS or EKS, and AWS Lambda.
Windows containers support Microsoft Windows operating systems. Windows containers can't run on Linux container instances, and the opposite is also the case.
AWS services that support Windows containers include Amazon Elastic Container Service (ECS), Amazon ECS on AWS Fargate, and Amazon Kubernetes Service (EKS). AWS App Runner does not support Windows Containers.
Reference: Amazon EC2 Windows containers
Benefits of Containers
Containers are lightweight software packages. They are significantly smaller than virtual machines because they do not include a guest operating system image. Instead, containers share an operating system with their host. For this reason, containers are usually quicker to start than virtual machines.
Standardized and Portable
Containers provide a consistent and portable software environment. This lets you standardize operations for deployment, issue investigation, and roll back.
Containers move seamlessly. You can move containerized applications from local machines to production environments, and from on-premises environments to cloud. Containers can simplify implementation of CI/CD pipelines due to their consistency and version control features.
The combined effect of lightweight, portable containers that can be moved seamlessly is agility. You can develop faster when you work with containers, because they eliminate time spent on software dependencies, setting up environments, and troubleshooting differences in environments. For example, Docker users on average ship 7x more frequently than non-Docker users.
Benefits of Containers on AWS
AWS offers over 200 services and key features for security, compliance, and governance. AWS runs your containers with strong security isolation and the latest security updates. You can set granular security permissions for each container.
AWS provides a global infrastructure that includes 69 availability zones across 22 regions, allowing you to run containers worldwide. All AWS container services have a Service Level Agreement (SLA).
AWS provides a broad choice of container services, include managed services and serverless services. That includes the Amazon Elastic Container Registry service (ECR), Amazon Elastic Container service (ECS), Amazon Elastic Kubernetes service (EKS), AWS Fargate, Amazon Elastic Compute Cloud (EC2), and AWS App Runner.
AWS also provides the App2Container tool (A2C), which assists in containerizing and migrating existing .NET and Java applications.
AWS container services are deeply integrated with AWS. This allows your container applications to leverage AWS services for autoscaling, networking, security, and monitoring.You get the agility of containers combined with the elasticity and security of AWS.
Reference: AWS Containers Deep Dive
Use Cases for Containers
Microservices are an approach to software development where software is composed of small, independent services that communicate over well-defined APIs. These services are owned by small, self-contained teams. Microservices architectures make applications easier to scale and faster to develop. This enables innovation and accelerates time-to-market for new features. Containers are a popular strategy for microservices. Monolith applications can be broken apart into microservices, independent components in containers.
Batch processing and Extract-Transform-Load (ETL) jobs are a good fit for containers. They can be started quickly, and run on a schedule or in response to events. They can scale dynamically in respond to demand.
Use containers to quickly scale machine learning models for training and inference and run them close to your data sources on any platform.
Containers let you standardize how code is deployed, making it easy to build workflows for applications that run between on-premises and cloud environments.
Application Migration to the Cloud
Containers help with “lift-and-shift” migration to the cloud. You can easily package entire applications into containers, allowing you to move them to the cloud without any code changes. You can take advantage of cloud elasticity to scale containers.
Reference: AWS | Microservices
Serverless technologies let you focus on your application and customers instead of managing infrastructure.
Eliminate Operational Overhead
With serverless technologies, you don’t need to handle infrastructure management, capacity provisioning, and patching. This elimination of operational overhead allows your teams to release quickly, get feedback, and iterate to get to market faster.
Adapt at Scale
Serverless technologies can scale from zero to peak demands automatically. This allows you to promptly adapt to customer needs.
Lower Your Costs
Serverless technologies can scale from zero to peak demands automatically. This lets you adapt to customer needs faster than ever.
Build Better Applications More Easily
Use Cases for Serverless
Web applications, including Web APIs and microservices, are easily created with serverless technologies. Serverless compute services will auto-scale to match your web traffic.
You can process data at nearly any scale with serverless data technologies like Amazon Simple Storage Service (S3), Amazon DynamoDB, Amazon Relational Database Service Proxy (RDS Proxy, and Amazon Aurora Serverless.
Serverless technologies can execute batch tasks on a schedule, or in response to an event.
You can run serverless functions to process, index, or analyze incoming unstructured data and apply machine learning services.
AWS Compute Services for Containers
Container Registry: Amazon ECR
Container Orchestration: Amazon ECS, Amazon EKS, and AWS Fargate
Serverless Functions: AWS Lambda
Server-level Control: Amazon EC2 and EC2 Spot Instances
Simple Web Applications: AWS Lightsail
Fully managed: AWS App Runner
Choosing an AWS Compute Service
In this module, you first learned about containers: how they differ from virtual machines, and Docker Linux containers vs. Windows containers. They are lightweight, standardized and portable, seamless to move, enable you to ship faster, and can save you money. Containers n AWS are secure, reliable, supported by a choice of container services, and deeply integrated with AWS.
Next, you learned about serverless technologies, which allow you to build applications without having to think about servers. Benefits include elimination of operational overhead, automatic scaling, lowered costs, and building applications more easily via built-in integrations to other AWS services. Use cases are web applications, data processing batch processing, and event ingestion.
You learned about AWS compute services for containers and how to choose a compute service. You learned AWS App Runner is a fully-managed service for hosting containers that is also serverless.