AWS Developer Tools Blog
ASP.NET Core Support for Elastic Beanstalk
Today, we release support for deploying ASP.NET Core applications to AWS by using AWS Elastic Beanstalk (Elastic Beanstalk) and the AWS Toolkit for Visual Studio. This Elastic Beanstalk release expands the support the service already offers for deploying applications, including traditional ASP.NET applications, in a variety of languages to AWS.
Let’s walk through the deployment experience. The AWS Toolkit for Visual Studio is the easiest way to get started deploying ASP.NET Core applications to Elastic Beanstalk. If you have used the toolkit before to deploy traditional ASP.NET applications, you’ll find the experience for ASP.NET Core to be very similar.
If you’re new to the toolkit, after you install it, the first thing you need to do is register your AWS credentials with it.
In Visual Studio, from the Views menu, choose AWS Explorer.
Click the Add button to add your AWS credentials.
To deploy an ASP.NET Core web application, right-click the project in the Solution Explorer, and choose Publish to AWS.
On the Publish to AWS Elastic Beanstalk page, you’ll choose to create an Elastic Beanstalk application. This is a logical representation of your application that will contain a collection of application versions and environments. The environments contain the actual AWS resources that will run an application version. Every time you deploy an application that creates an application version and points the environment to that version.
Next, set names for the application and its first environment. Each environment will have a unique CNAME associated with it that you can use to access your application when the deployment is complete.
On the AWS Options page, you configure the type of AWS resources to use for your application. For this example, we can leave the default values except for the Key pair section. Key pairs allow you to retrieve the Windows Administrator password so you can log into the machine. If you haven’t already created a key pair, you can select Create new key pair.
On the Permissions page, you assign AWS credentials to the Amazon EC2 instances running your application. This is important if your application is using the AWS SDK for .NET to access other AWS services. If you’re not using any other services from your application, you can leave this page at its default.
The Application Options page is the one that differs from deploying traditional ASP.NET Core applications. Here, you can specify the build configuration and framework used to package the application and also what IIS resource path to configure for the application.
Once that’s finished, click Next to review the settings. Then, click Deploy to begin the deployment process. After the application is packaged and uploaded to AWS, you can check the status of the Elastic Beanstalk environment by opening the environment status view from AWS Explorer.
Events are displayed in Status as the environment comes online. When everything is complete, the environment status changes to Environment is healthy. You can click the URL to view the site. Also from this page, you can pull the logs from the environment or remote desktop into the EC2 instances that are part of your Elastic Beanstalk environment.
The first deployment will take a little more time as it creates new AWS resources. As you iterate over your application, you can quickly redeploy by going back through the wizard or selecting Republish when you right-click the project.
Republish will package your application using the settings from the last time through the deployment wizard, and then upload the application bundle to the existing Elastic Beanstalk environment.
We hope you’re excited to try out our expanded ASP.NET Core support in AWS. In our next post, we’ll dive deeper into how the deployment works and how you can customize it.