Getting Started with AWS

Deploy a .NET Web Application on Amazon ECS powered by Graviton2

Introduction: Deploy a .NET Application on Amazon ECS powered by Graviton2

Follow step-by-step instructions to learn how to deploy an ASP.NET MVC 5 web application into Amazon ECS powered by Graviton2

Overview

In this tutorial, you will build a container image for an ASP.NET MVC 5 web application and deploy it onto an Amazon ECS cluster powered by Graviton2 instances. 

As part of this process, you will use AWS CLI to create the container image for ARM architecture and push it to Amazon ECR which is a managed private repository service on AWS. Then you will create a highly available Amazon ECS cluster with ARM based instances. Using AWS CloudFormation, you will launch a cluster of worker nodes on Amazon EC2, then launch a containerized Movie application onto your cluster.

Amazon Elastic Container Service (Amazon ECS) is a highly scalable, reliable, secure, fast container management service that makes it easy to run, stop, and manage containers on a cluster. without having to worry about running your own cluster management and container orchestration software. Because ECS has been a foundational pillar for key Amazon services, it can natively integrate with other services such as Amazon Route 53, AWS Secrets Manager, AWS Identity and Access Management (IAM), and Amazon CloudWatch providing you a familiar experience to deploy and scale your containers. ECS is also able to quickly integrate with other AWS services to bring new capabilities to ECS.

AWS announced new Amazon EC2 instance types powered by the AWS Graviton2 processor. The AWS Graviton2 processor is based on the ARM64 architecture leveraging 64-bit ARM Neoverse N1 cores. Since 2019, AWS has launched many new EC2 instances built on Graviton2, including general-purpose (M6g), compute-optimized (C6g), memory-optimized (R6g), and general-purpose burstable (T4g) types. Comparing similar instance families, the Graviton2 instances are about 20% less expensive per hour than Intel x86 instances with up to 40% better performance.

What You Will Learn

This tutorial will walk you through the steps to build a container image for an ASP.NET MVC 5 web application on Graviton2 processor. You will learn to:

 AWS Experience

Intermediate

 Time to Complete

90 minutes

 Cost to Complete

Less than $0.2 (assuming all services are running for 90 minutes)

 Tutorial Prereqs

  • AWS Account with administrator-level access
  • Recommended browser: The latest version of Chrome or Firefox
  • Foundational knowledge on AWS, CloudFormation, Docker and Linux

Application Architecture

The diagram below provides a visual representation of the services used in this tutorial and how they are connected. This project uses Amazon ECS, Amazon EC2 ARM based instance, and Elastic Load Balancing as pictured below:

Architecture

Modules

This tutorial is divided into seven short modules. You must complete each module in order before moving on to the next one.

  1. Set up your environment (15 minutes): Install and configure your test environment with the prerequisites to create the Docker image, and deploy it into Amazon ECS.
  2. Set up AWS Cloud9 Workspace (10 minutes): Open your Cloud9 IDE to initialize your workspace and download the sample application’s source code into your environment.
  3. Create and Publish Docker Image (10 minutes): Create a Dockerfile, with instructions to build an ARM64 container image, and then publish it to Amazon ECR.
  4. Create an Amazon ECS Cluster (15 minutes): Create an Amazon ECS cluster with ARM based instances.
  5. Deploy the Application to Amazon ECS (10 minutes): Create a task definition with Auto Scaling.
  6. Monitoring and Logging (15 minutes): Enable monitoring for ECS environment using Amazon CloudWatch Container Insights.
  7. Clean up (15 minutes): To finish this experiment, you will clean up the resources created in this lab.

Set up Your Environment