AWS Guide for .NET Developers

Deploying an ASP.NET App to Windows

You can use the Publish to Elastic Beanstalk wizard, provided as part of the Toolkit for Visual Studio, to deploy an application to Elastic Beanstalk. To practice, you can use an instance of a web application starter project that is built into Visual Studio or you can use your own project.

Create a Sample Web Application Starter Project

  1. In Visual Studio, choose File, New, Project.

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

  3. 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 Application (.NET Framework).

  4. In the Name box, type WebAppDemo. Choose a Location and confirm that the Create directory for solution box is selected. Then choose OK.

  5. In the New ASP.NET Web Application dialog box, choose Web Forms or MVC, and then choose OK.

    Visual Studio creates a solution and project based on the Application project template you selected. Visual Studio then displays the Solution Explorer, where the new solution and project appear.

Deploy an Application by Using the Publish to Elastic Beanstalk Wizard

  1. In Solution Explorer, open the context (right-click) menu for the WebAppDemo project, or open the context menu for the project for your own application, and then choose Publish to AWS Elastic Beanstalk.

    The Publish to Elastic Beanstalk wizard appears.

  2. In Profile, in the Account profile to use for deployment list, choose the AWS account profile to use for the deployment. This account profile is used only for deployment. You can specify your application credentials separately, if needed.

    Optionally, if you have an AWS account you want to use, but haven't yet created an AWS account profile for it, you can choose the plus symbol (+) button to add an AWS account profile.

  3. In the Region list, choose the AWS Region to which you want Elastic Beanstalk to deploy the application.

  4. In Deployment Target, choose Create a new application environment. If you wanted to redeploy a previously deployed application, you would choose Redeploy to an existing environment.

  5. Choose Next.

    On the Application Environment page, in the Application area, the Name defaults to WebAppDemo.

  6. In Environment, in the Name list, choose WebAppDemo-dev. In this context, the term environment refers to the infrastructure Elastic Beanstalk provisions for your application.

  7. Choose Check availability to ensure the default URL domain EBWebAppDemo-dev for your web application isn't already in use. If it is in use, try other names until the requested URL is available.

  8. Choose Next.

  9. In the Key pair list, choose an Amazon EC2 instance key pair to use to sign in to

    the instances that will be used for your application. Select <Create new key pair> and type in a key name. We have used "MyKeyPair" in this example.

    We recommend you launch your instance with a key pair so that you can connect to it with SSH or RDP in the future.

  10. Ensure Use non-default VPC, Single instance environment, and Enable Rolling Deployments are not selected. You can add these options later.

    Optionally, if you have an Amazon Relational Database Service database security group with a database you want your application to access, select it in the Relational Database Access list. It will be modified to permit access from the Amazon EC2 instances hosting your application.

    Choose Next.

  1. On the Permissions page, choose Next to accept the defaults.

  2. On the Applications Options page, choose Next to accept the defaults.

  3. On the Review page, select Open environment status window when wizard closes and Generate AWSDeploy configuration. Click Choose, type in WebAppDemo, and then choose Save.

  4. Choose Deploy to deploy to Elastic Beanstalk.


    When you deploy the application, the active account will incur charges for the AWS resources used by the application.

    Information about the deployment will appear in the Visual Studio status bar and the Events window of the environment page. It might take several minutes to complete the deployment. When complete, you'll see a green INFO event indicating that the environment launch succeeded.

    Choose the URL to view the website.

Delete an AWS Elastic Beanstalk Deployment

Terminate an environment, delete the app.

You can use the Toolkit for Visual Studio to delete a deployment. In AWS Explorer, expand the Elastic Beanstalk node, open the context (right-click) menu for the subnode for the deployment, and then choose Terminate Environment. The termination process might take a few minutes. You can monitor termination status on the event tab of the environment view.

Once the deployment is terminated, expand the Elastic Beanstalk node in AWS Explorer, open the context (right-click) menu for the subnode for the deployment, and then choose Delete.