|« PreviousNext »|
|Did this page help you? Yes | No | Tell us about it...|
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 AWS 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.
This chapter walks you through deploying a sample .NET application to AWS 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, go to Deployment Tool.
In order to
deploy your web application using the deployment tool, you need to package it as a
.zip file. For more information about how to package your
application for deployment, go to How to: Deploy a Web
Application Project Using a Web Deployment Package at MSDN.
To use the deployment tool, you need to install the AWS Toolkit for Visual Studio. For information on prerequisites and installation instructions, go to AWS Toolkit for Microsoft Visual Studio.
The deployment tool is typically installed in one of the following directories on Windows:
C:\Program Files\AWS Tools\Deployment Tool\awsdeploy.exe
C:\Program Files (x86)\AWS Tools\Deployment Tool\awsdeploy.exe
To deploy the sample application to AWS Elastic Beanstalk using the deployment tool, you first need to
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
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 AWS 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 AWS Elastic Beanstalk
Samples subdirectory where the deployment tool is
enter your AWS access key and AWS secret key as in the following
For API access, you need an access key ID and secret access key. Use IAM user access keys instead of AWS root account access keys. IAM lets you securely control access to AWS services and resources in your AWS account. For more information about creating access keys, see How Do I Get Security Credentials? in the AWS General Reference.
### AWS Access Key and Secret Key used to create and deploy the application instance AWSAccessKey = AKIAIOSFODNN7EXAMPLE AWSSecretKey = wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
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
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
In your web browser, navigate to the URL of your running application. The URL will be in the
You can redeploy your application using an incremental deployment. Incremental deployments are faster because you are updating only the files that have changed instead of all the files. This section walks you through redeploying the sample application you deployed in Deploy to AWS Elastic Beanstalk.
To edit and redeploy a .NET application to AWS Elastic Beanstalk
AWSDeploymentSampleApp.zip from the Samples directory to a location on your computer such as
Modify one of the files in the
AWSDeploymentSampleApp directory. For
example, you can modify the title in
ElasticBeanstalkDeploymentSample.txt configuration file, do the following:
Specify the location where you extracted the files. This means modifying the value for the
key in the
Incremental Deployment Settings section in
ElasticBeanstalkDeploymentSample.txt. For example:
Remove the # in front of
# in front of
DeploymentPackage in the
Non-Incremental Deployment Settings.
At the command line, type the following:
C:\Program Files (x86)\AWS Tools\Deployment Tool>awsdeploy.exe /r Samples\ElasticBeanstalkDeploymentSample.txt
If this command succeeds, you should see something similar to the following:
...environment 'MyAppEnvironment' found and available for redeployment (configuration parameters not required for redeployment will be ignored) ...starting redeployment to AWS Elastic Beanstalk environment 'MyAppEnvironment' ...starting incremental deployment to environment 'MyAppEnvironment' ...finished incremental deployment in 9199.9199 ms
In your web browser, navigate to the same URL as in Deploy to AWS Elastic Beanstalk. You should see your updated application.