Category: Docker

With.NET providing first-class support for ARM architecture, running.NET applications on an AWS Graviton processor provides you with more choices to help optimize performance and cost. We have already written about.NET 5 with Graviton benchmarks; in this post, we explore how C#/.NET developers can take advantages of Graviton processors and obtain this performance at scale with Amazon Elastic Container Service (Amazon ECS).

We need to provision many components in this architecture, but this is where the AWS CDK comes in. AWS CDK is an open source-software development framework to define cloud resources using familiar programming languages.

First, we create a virtual private cloud (VPC) and assign a maximum of two Availability Zones: Next, we define the cluster and assign it to the VPC: The Graviton instance type (c6g.4xlarge) is defined in the cluster capacity options: Finally, ApplicationLoadBalancedEC2Service is defined, along with a reference to the application source code: With about 30 lines of AWS CDK code written in C#, we achieve the following: The AWS CDK has several useful helpers, such as the FromAsset function: The ContainerImage.FromAsset function instructs the AWS CDK to build the Docker image from a Dockerfile, automatically create an Amazon ECR repository, and upload the image to the repository.

The AWS CDK Toolkit, the CLI command cdk, is the primary tool for interaction with AWS CDK apps.

Related Articles