AWS CloudFormation
User Guide (API Version 2010-05-15)
« PreviousNext »
View the PDF for this guide.Go to the AWS Discussion Forum for this product.Go to the Kindle Store to download this guide in Kindle format.Did this page help you?  Yes | No |  Tell us about it...

Using CloudFormer to Create AWS CloudFormation Templates from Existing AWS Resources

CloudFormer is a tool that enables you to create AWS CloudFormation templates from existing AWS resources in your account. With it, you can provision and configure your application resources the way you want using your existing processes and tools. Once everything is setup and you have the resources provisioned, simply take a "snapshot" of the configuration to create a template, enabling you to launch copies of the application with just a few clicks through the AWS Management Console.

The CloudFormer tool allows you to select any of the AWS resources running in your account for inclusion in the template. If you select resources that have dependent resources (for example, an Amazon EC2 instance is associated with an EC2 security group), the tool will automatically select any dependent resources. You can override any of the pre-selected resources or add other resources as necessary. You have full control of the resources that will be included in your template. Logical names are chosen based on the existing resource names, however, you can edit the names that will be included in the template and you can add output parameters based on the attributes available for any of the resources. The template can be uploaded to your S3 bucket and launched directly via the AWS CloudFormation stack creation wizard.

CloudFormer is a standalone application that you can launch inside your AWS environment. The application is started on a t1.micro Amazon EC2 instance via AWS CloudFormation. No other AWS resources are required to run CloudFormer.

Launch CloudFormer

You can launch CloudFormer in a number of different ways, such as by using the URLs provided on the CloudFormer tool page, on the AWS CloudFormation Templates page, or by using the AWS Management Console. Because the AWS Management Console is a good way to learn about the process of working with AWS resources, we will use the Console to launch CloudFormer.

Note

This guide will use a specific scenario, building a simple website on an EC2 instance. Although this example is simple, it will use a number of AWS resources to show you how to work with these in the CloudFormer tool. Keep in mind, however, that this is merely one example of infinite possibilities, since CloudFormer can be used to create a template from any collection of AWS resources that you've created.

To launch CloudFormer with the AWS Management Console

  1. Log in to the AWS CloudFormation Console. If you have not done this before, see Logging in to the AWS CloudFormation Console for instructions.

  2. Click Create New Stack, which will bring up the Create Stack dialog.

  3. On the Create Stack dialog, name your stack, then click Use a Sample Template and select CloudFormer - create a template from your existing resources in the drop-down list.


  4. Click Continue to move to the Specify Parameters page.

    The CloudFormer stack runs on a t1.micro instance for lowest cost. There are no parameters for this stack.

  5. On the Specify Parameters page, check the box labeled "I acknowledge that this template may create IAM resources" and click Continue to move to the Review page.

  6. On the Review page, examine the information about the stack that will be created, then click Continue to begin creating the CloudFormer stack.

    Note: Since CloudFormer is an AWS CloudFormation stack itself, it will go through the normal stack creation process, from CREATE_IN_PROGRESS to CREATE_COMPLETE.

  7. Once the CloudFormer stack's state is CREATE_COMPLETE, click its entry in your AWS CloudFormation Management Console, and select the Outputs tab in the stack information pane.

  8. In Outputs, click the URL to begin using the CloudFormer tool.

    The AWS CloudFormer interface will be displayed.


Create a Template

The next step is to begin the template creation process. You will likely want to use your own AWS resources, but for the purpose of the tutorial, we will assume that the following resources have been created:

  • AWS::EC2::EIP

  • AWS::EC2::Instance

  • AWS::EC2::SecurityGroup

  • AWS::IAM::AccessKey

Note

CloudFormer will automatically resolve dependencies for you when you have AWS Resources that are associated with your EC2 Instance. These will show up as pre-selected options when you are selecting resources to add to your template.

To use CloudFormer to create a template from your AWS resources

  1. Select the region in which you'd like to create your template, and click Create Template.

    You'll move to the Intro page, which allows you to enter a description for your template and select resources with a filter or by selecting all resources in your account. We'll hand-pick the resources, so leave those fields blank and unchecked, respectively.

  2. On the Intro page, enter a description for your template and click Continue.

    This will bring you to the DNS Names page. If you have any Route53 DNS records that are used by your instance, you can select them here. We don't have any, so we'll skip this screen.

  3. On the DNS Names page, click Continue.

    This will bring you to the Network Resources page. Here, you can select any Amazon EC2 Elastic IP addresses, Elastic Load Balancers or CloudFront distributions. We have an Elastic IP Address, so we'll add it here.

  4. Select the Amazon EC2 Elastic IP address that you'd like to include in your template, and click Continue.

    This will bring you to the Compute Resources page. You can select any Auto Scaling groups or Amazon EC2 Instances to include in your template. If you have already associated the Elastic IP Address with an EC2 instance, that instance will be pre-selected here.

  5. Make sure that your EC2 instance is selected, and click Continue.

    This will bring you to the System Configuration page. Here, you can select any AWS AutoScaling Launch Configurations to add them your template.

  6. On the System Configuration page, click Continue.

    This brings you to the Storage page, which allows you to add Amazon Elastic Block Storage (EBS) volumes, Amazon RDS Database Instances and S3 Buckets to your template.

  7. On the Storage Page, click Continue.

    This will bring you to the Security Groups page, where you can select any Amazon EC2 or RDS security groups to add to your template. If you have associated any security groups with your EC2 instance, they will be pre-selected here.

  8. Make sure that your EC2 security group is selected, and click Continue.

    This takes you to the Application Services page (called "Other" on the CloudFormer timeline), where you can select any SQS Queues or Amazon SimpleDB Domains to add to your template.

  9. On the Application Services page, click Continue.

    This brings you to the Operational Resources page, which allows you to add any auto-scaling triggers that you have set up. We have none, so we'll skip this step.

  10. on the Operational Resources page, click Continue.

    This brings you to the Summary page, which serves a number of purposes:

    • It is a chance to review the resources you've added to your template, and to go back and re-select them if you want.

    • It gives you an opportunity to change the auto-generated logical resource names for your resources.

    • It gives you an opportunity to specify outputs that will provide necessary information, such as your site's IP address or URL, the Availability Zone, or other bits of information that will be useful for configuring and using your stack.

  11. On the Summary page, examine the resources you've selected. You should have one Amazon Elastic IP Address, one Amazon EC2 instance, and one Amazon EC2 Security Group.

    To rename a resource with a logical name you specify, type its name in the Logical Name box. To choose an Output field to expose to the Outputs tab of the stack information pane, click the outputs here.

  12. On the Summary page, verify your selections, change the logical names of your resources, and add Outputs. When you are satisfied with the changes you've made, click Continue.

    The next page shows you the template that was generated for your resources. Using this template will create a stack that contains all of the resources you selected. You can use this template to deploy your resources as a combined set with AWS CloudFormation, or you can use it as a base template for further modification.

    You can also save your stack directly to an S3 bucket by clicking the Save Stack button, so you can launch the stack from the URL by entering it in the Provide a Template URL field when creating a new stack.

  13. Click Save to save the stack to S3. This action also gives you the option to launch an instance of the stack immediately. If you do this, the S3 URL will be automatically selected to create the stack.

Note

Once your template has been created, you can (and should) delete your CloudFormer stack to minimize any charges to your AWS account.