.NET Workloads on AWS App Runner

MODULE 1

Module 1: Containers and Serverless Compute on AWS

 LEARNING MODULE

Overview

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.

Learning Objectives

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.

 Time to Complete

30 minutes

Containers

Wouldn't it be nice to package up your application, along with its configuration, runtime, and dependencies, all in one tidy bundle? That's what containers are: containers provide a standard way to package your application's code, configurations, and dependencies into a single object. They share an operating system installed on the server and run as resource-isolated processes, ensuring quick, reliable, and consistent deployments, regardless of environment. 

Containers vs. Virtual Machines

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 Platform

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

Linux Containers

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

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 offer many tangible benefits:

Lightweight

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.

Move Seamlessly

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.

Ship Faster

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.

Save Money

Containers allow you to run more code on each server instance. This improves utilization and saves you money.

References: AWS | What is Docker?, AWS | Containers

Benefits of Containers on AWS

AWS is a popular cloud destination for containers. Nearly 80% of all containers in the cloud run on AWS today. In addition to the inherent benefits of containers, you also gain these benefits when you host containers on AWS. 

Secure

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.

Reliable

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).

Choice

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 Integration

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

Here are some common use cases for containers.

Microservices

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

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.

Machine Learning

Use containers to quickly scale machine learning models for training and inference and run them close to your data sources on any platform.

Hybrid Applications

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

Serverless technologies allow you to build and run applications without having to think about servers. AWS offers managed services for hosting code, managing data, and integrating applications that don’t require you to manage servers. They feature automatic scaling, built-in high availability, and a pay-for-use billing model. 

Benefits of Serverless

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

Serverless technologies have built in integrations to other AWS services. You can focus on building your application instead of configuring it.

Reference: AWS | Serverless

Use Cases for Serverless

Serverless technologies are well-suited for these common use cases:

Web Applications

Web applications, including Web APIs and microservices, are easily created with serverless technologies. Serverless compute services will auto-scale to match your web traffic.

Data Processing

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.

Batch Processing

Serverless technologies can execute batch tasks on a schedule, or in response to an event.

Event Ingestion

You can run serverless functions to process, index, or analyze incoming unstructured data and apply machine learning services.

AWS Compute Services for Containers

Now that you understand containers and serverless, let’s consider AWS compute services that support containers, some of which also support serverless. All of these services support Docker Linux containers, and some also support Windows containers. You can see a full list of AWS services and tools for containers on the AWS Containers page. You don’t need to know every last detail about these services, but you should understand what differentiates them from each other.

Container Registry: Amazon ECR

Amazon Elastic Container Registry (ECR) lets you store, share and deploy container software, publicly or privately. You’ll typically push your containers to ECR, where they are in close proximity to AWS container compute services like AWS App Runner, Amazon ECS, or Amazon EKS.

Container Orchestration: Amazon ECS, Amazon EKS, and AWS Fargate

These services host containers and also orchestrate them, meaning they automate provisioning, deployment, networking, scaling, availability, and lifecycle management of containers.

Amazon Elastic Container Service (ECS) is a fully-managed container orchestration service that makes it easy to deploy, manage, and scale containerized applications, including microservices. You can run highly secure, reliable, scalable containers on ECS.

Amazon Elastic Kubernetes Service (EKS) is a managed container service for running and scaling Kubernetes applications, in the cloud or on-premises. Kubernetes is an open-source system for automating deployment, scaling, and management of containerized applications. EKS is the most trusted way to start, run, and scale Kubernetes.

AWS Fargate is serverless compute for containers. Both Amazon ECS and Amazon EKS are available in serverless form and a different pricing model when you combine them with AWS Fargate.

In addition to managing containers in the cloud, both Amazon ECS and Amazon EKS can also manage container applications on-premise, via the Amazon ECS Anywhere or Amazon EKS Anywhere services.

Serverless Functions: AWS Lambda

AWS Lambda is a serverless, event-driven service for executing functions. It supports containers.

Server-level Control: Amazon EC2 and EC2 Spot Instances

These options provide the most control over infrastructure details, but are also the least-managed way to run containers on AWS.

Amazon Elastic Compute Cloud (Amazon EC2) is a service that provides secure, resizable compute capacity in the cloud. You can run containers with server-level control on EC2 To do so, you’ll allocate EC2 instances and install Docker on them.

If your applications are fault-tolerant, you can run on Amazon EC2 Spot Instances, which are available at up to a 90% discount. Spot instances let you take advantage of unused EC2 capacity in the AWS cloud. To use spot instances, your application needs to be interruptible. You might consider spot instances for data analysis, batch jobs, background processing, or optional tasks.

Simple Web Applications: AWS Lightsail

AWS Lightsail is suitable for simple containerized applications you want to run for a fixed, monthly price. It’s a good choice for students, small businesses, and startups who have a small website and database to get up and running in the cloud. 

Fully managed: AWS App Runner

Finally, we’ve arrived at the topic of this course, AWS App Runner. App Runner is a fully-managed service that makes it easy for developers to quickly deploy containerized web applications and APIs, at scale and with no prior infrastructure experience required. App Runner is also serverless, giving you the advantages of containers and serverless simultaneously. App Runner can run modern .NET workloads on Linux containers.

Choosing an AWS Compute Service

Now that we’ve taken a tour of AWS compute services for containers, let’s go over some key questions that will help you decide whether AWS App Runner or another service is right for your application. Table 1 relates the considerations to AWS services.

Table 1: AWS Container Compute Services Decision Table

Are you new to containers or experienced with containers?

If you’re a container novice, consider AWS App Runner. It’s the most highly service option, and doesn’t require prior infrastructure experience.

Do you require Windows containers?

If you wish to run legacy .NET Framework applications in a container, you’ll be limited to Windows containers. The AWS services that support Windows containers are Amazon ECS, Amazon ECS using AWS Fargate, and Amazon EKS. If you’re running modern .NET, you can use Linux containers and any of the AWS compute services that support containers.

Is container orchestration a current or future need?

There’s a big difference between a single-container application and a combination of containers that must be orchestrated. If you have a complex arrangement of containers and need lifetime management, consider Amazon ECS or Amazon EKS. 

Is serverless right for you?

If your application fits the serverless use cases and you are comfortable with letting AWS manage infrastructure and the serverless payment model, consider these options AWS Lambda, AWS App Runner, or AWS Fargate.

  1. If your application consists of event-driven functions, you can use AWS Lambda.
  2. If you require orchestration, you should use AWS Fargate with Amazon ECS or with Amazon EKS.
  3. If you favor a fully-managed service, choose AWS App Runner.

Key Take-Aways

You should now have a basic understanding of containers and serverless and their respective benefits. You learned about the different AWS compute services and what differentiates them. You also learned which questions to ask to determine the right AWS compute service for a workload.

Conclusion

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.

Was this page helpful?

Fundamentals