Deploying dotnet application made easy with AWS Toolkit

Vaibhav Srivastava
6 min readAug 20, 2021

The AWS Toolkit for Visual Studio conveniently includes the AWS SDK for .NET, so you can get started building .NET applications on AWS infrastructure services in Visual Studio, including Amazon S3, Amazon EC2, AWS Elastic Beanstalk, and Amazon DynamoDB.

The AWS Toolkit for Visual Studio is a plugin for the Visual Studio IDE that makes it easier for you to develop, debug, and deploy .NET applications that use Amazon Web Services. The Toolkit for Visual Studio is supported for Visual Studio versions 2017 and later. For details about how to download and install the kit, see Install the Toolkit for Visual Studio.

Install the Toolkit for Visual Studio

The Toolkit for Visual Studio for Visual Studio 2017 and Visual Studio 2019 is distributed in the Visual Studio Marketplace. You can also install and update the toolkit within Visual Studio by navigating:

  • (Visual Studio 2019) ExtensionsManage Extensions
  • (Visual Studio 2017) ToolsExtensions and Updates

In the upper-right search box, search for AWS and choose Download for the "AWS Toolkit for Visual Studio 2017 and 2019". Choose Close.

After the toolkit has been installed, open it by choosing AWS Explorer from the View menu.

Using AWS Explorer to add a profile

To add a profile to the SDK Credential Store or the shared AWS credentials file:

  1. To open AWS Explorer in Visual Studio, choose View, AWS Explorer.

Choose the New Account Profile icon to the right of the Credentials: list. The New Account Profile dialog box opens.

To create a credential profile, enter the following data into the dialog box and then choose OK

Create a sample web application starter project

  1. In Visual Studio, from the File menu, choose New, and then choose Project.
  2. In the navigation pane of the New Project dialog box, expand Installed, expand Templates, expand Visual C#, and then choose Web.

In the list of web project templates, choose any template containing the words Web and Application in its description. For this example, choose ASP.NET Web Forms Application.

In the Name box, type Your-project-names.

In the Location box, type the path to a solution folder on your development machine or choose Browse, and then browse to and choose a solution folder, and choose Select Folder.

On the next step, i am choosing it as Single Page Web Application

Follow to the next step validate the entered information and click on “Create

Once the project is created, Visual Studio will then display Solution Explorer where the new solution and project appear.

Deploying sample web application

In Solution Explorer, open the context (right-click) menu for the Your-project-names project folder for the project you created in the previous section, or open the context menu for the project folder for your own application, and choose Publish to AWS Elastic Beanstalk

The Publish to Elastic Beanstalk wizard appears.

In Profile, from the Account profile to use for deployment drop-down list, choose the AWS account profile you want to use for the deployment. From the Region drop-down list, choose the region to which you want Elastic Beanstalk to deploy the application. In Deployment Target, you can choose either Create a new application environment to perform an initial deployment of an application

On the Application Environment page, in the Application area, the Name drop-down list proposes a default name for the application. In the Environment area, in the Name drop-down list, type a name for your Elastic Beanstalk environment. URL area, the box proposes a default subdomain of .elasticbeanstalk.com that will be the URL for your web application. You can change the default subdomain by typing a new subdomain name.

Choose Check availability to make sure the URL for your web application is not already in use.

If the URL for your web application is okay to use, choose Next

On the AWS Options page, in Amazon EC2 Launch Configuration, from the Container type drop-down list, choose an Amazon Machine Image (AMI) type that will be used for your application.

In the Instance type drop-down list, specify an Amazon EC2 instance type to use. I recommend using t3a.micro or t4g.micro to start with, this will minimize the cost associated with running instance. As the application ungoes changes and based on the need you can upgrade to t3a.medium or higher.

In the Key pair drop-down list, choose an Amazon EC2 instance key pair to use to sign in to the instances that will be used for your application.

Applications using the AWS SDK for .NET will automatically use the credentials provided by this IAM role when making a request to an AWS service.

On the Application Options page, you specify information about build, Internet Information Services (IIS), and application settings.

In the Build and IIS Deployment Settings area, in the Project build configuration drop-down list, choose the target build configuration. If the wizard can find it, Release appears otherwise, the active configuration is displayed in this box.

App pool drop-down list, choose the version of the .NET Framework required by your application. The correct .NET Framework version should already be displayed.

On the Review page, review the options you configured, and select the Open environment status window when wizard closes box. If everything looks correct, choose Deploy

You can watch the progress of deployment in Output sections of Visual Studio

Or on the AWS Console > Elastic Beanstalk

Once the deployment is completed, you can click on the URL link at the top of the AWS Application explorer

It will open the application in web browser. Here we can see the application up and running and accessible over the internet.

This is how we can quickly create sample dotnet web application and deploy it on AWS with some simple steps and clicks using AWS toolkit for Visual Studio

Related Information

View currently open issues with AWS Toolkit
https://github.com/aws/aws-toolkit-visual-studio/issues

--

--

Vaibhav Srivastava

Solutions Architect | AWS & Azure Certified | Hybrid & Multi-Cloud Exp. | Technophile