Tutorial: How to deploy a .NET sample application using Elastic Beanstalk
In this tutorial, you will learn how to deploy a .NET sample application to AWS Elastic Beanstalk using the AWS Toolkit for Visual Studio.
Note
This tutorial uses a sample ASP.NET Web application that you can download here. It also uses the
Toolkit for Visual Studio
Create the environment
First, use the Create New Application wizard in the Elastic Beanstalk console to create the application environment. For Platform, choose .NET.
To launch an environment (console)
-
Open the Elastic Beanstalk console using this preconfigured link: console.aws.amazon.com/elasticbeanstalk/home#/newApplication?applicationName=tutorials&environmentType=LoadBalanced
-
For Platform, select the platform and platform branch that match the language used by your application.
-
For Application code, choose Sample application.
-
Choose Review and launch.
-
Review the available options. Choose the available option you want to use, and when you're ready, choose Create app.
When the environment is up and running, add an Amazon RDS database instance that the application uses to store data. For DB engine, choose sqlserver-ex.
To add a DB instance to your environment
Open the Elastic Beanstalk console
, and in the Regions list, select your AWS Region. -
In the navigation pane, choose Environments, and then choose the name of your environment from the list.
Note
If you have many environments, use the search bar to filter the environment list.
In the navigation pane, choose Configuration.
-
In the Database configuration category, choose Edit.
-
Choose a DB engine, and enter a user name and password.
-
Choose Apply at the bottom of the page.
Publish your application to Elastic Beanstalk
Use the AWS Toolkit for Visual Studio to publish your application to Elastic Beanstalk.
To publish your application to Elastic Beanstalk
-
Ensure that your environment launched successfully by checking the Health status in the Elastic Beanstalk console. It should be Ok (green).
-
In Visual Studio, open BeanstalkDotNetSample.sln.
Note
If you haven't done so already, you can get the sample here.
-
On the View menu, choose Solution Explorer.
-
Expand Solution ‘BeanstalkDotNetSample’ (2 projects).
-
Open the context (right-click) menu for MVC5App, and then choose Publish to AWS.
-
On the Publish to AWS Elastic Beanstalk page, for Deployment Target, choose the environment that you just created, and then choose Next.
-
On the Application Options page, accept all of the defaults, and then choose Next.
-
On the Review page, choose Deploy.
-
If you want to monitor deployment status, use the NuGet Package Manager in Visual Studio.
When the application has successfully been deployed, the Output box displays completed successfully.
-
Return to the Elastic Beanstalk console. In the navigation pane, choose Go to environment.
Your ASP.NET application opens in a new tab.
Clean up your AWS resources
After your application has deployed successfully, learn more about Elastic Beanstalk by watching the video
If you are done working with Elastic Beanstalk for now, you can terminate your .NET environment.
To terminate your Elastic Beanstalk environment
Open the Elastic Beanstalk console
, and in the Regions list, select your AWS Region. -
In the navigation pane, choose Environments, and then choose the name of your environment from the list.
Note
If you have many environments, use the search bar to filter the environment list.
-
Choose Actions and then choose Terminate environment.
Elastic Beanstalk cleans up all AWS resources associated with your environment, including EC2 instances, DB instance, load balancer, security groups, CloudWatch alarms, etc.
For more information, see Creating and deploying .NET applications on Elastic Beanstalk, the AWS .NET Development Blog