Getting Started With Your .NET App on AWS – Part 2 Deploy

awslogoOnce you have set up AWS for your .NET application, you can now prepare Elastic Beanstalk and then deploy your own code.

About AWS Beanstalk

When you want a web app on AWS that can just run without having to manage the operating system, you want AWS Beanstalk. It can be Internet facing or it can be a worker without facing the Internet.

You simply upload your application, and Elastic Beanstalk automatically handles the details of capacity provisioning, load balancing, scaling, and application health monitoring. Elastic Beanstalk uses highly reliable and scalable services that are available in the AWS Free Tier.

ElasticBeanstalk_Benefit_FastSimple.057cffcf98271140071a6d33087573ceecd4e7b1Elastic Beanstalk supports applications developed in Java, PHP, .NET, Node.js, Python, and Ruby, as well as different container types for each language.

AWS Beanstalk has a concepts of:

  • Environment. You can create and manage separate environments for development, testing, and production use, and you can deploy any version of your application to any environment. Environments can be long-running or temporary. When you terminate an environment, you can save its configuration to recreate it later.
  • Application. You can use the AWS Management Console to upload an updated source bundle and deploy it to your AWS Elastic Beanstalk environment, or redeploy a previously uploaded version.

Step 1. Create the Elastic Beanstalk Environment

In this step, you will create an application and an environment.

To start, open the Elastic Beanstalk console. You will need the user name and password of the user you created as you learned in the previous post,  ___. In that step you created you created My First Elastic Beanstalk Application in the default environment. And then you (may have) deleted it.

Note: Amazon is experimenting with a user inteface, so yours may look different.

You can create a new application. Click Create New Application in the menu at the top of the page.


On Create New Application dialog, enter your application name and click Create.


Create an Environment. (Click your application name in the top bar and click the Create New Environment menu item.


Or you can use the link: No enviornments currently exist for this application. Create one now

Click Web Server environment. Click Select.


On the Create New Environment page, set Platform to .NET (Windows IIS). Keep the default Application Code as Sample application for now. cilick Configure More Options.


Here you have your choice to configure your app into to the details.


You can set the compute size if you need more resources by clicking on Modify button under Instances. For example, you can set the instance size to t2.nano, which offers a lower price point with good performance.

For our application, let’s add a database.


The sample code is expecting the Engine to be sqlserver-ex and the minimum size database for Storage, 30 GB. For your app, you will have choices of database engine and sizes.

Create a Username and Password, then click Save.

Click Create Environment. Wait. It will take a few minutes. [To set your expectation, it took roughly half an hour.]


NOTE: You are no longer in the free environment. So you will want to terminate the environment when you are done.

Step 2. Publish your app

Just about there!

Check to be sure your app enivornment is ready. Log into the Elastic Beanstalk console. Click in the square with your environment.


Meanwhile, you can get the BeanstalkDotNetSample.sln. (Put it in its own folder before you Extract Files.)

Open the project in Visual Studio. Take a look at the code.

When you are ready, right click on the MVCSApp project. Click Publish to AWS Elastic Beanstalk.


You will see Publish to AAWS Elastic Beanstalk dialog. Select your account profile that you want to deploy from and your environment. (You can create a new environment if you want for your next project from this dialog too.)


Click Next.

Inspect the Application Options.


Click Next.

Inspect your deployment on the Review panel.


Click Deploy.

Inspect the Output panel in Visual Studio.


Return to Elastic Beanstalk console. Go to your environment.

Click the link to your application.




Step 3. Clean up

You will want to minimize your expenses on the example environment.

Log into the the Elastic Beanstalk console. Find your environment.

Click Actions drop down menu. Click Terminate Enviornment.


Type in your environment name. Click Terminate.

After a few minutes you can see health of your environment is terminated.


Elastic Beanstalk cleans up all AWS resources associated with your environment, including EC2 instances, DB instance, load balancer, security groups, CloudWatch alarms, etc.

Next Steps

You are now set up to build apps and deploy to AWS.