AWS Developer Tools Blog

Update on our new AWS .NET Deployment Experience

Last spring we announced the preview of our new AWS deployment tooling for .NET. We have been very busy adding new features since then, with new releases about every two weeks. Let’s take a look at some of the features we have shipped since the initial release.

Getting Started

As a reminder, the new AWS .NET deployment tool integrates with the .NET CLI. We are working on an integration with Visual Studio and hope to have more to share about that soon.

To get started using the .NET CLI, first install the tooling using the following command.

dotnet tool install -g aws.deploy.tools

Then, to deploy a .NET application to AWS just type dotnet aws deploy in the project directory. The tooling will walk you through getting your .NET applications deployed to AWS.

.NET 6 Support

The release date for .NET 6 general availability (GA) is coming soon. Recently, Microsoft released RC2 for .NET 6 with a go-live license. We will be sure that .NET 6 has a good home on AWS and have updated the deployment tool to support .NET 6 today, making it the easiest way to try out .NET 6 on AWS.

If you run the deploy command on a .NET 6 project it will help you containerize your application. With your application containerized you can easily deploy the .NET 6 application to either Amazon Elastic Container Service (ECS) or AWS App Runner.

AWS App Runner

App Runner is AWS’s newest compute service for containerized web applications. App Runner is a fully managed service that makes it easy to deploy your application with very little infrastructure concerns. All you have to do is provide your image and settings and you are good to go. App Runner takes care of everything else for you, and also provides you an HTTPS endpoint for your application by default.

For web applications the deployment tool now provides App Runner as a deployment target. This makes it really simple to try out this new AWS compute service.

Recommendation Updates

The deployment tool provides recommendations that are tailored to the type of .NET application that is being deployed. Since our initial preview launch we have made the recommendations more flexible and powerful, but still kept them simple, to help you get deployed quickly.

ASP.NET Core Applications Deployed to ECS

This recommendation helps you containerize your application and deploy it to Amazon Elastic Container Service (ECS). In the latest version of the tool we have added more options to the recommendation to enable you to customize load balancing and autoscaling. With these settings it is easy to deploy multiple applications to the same load balancer, to help when surfacing your multi-app architecture as single endpoint for your users.

Console Services deployed to ECS

This recommendation can be used to deploy your backend services, for example, backend services processing messages from SQS queues. It is common for the load on these services to fluctuate, or just grow over time. With the latest version of the tool you can easily configure CPU and Memory based autoscaling triggers for your service.

Blazor WebAssembly App

The new AWS .NET deployment tooling is the easiest way to get your Blazor WebAssembly applications deployed to AWS. This recommendation now configures an Amazon CloudFront distribution to be the front endpoint for your applications. CloudFront provides low latency and high speed transfers, which are critical for Blazor WebAssembly applications, and an HTTPS endpoint by default.

Scripting Deployments

When deploying applications the tooling provides an interactive experience to help you determine the right AWS service to host the application code, and helps configure the deployment to match your needs. This is great for learning how to setup a deployment. The end goal for most developers is to create an automated deployment and the AWS .NET deployment tooling can help with this.

To turn off the interactive features of the tooling, supply the --silent switch to the command. This will ensure the tooling never prompts for any questions which could block an automated process.

The settings for deployment can be supplied in a JSON file, which is specified using the --apply switch. Storing the settings in a JSON file also allows those settings to be version controlled.

We are working on providing additional documentation for the settings file, but below is an example. The file uses the IDs of the settings that are specified in the recipe definitions that the deployment tooling uses for generating its recommendations. The recipe definitions are available on GitHub.


{
	"AWSRegion" : "us-east-1",
	"StackName" : "ZipCodeWebApi",
	"RecipeId" : "AspNetAppEcsFargate",
	"OptionSettingsConfig" : {
		"ECSCluster" : {
			"CreateNew" : false,
			"ClusterArn" : "arn:aws:ecs:us-east-1:123412341234:cluster/ZipCodeLookup"
		},
		"ECSServiceName" : "ZipCodeWebApi-service",
		"ApplicationIAMRole" : {
			"CreateNew" : true
		},
		"LoadBalancer" : {
			"CreateNew" : false,
			"ExistingLoadBalancerArn" : "arn:aws:elasticloadbalancing:us-east-1:123412341234:loadbalancer/app/ZipCode/f17b16d55f49d3ab",
			"HealthCheckPath" : "/api/healthcheck",
			"ListenerConditionType" : "Path",
			"ListenerConditionPathPattern" : "/api/*"
		},
		"AutoScaling" : {
			"Enabled" : true,
			"ScalingType" : "Memory"
		}
	}
}

Using the ability to turn off interactive deployment prompts, and pass deployment settings in an external file, it is easy to configure any CI/CD system to deploy to AWS using the new tooling. For example, here is a GitHub action that installs the deployment tool from NuGet and then deploys the application to AWS.


name: Deploy to AWS
on: [push]
jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - name: Configure AWS Credentials
        uses: aws-actions/configure-aws-credentials@v1
        with:
          aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
          aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          aws-region: us-east-1

      - uses: actions/checkout@v2
      - name: Setup .NET 6.0
        uses: actions/setup-dotnet@v1
        with:
          dotnet-version: '6.0.x'
          include-prerelease: true

      - name: Install AWS .NET Deployment Tool
        run: dotnet tool install -g AWS.Deploy.Tools

      - name: Execute Deployment
        working-directory: ./ZipCodeWebApi
        run: dotnet aws deploy --silent --apply ../deployment-settings.json

Closing

The new tooling is being updated frequently with new features, and we’re really keen to hear your feedback on the tool, what you need, and how it can improve further to help meet your needs. Our aim is to make this tool the easiest way to deploy your .NET applications on AWS. Give it a try and let us know what you think on GitHub, where you can follow all the latest developments.

Norm Johanson

Norm Johanson

Norm Johanson has been a software developer for more than 20 years developing all types of applications. Since 2010 he has been working for AWS focusing on the .NET developer experience at AWS. You can find him on Twitter @socketnorm and GitHub @normj.