{"id":18308,"date":"2015-03-30T16:36:55","date_gmt":"2015-03-30T11:06:55","guid":{"rendered":"http:\/\/www.tothenew.com\/blog\/?p=18308"},"modified":"2020-11-24T12:12:55","modified_gmt":"2020-11-24T06:42:55","slug":"using-aws-cloudformer-to-create-template-of-existing-infrastructure","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/using-aws-cloudformer-to-create-template-of-existing-infrastructure\/","title":{"rendered":"Using AWS CloudFormer to create template of existing infrastructure"},"content":{"rendered":"<p>AWS CloudFormer is a template creation tool and it creates AWS CloudFormation template from our existing resources in AWS account. We can select any <a title=\"DevOps AWS\" href=\"http:\/\/www.tothenew.com\/devops-aws\" target=\"_blank\">supported AWS resources<\/a> that are running in our account, and CloudFormer creates a template in an Amazon S3 bucket. We will be <strong>using AWS CloudFormer to create template of existing infrastructure.<\/strong><\/p>\n<h3 style=\"text-align: justify;color: #ff9900\">AWS CloudFormation<\/h3>\n<p>AWS CloudFormation can be used with sample templates\u00a0or our own templates to describe the AWS resources, and any associated dependencies or runtime parameters, required to run an application. We don\u2019t need to figure out the order of provisioning services (or the subtleties of making those dependencies work). CloudFormation takes care of this for you. After the resources are deployed, we can modify and update them in a controlled and predictable way, this applies version control to our infrastructure the same way as we can do with software.<br \/>\nWe can deploy and update a template and its collection of resources (called a stack) by using the <a title=\"DevOps on AWS\" href=\"http:\/\/www.tothenew.com\/devops-aws\" target=\"_blank\">AWS<\/a> Console (or AWS CLI or APIs). CloudFormation is available at no additional charge, and we are charged only for the resources needed to run your applications.<\/p>\n<p>In other words, <strong>CloudFormation<\/strong> is used create a infrastructure through a template (JSON script):<\/p>\n<p>1) Available on AWS website for different use-cases e.g.two servers with apache installed attached to a load balancer.<\/p>\n<p>2) Customized script as per our requirement.<\/p>\n<p><strong>CloudFormer<\/strong> automates our work by managing selected 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. We can override any of the pre-selected resources or add other resources as necessary . We have full control of the resources to be included in our template. Names are chosen based on the existing resource names (we can edit the names that will be included in the template and we can add output parameters based on the attributes available for any of the resources. The template can be uploaded to a S3 bucket and launched directly via the AWS CloudFormation stack creation wizard. (reverse of CloudFormation)<\/p>\n<p>The <strong>CloudFormer tool<\/strong> is used to create a starting point of template. Once created, we can customize it, as following:<\/p>\n<ul>\n<li>Add Parameters to enable stacks to be configured at launch time.<\/li>\n<li>Add Mappings to allow the template to be customized to the specific environment.<\/li>\n<li>Replace static values with &#8220;Ref&#8221; and &#8220;Fn::GetAtt&#8221; functions to flow property data between resources where the value of one property is dependent on the value of a property from a different resource.<\/li>\n<li>Fill in your Amazon EC2 instance userdata to pass parameters to your EC2 instances at launch time.<\/li>\n<li>Customize your Amazon RDS DB instance database names and master passwords.<\/li>\n<\/ul>\n<p>For more details, visit the\u00a0<a href=\"http:\/\/docs.aws.amazon.com\/AWSCloudFormation\/latest\/UserGuide\/cfn-ug.pdf\" target=\"_blank\">AWS CloudFormation User Guide<\/a>\u00a0and to run this tool, <a href=\"https:\/\/aws.amazon.com\/developertools\/6460180344805680\" target=\"_blank\">click here<\/a>.<\/p>\n<h3 style=\"text-align: justify;color: #ff9900\">Use Case<\/h3>\n<p>Suppose, we have a full fledged infrastructure containing EC2 instances, RDS, Elastic Load Balancer and an AutoScaling on top of it. Now, our production requires you to replicate the same infrastructure. Doing this can can take anything between hours to days and the dependant configurations have to be precisely dealt with.<\/p>\n<h3 style=\"text-align: justify;color: #ff9900\">Demo<\/h3>\n<p>We would be demonstrating step-by-step approach for the creation of template from our existing infrastructure :<\/p>\n<p>Go to the AWS Management console and select &#8220;CloudFormation service&#8221;.<\/p>\n<p style=\"text-align: justify;color: #0000ff\">Click on the &#8220;Create Stack&#8221; button.<\/p>\n<p style=\"text-align: justify;color: #0000ff\">Select the sample template as &#8220;CloudFormer&#8221;.<\/p>\n<p style=\"text-align: justify;color: #0000ff\">Specify parameters as per requirement.<\/p>\n<p style=\"text-align: justify;color: #0000ff\">Tag the template with proper naming convention(\u00a0for ease of use).<\/p>\n<p><a href=\"\/blog\/wp-ttn-blog\/uploads\/2015\/03\/STEP42.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-18669\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/03\/STEP42.png\" alt=\"STEP4\" width=\"1366\" height=\"504\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;color: #0000ff\">Finally, click on the &#8220;create&#8221; button &amp; the stack is ready.<\/p>\n<p><a href=\"\/blog\/wp-ttn-blog\/uploads\/2015\/03\/STEP52.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-18670\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/03\/STEP52.png\" alt=\"STEP5\" width=\"1366\" height=\"768\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;color: #0000ff\">The highlighted Stack is the one which we have just created. The &#8220;URL&#8221; \u00a0is the link of the CloudFormer Tool ( it is running on an t1.micro instance in our AWS Account.<\/p>\n<p><a href=\"\/blog\/wp-ttn-blog\/uploads\/2015\/03\/STEP62.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-18671\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/03\/STEP62.png\" alt=\"STEP6\" width=\"1298\" height=\"573\" \/><\/a><\/p>\n<p style=\"text-align: justify;color: #0000ff\">Click on the &#8220;create Template button&#8221; and proceed further.<\/p>\n<p><a href=\"\/blog\/wp-ttn-blog\/uploads\/2015\/03\/STEP82.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-18673\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/03\/STEP82.png\" alt=\"STEP8\" width=\"932\" height=\"586\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;color: #0000ff\">You will see a &#8220;Analyzing your account&#8221; screen &amp; this step will take some time ( Be patient).<\/p>\n<p><a href=\"\/blog\/wp-ttn-blog\/uploads\/2015\/03\/STEP92.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-18674\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/03\/STEP92.png\" alt=\"STEP9\" width=\"609\" height=\"374\" \/><\/a><\/p>\n<p style=\"text-align: justify;color: #0000ff\">Give the template a Description ( as per your convenience).<br \/>\n* Do not select any resource as of now.<\/p>\n<p><a href=\"\/blog\/wp-ttn-blog\/uploads\/2015\/03\/STEP102.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-18675\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/03\/STEP102.png\" alt=\"STEP10\" width=\"940\" height=\"496\" \/><\/a><\/p>\n<p style=\"text-align: justify;color: #0000ff\">At first, it will ask you to select the VPC. So, all the related subnets, network interface &amp; security group will be automatically selected ( although we can customize it).<\/p>\n<p>1) VPC<br \/>\n<a href=\"\/blog\/wp-ttn-blog\/uploads\/2015\/03\/STEP122.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-18676\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/03\/STEP122.png\" alt=\"STEP12\" width=\"1120\" height=\"443\" \/><\/a><\/p>\n<p>Now just keep clicking on &#8220;Continue&#8221; button. CloudFormer takes care of the dependencies.<\/p>\n<p>In subsequent steps, it will ask you to select the following:<\/p>\n<p>2) VPC Network (VPC Subnets, Internet Gateways, Customer Gateways, DHCP options)<br \/>\n3) VPC Security (Network ACLs, Rote Tables)<br \/>\n4) Network (ELB, Elastic IP , Network Interfaces)<br \/>\n5) Compute (Auto Scaling Groups, EC2 Instances)<br \/>\n6) Storage (EBS Volumes, RDS Instances, DynamoDB Tables, S3 Buckets)<br \/>\n7) Services (SQS, SNS Topics, SimpleDB Domains)<br \/>\n8) Config (Auto Scaling Launch Configurations, RDS Subnet groups, RDS Parameter Groups)<br \/>\n9) Security (EC2 Security Groups, RDS Security Groups, SQS Queue Policies, SNS Tpic Policies, S3 Bucket Policies)<br \/>\n10)Optional Resources (AutoScaling Policies, CloudWatch Alarms)<\/p>\n<p style=\"text-align: justify;color: #0000ff\">At last, you will see a summary page with all your selected setting.<\/p>\n<p><a href=\"\/blog\/wp-ttn-blog\/uploads\/2015\/03\/STEP22a2.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-18687\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/03\/STEP22a2.png\" alt=\"STEP22a\" width=\"954\" height=\"768\" \/><\/a><\/p>\n<p style=\"text-align: justify;color: #0000ff\">CloudFront will display your template, click on &#8220;Save Template&#8221;.<\/p>\n<p><a href=\"\/blog\/wp-ttn-blog\/uploads\/2015\/03\/STEP232.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-18689\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/03\/STEP232.png\" alt=\"STEP23\" width=\"928\" height=\"605\" \/><\/a><\/p>\n<p style=\"text-align: justify;color: #0000ff\">On the next screen, select &#8220;Launch Stack&#8221;.<\/p>\n<p><a href=\"\/blog\/wp-ttn-blog\/uploads\/2015\/03\/STEP242.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-18690\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/03\/STEP242.png\" alt=\"STEP24\" width=\"918\" height=\"165\" \/><\/a><\/p>\n<p style=\"text-align: justify;color: #0000ff\">Now, just use the stack just created to launch the infrastructure.<\/p>\n<p><a href=\"\/blog\/wp-ttn-blog\/uploads\/2015\/03\/STEPS12.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-18710\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/03\/STEPS12.png\" alt=\"STEPS1\" width=\"1366\" height=\"768\" \/><\/a><\/p>\n<p style=\"text-align: justify;color: #0000ff\">Tag the instance for easy identification.<\/p>\n<p><a href=\"\/blog\/wp-ttn-blog\/uploads\/2015\/03\/STEPS22.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-18711\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/03\/STEPS22.png\" alt=\"STEPS2\" width=\"1366\" height=\"461\" \/><\/a><\/p>\n<p style=\"text-align: justify;color: #0000ff\">On the Review page, click on the &#8220;Create&#8221; button. You will see the following screen:<\/p>\n<p><a href=\"\/blog\/wp-ttn-blog\/uploads\/2015\/03\/Successn2.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-18713\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/03\/Successn2.png\" alt=\"Successn\" width=\"1366\" height=\"768\" \/><\/a><\/p>\n<p>Now, go to the EC2 Dashboard &amp; search for the created instance with the tag ( in our case, it was &#8220;instance from cloudformer&#8221;).<\/p>\n<p>Hope this was helpful.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>AWS CloudFormer is a template creation tool and it creates AWS CloudFormation template from our existing resources in AWS account. We can select any supported AWS resources that are running in our account, and CloudFormer creates a template in an Amazon S3 bucket. We will be using AWS CloudFormer to create template of existing infrastructure. [&hellip;]<\/p>\n","protected":false},"author":166,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":43},"categories":[1174,2348],"tags":[1735,1733,1734],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/18308"}],"collection":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/users\/166"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=18308"}],"version-history":[{"count":1,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/18308\/revisions"}],"predecessor-version":[{"id":53556,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/18308\/revisions\/53556"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=18308"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=18308"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=18308"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}