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.

Deploying Elastic Beanstalk Applications in .NET Using the Deployment Tool

The AWS Toolkit for Visual Studio includes a deployment tool, a command line tool that provides the same functionality as the deployment wizard in the AWS Toolkit. You can use the deployment tool in your build pipeline or in other scripts to automate deployments to Elastic Beanstalk.

The deployment tool supports both initial deployments and redeployments. If you previously deployed your application using the deployment tool, you can redeploy using the deployment wizard within Visual Studio. Similarly, if you have deployed using the wizard, you can redeploy using the deployment tool.

Note

The deployment tool does not apply recommended values for configuration options like the console or EB CLI. Use configuration files to ensure that any settings that you need are configured when you launch your environment.

This chapter walks you through deploying a sample .NET application to Elastic Beanstalk using the deployment tool, and then redeploying the application using an incremental deployment. For a more in-depth discussion about the deployment tool, including the parameter options, see Deployment Tool.

Prerequisites

To use the deployment tool, you need to install the AWS Toolkit for Visual Studio. For information on prerequisites and installation instructions, see AWS Toolkit for Microsoft Visual Studio.

The deployment tool is typically installed in one of the following directories on Windows:

32-bit 64-bit

C:\Program Files\AWS Tools\Deployment Tool\awsdeploy.exe

C:\Program Files (x86)\AWS Tools\Deployment Tool\awsdeploy.exe

Deploy to Elastic Beanstalk

To deploy the sample application to Elastic Beanstalk using the deployment tool, you first need to modify the ElasticBeanstalkDeploymentSample.txt configuration file, which is provided in the Samples directory. This configuration file contains the information necessary to deploy your application, including the application name, application version, environment name, and your AWS access credentials. After modifying the configuration file, you then use the command line to deploy the sample application. Your web deploy file is uploaded to Amazon S3 and registered as a new application version with Elastic Beanstalk. It will take a few minutes to deploy your application. Once the environment is healthy, the deployment tool outputs a URL for the running application.

To deploy a .NET application to Elastic Beanstalk

  1. From the Samples subdirectory where the deployment tool is installed, open ElasticBeanstalkDeploymentSample.txt and enter your AWS access key and AWS secret key as in the following example.

    ### AWS Access Key and Secret Key used to create and deploy the application instance
    AWSAccessKey = AKIAIOSFODNN7EXAMPLE
    AWSSecretKey = wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY

    Note

    For API access, you need an access key ID and secret access key. For more information about creating access keys, see How Do I Get Security Credentials? in the AWS General Reference.

  2. At the command line prompt, type the following:

    C:\Program Files (x86)\AWS Tools\Deployment Tool>awsdeploy.exe /w Samples\ElasticBeanstalkDeploymentSample.txt

    It takes a few minutes to deploy your application. If the deployment succeeds, you will see the message, Application deployment completed; environment health is Green.

    Note

    If you receive the following error, the CNAME already exists.

    [Error]: Deployment to AWS Elastic Beanstalk failed with exception: DNS name (MyAppEnv.elasticbeanstalk.com) is not available.

    Because a CNAME must be unique, you need to change Environment.CNAME in ElasticBeanstalkDeploymentSample.txt.

  3. In your web browser, navigate to the URL of your running application. The URL will be in the form <CNAME.elasticbeanstalk.com> (e.g., MyAppEnv.elasticbeanstalk.com).