|« PreviousNext »|
|Did this page help you? Yes | No | Tell us about it...|
AWS CloudFormation is a service that simplifies the process of provisioning AWS resources for your application. The AWS resources are described in a template file. The AWS CloudFormation service consumes this template and automatically provisions the necessary resources for you. For more information about AWS CloudFormation, go to the AWS CloudFormation documentation.
In this section, we'll deploy an application to AWS, using AWS CloudFormation to provision the resources for the application. The application we'll use is the PetBoard sample, which is included with the AWS SDK for .NET. The SDK is installed automatically when you install the AWS Toolkit. PetBoard is also available as a separate download from the AWS website.
You can find the PetBoard application in the Samples directory beneath the SDK install directory. The SDK is
usually installed in the
Program Files directory or
Program Files (x86) on Windows
If PetBoard is installed beneath Program Files, you will need to run Visual Studio with administrator privileges in order to open the sample. If you are not running with administrator privileges, Visual Studio will ask if you want to restart the Visual Studio application with administrator privileges enabled.
To open PetBoard, click the File menu and select Open | Project/Solution. In the Open Project dialog box, navigate to the PetBoard sample directory. Two versions of PetBoard are provided: one for Visual Studio 2008 and the other for Visual Studio 2010. Select the appropriate solution (SLN) file for your version. Click Okay. The PetBoard sample will appear in Solution Explorer.
To deploy the PetBoard application using AWS CloudFormation
In Solution Explorer, right-click the project node for the PetBoard sample, and then click Publish to AWS CloudFormation.
In the Publish to AWS CloudFormation dialog box, select the AWS account that you wish to use for the deployment. You could also add a new account by clicking Other.
The dialog box provides the option of redeploying an application that was deployed previously—using either the deployment wizard or the standalone deployment tool—or deploying a new instance. If you select to perform a redeployment, there may be a delay while the wizard retrieves information from the previous deployment.
For this example, we'll deploy a new instance.
For deploying a new instance, the dialog box provides two AWS CloudFormation templates that you can use: Load Balanced Template and Single Instance Template. These templates are included with the AWS Toolkit. Load Balanced Template provisions an Amazon Elastic Compute Cloud (Amazon EC2) instance with an Amazon Elastic Load Balancer and an Amazon Auto-Scaling Group. Single Instance Template provisions just a single Amazon EC2 instance.
Select Load Balanced Template, and then click Next.
In the AWS Options dialog box:
Select a key pair in the Key pair drop-down.
You can leave SNS Topic blank. If you specify an SNS topic, AWS CloudFormation will send status notifications during the deployment process.
Leave Use custom AMI blank; the AWS CloudFormation template includes an AMI.
Leave Instance Type set to Micro as this will minimize the cost associated with running the instance. For more information about Amazon EC2 costs, go to the Amazon EC2 Pricing page.
Specify a security group that has port 80 open. Applications deployed to AWS CloudFormation need to have port 80 open because AWS CloudFormation uses port 80 to relay information regarding the deployment. The default security group does not have port 80 open. If you have already configured a security group with port 80 open, then specify that group. To learn how to create an appropriate security group, see Creating a New Security Group. If the specified security group does not have port 80 open, the wizard will ask if it should open port 80 for the specified security group. If you say yes, port 80 will then be open for any Amazon EC2 instances that use that security group.
In the Application Options dialog box, in the Application Credentials section, select the AWS credentials under which the application (in this example, PetBoard) should run. These could be different than the credentials used to deploy to CloudFormation, that is, the credentials for the account selected on the first page of the wizard.
To use a different set of credentials than the ones that are used to deploy, select the second radio button and enter the Access Key and Secret Key.
To use the same credentials as those that are used to deploy, select the third radio button: Use credentials for '<account name>' where <account name> is the account selected on the first page of the wizard.
To use the credentials for an AWS Identity and Access Management (IAM) user, select the fourth radio button and specify the user. To use an IAM user, you need to have 1) created the IAM user in the AWS Toolkit, and 2) stored the secret key for the user with the AWS Toolkit. For more information, see Create and Configure an IAM User and Generate Credentials for an IAM User.
Also, note that an IAM user could have more than one set of credentials stored with the AWS Toolkit. If that is the case, you will need to select which credentials to use. Finally, note that the root account could rotate the credentials for the IAM user, which would invalidate the credentials selected here. In this scenario, you would need to redeploy the application and manually enter the new credentials for the IAM user.
The following table describes the other options available in this dialog box. For PetBoard, you do not need to change any of these from the defaults.
|Key and Value||Description|
These values are made available to the deployed application through the
Specifies the version of the .NET Framework that the application targets. Possible options are:
Enable 32-bit applications
Select if the application is 32-bit. Otherwise, leave unselected.
Application health check URL
The URL that is used to "Health Check" the application. This URL is relative to the root
server URL. For example, if the full path to the URL is
This setting is applicable only when using the load-balanced template; this setting is ignored when using the single-instance template. The responsiveness of the application at this URL factors into the actions taken by the load balancer and auto-scaler.
In the Review dialog box, select Open environment status window when wizard closes.
You can save the deployment configuration to a text file which you can then use with standalone deploy tool. To save the configuration, select Generate AWSDeploy configuration. Then, click Choose File and specify a file to which to save the configuration. You can also save off the configuration after the deployment completes, by right-clicking on the deployment in AWS Explorer and selecting Save Configuration from the context menu.
The deployment configuration includes the credentials that were used for deployment. Therefore, you should keep the configuration secure to avoid having the credentials fall into enemy hands.
When you deploy the application, the active account will incur charges for the AWS resources used by the application.
A status page for the deployment will open. It may take a few minutes for the deployment to complete.
When the deployment completes, the AWS Toolkit will display an alert. This is useful because it allows you to focus on other tasks while the deployment is in progress.
In the AWS Toolkit, when the deployment completes, the status displayed will be CREATE_COMPLETE.
You can click the Application URL link to connect to the PetBoard application.
To delete the deployment, expand the CloudFormation node in AWS Explorer and right-click the subnode for the deployment. Select Delete. AWS CloudFormation will begin the deletion process, which may take a few minutes. If you specified an SNS topic for the deployment, AWS CloudFormation will send status notifications for the delete process to this topic.