Creating CloudFormation templates from existing AWS resources

AWS CloudFormer can be used to create AWS CloudFormation templates from the existing AWS resources. This section describes the steps for creating a CloudFormation template from your existing AWS resources using the CloudFormer tool. The AWS CloudFormer tool will automatically detect the dependent resources for a given AWS resource. For example, if you select an EC2 instance, then CloudFormer will automatically select the associated security groups.

How to do it…

Follow the steps to create your AWS CloudFormation template from your existing AWS resources:

  1. Login to the AWS console.
  2. Navigate to the CloudFormation service.
  3. Click on Launch CloudFormer and continue with default options. If you want to restrict the access to CloudFormation tool, specify the appropriate IP address range. Check the checkbox that says I acknowledge that this template might cause AWS CloudFormation to create IAM resources.
  4. Within minutes, your CloudFormer stack will be created. Get the URL for your CloudFormer tool in the outputs section.
  5. After navigating to the tool, select the AWS region from the Select the AWS Region drop-down box.
  6. After selecting the region, click on the Create Template button. This will analyze all the AWS resources in your account.
  7. After analyzing AWS resources in your account, the CloudFormer tool displays an interface to select the DNS (Route53), VPC, VPC network (subnets, Internet gateways, customer gateways, DHCP options, VPN connections), VPC security (network ACLs, route tables), network (ELB, EIP, network interfaces, CloudFront distributions), compute (autoscaling groups, EC2 instances), storage (EBS volumes, RDS databases instances, DynamoDB tables, S3 buckets), services (Elastic Cache Clusters, SQS queues, SNS topics, SimpleDB domains), config (autoscaling launch configurations, RDS DB subnet groups, RDS DB parameter groups, Elastic Cache Parameter groups), security (EC2 security groups, RDS security groups, Elastic Cache Security groups, SQS queue policies, S3 bucket policies, operational (autoscaling policies, CloudWatch alarms). Select the required AWS resources in your AWS account.
  8. After verifying the template, you can save the template in an S3 bucket.
  9. Using this CloudFormation template, you can recreate your infrastructure.
  10. After creating the CloudFormer template, remember to delete the CloudFormer stack to avoid additional billing.

How it works…

AWS CloudFormer is itself a CloudFormation stack, so we need to launch it. As a result of launching the stack, a t1.micro EC2 instance is created, automatically, and the URL is displayed in the output section. We access the URL to get access to the CloudFormer tool. CloudFormer helps you create a template from your running resources. It runs through all the resources in your account, and then lets you select the resources you want to include in your template. In addition, you can customize the names and define new outputs. CloudFormer will fill in the values for various properties in the starter template, for example, the Availability Zone for an EC2 instance. You will need to edit the starter template to include additional parameters or abstract away various properties. After generating the CloudFormation templates from the existing AWS resources, you can delete the CloudFormer stack to avoid additional billing for the t1.micro EC2 instance.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset