Menu
AWS Elastic Beanstalk
Developer Guide

Tutorial: How to Deploy a .NET Sample Application Using AWS 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 and was tested using Visual Studio Professional 2012.

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)

  1. Open the Elastic Beanstalk console using this preconfigured link: console.aws.amazon.com/elasticbeanstalk/home#/newApplication?applicationName=tutorials&environmentType=LoadBalanced

  2. For Platform, choose the platform that matches the language used by your application.

  3. For Application code, choose Sample application.

  4. Choose Review and launch.

  5. Review the available options. When you're satisfied with them, choose Create app.

When the environmentis 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

  1. Open the Elastic Beanstalk console.

  2. Navigate to the management page for your environment.

  3. Choose Configuration.

  4. On the Database configuration card, choose Modify.

  5. Choose a DB engine, and enter a user name and password.

  6. Choose Apply.

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

  1. Ensure that your environment launched successfully by checking the Health status in the Elastic Beanstalk console. It should be Green.

    
            Elastic Beanstalk .NET tutorial environment health Green
  2. In Visual Studio, open BeanstalkDotNetSample.sln.

    Note

    If you haven't done so already, you can get the sample here.

  3. On the View menu, choose Solution Explorer.

  4. Expand Solution ‘BeanstalkDotNetSample’ (2 projects).

  5. Open the context (right-click) menu for MVC5App, and then choose Publish to AWS.

    
            Elastic Beanstalk .NET tutorial Solution Explorer Publish to AWS
  6. On the Publish to AWS Elastic Beanstalk page, for Deployment Target, choose the environment that you just created, and then choose Next.

    
            Elastic Beanstalk .NET tutorial Publish to AWS Elastic Beanstalk Deployment Target
  7. On the Application Options page, accept all of the defaults, and then choose Next.

    
            Elastic Beanstalk .NET tutorial Publish to AWS Elastic Beanstalk Application Options
  8. On the Review page, choose Deploy.

    
            Elastic Beanstalk .NET tutorial Review and Deploy
  9. If you want to monitor deployment status, use the NuGet Package Manager in Visual Studio.

    
            Elastic Beanstalk .NET tutorial monitor status NuGet Package Manager

    When the application has successfully been deployed, the Output box displays completed successfully.

    
            Elastic Beanstalk .NET tutorial output completed successfully
  10. Return to the Elastic Beanstalk console and choose the name of the application, which appears next to the environment name.

    
            Elastic Beanstalk .NET tutorial launch sample app from console

    Your ASP.NET application opens in a new tab.

    
            Elastic Beanstalk .NET tutorial see your ASP.NET application running in the Web browser

Clean Up Your AWS Resources

After your application has deployed successfully, learn more about Elastic Beanstalk by watching the video in the application.

If you are done working with Elastic Beanstalk for now, you can terminate your .NET environment.

To terminate your Elastic Beanstalk environment

  1. Open the Elastic Beanstalk console.

  2. Navigate to the management page for your environment.

  3. 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 Elastic Beanstalk Applications in .NET Using AWS Toolkit for Visual Studio, the AWS .NET Development Blog , or the AWS Application Management Blog.