AWS Elastic Beanstalk
Developer Guide (API Version 2010-12-01)
AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

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.

To create the environment

  1. Open the Elastic Beanstalk console.

    Note

    If the New Environment wizard does not show the screens described below, see The Old New Environment Wizard.

  2. Choose Create New Application.

    
                Elastic Beanstalk .NET tutorial create new application wizard

  3. On the Application Information page, enter an Application name, and then choose Next.

    
                Elastic Beanstalk .NET tutorial enter application name

  4. On the New Environment page, choose Create web server.

    
                Elastic Beanstalk .NET tutorial create web server

  5. On the Environment Type page, for Predefined configuration, choose IIS.

    
                Elastic Beanstalk .NET tutorial environment type IIS

  6. For Environment type, accept the default, Load balancing, auto scaling, and then choose Next.

    
                Elastic Beanstalk .NET tutorial environment type load balancing auto scaling

  7. On the Application Version page, for Source, choose Sample application, and then choose Next.

    
                Elastic Beanstalk .NET tutorial application version sample application

  8. On the Environment Information page, accept all defaults, and then choose Next.

    
                Elastic Beanstalk .NET tutorial environment information

  9. On the Additional Resources page, choose Create an RDS DB instance with this environment, and then choose Next.

    
                Elastic Beanstalk .NET tutorial create RDS database instance

  10. On the Configuration Details page, for Instance type, choose t2.micro.

    Accept the default values for the other fields, and then choose Next.

    
                Elastic Beanstalk .NET tutorial configuration details

  11. On the Environment Tags page, leave both the Key and the Value fields blank, and then choose Next.

    
                Elastic Beanstalk .NET tutorial Environment Tags

  12. Choose Next on the Permissions page. If you don't have a default instance profile and service role, Elastic Beanstalk creates them for you.

  13. On the RDS Configuration page, for DB engine, choose sqlserver-ex. For Instance class, choose db.t2.micro, and then increase the Allocated storage to 20 GB.

    
                Elastic Beanstalk .NET tutorial RDS configuration

  14. Create a Username and Password, and then choose Next.

  15. On the Review Information page, review the settings, and then choose Launch.

    To check launch status, see the Dashboard page in the Elastic Beanstalk console.

    
                Elastic Beanstalk .NET tutorial Launching environment status 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

  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.