{"id":71,"date":"2018-06-10T02:54:55","date_gmt":"2018-06-09T18:54:55","guid":{"rendered":"http:\/\/cliffordjuan.com\/?p=71"},"modified":"2018-06-10T20:46:15","modified_gmt":"2018-06-10T12:46:15","slug":"working-with-aws-cloudformation-is-fun","status":"publish","type":"post","link":"https:\/\/cliffordjuan.com\/index.php\/2018\/06\/10\/working-with-aws-cloudformation-is-fun\/","title":{"rendered":"Working with AWS CloudFormation is FUN!!!"},"content":{"rendered":"<p>Working with CloudFormation to code your Infrastructure is fun and easy. Thanks to the visual designer that comes with the tool which work like most IDE (e.g. NetBeans, Eclipse) to develop a program.<\/p>\n<p>The designer has a drag and drop interface, i.e\u00a0<strong>canvas<\/strong>\u00a0and an <strong>editor<\/strong> (text) section. The latter has a Template tab and Components tab which is subdivided into Parameters, Mappings, Conditions, Metadata, and Outputs sections.<\/p>\n<p>The canvas has all the list of resource types you need and this helps you get more familiar with AWS and how they can be interrelated to other services.<\/p>\n<p>Likewise, the editor section also has an automatic suggestion of intrinsic functions and resource reference parameters for the field values in your template using the CTRL+Space key.<\/p>\n<p>Clueless how to start? Upload a sample template and reviewing it will help you u<span style=\"font-size: 1rem;\">nderstand and architect your infrastructure easier if you&#8217;re just starting to learn the tool.<\/span><\/p>\n<p>One style I do to learn coding (e.g. python) was to fork a code and deconstruct it. Thanks to AWS, they have bunch of sample templates to copy and deploy. The tool comes with built-in sample templates and some of which is linked\u00a0<a href=\"https:\/\/aws.amazon.com\/cloudformation\/aws-cloudformation-templates\/\" target=\"_blank\" rel=\"noopener\"><strong>here<\/strong><\/a>.<\/p>\n<p>Here&#8217;s a sample solution I copied from AWS list of template which is linked <strong><a href=\"https:\/\/docs.aws.amazon.com\/AWSCloudFormation\/latest\/UserGuide\/sample-templates-applications-us-west-2.html\" target=\"_blank\" rel=\"noopener\">here<\/a><\/strong>.<\/p>\n<p style=\"padding-left: 30px;\">* Template Name &#8211; WordPress scalable and durable.<\/p>\n<p style=\"padding-left: 30px;\">* Description: Installs and deploys WordPress on to Amazon EC2 instances in an Auto Scaling group with a multi-AZ Amazon RDS database instance for storage.<\/p>\n<p>With some modification &#8211; positioning of the resources, the stack will look like this:<\/p>\n<p><img loading=\"lazy\" class=\"alignnone wp-image-72 size-large\" src=\"http:\/\/cliffordjuan.com\/wp-content\/uploads\/2018\/06\/wordpress-MultiAZ-DesignerTemplateImage-1024x628.png\" alt=\"\" width=\"525\" height=\"322\" srcset=\"https:\/\/cliffordjuan.com\/wp-content\/uploads\/2018\/06\/wordpress-MultiAZ-DesignerTemplateImage-1024x628.png 1024w, https:\/\/cliffordjuan.com\/wp-content\/uploads\/2018\/06\/wordpress-MultiAZ-DesignerTemplateImage-300x184.png 300w, https:\/\/cliffordjuan.com\/wp-content\/uploads\/2018\/06\/wordpress-MultiAZ-DesignerTemplateImage-768x471.png 768w, https:\/\/cliffordjuan.com\/wp-content\/uploads\/2018\/06\/wordpress-MultiAZ-DesignerTemplateImage.png 1744w\" sizes=\"(max-width: 525px) 100vw, 525px\" \/><\/p>\n<p>The code which is in json format can be found <a href=\"https:\/\/s3-us-west-2.amazonaws.com\/cloudformation-templates-us-west-2\/WordPress_Multi_AZ.template\" target=\"_blank\" rel=\"noopener\"><strong>here<\/strong><\/a>.<\/p>\n<p>So, once template is validated, keyed-in parameter values (e.g. instance-type, database name, password), a summary is presented for you to review before hitting the create button.\u00a0 The stack should be completed in\u00a0 a few minutes.<\/p>\n<p>Aside from making template from scratch or samples, you can create a template of your existing infrastructure.\u00a0 You can use the CloudFormer tool to build it. This is like reverse engineering your Infrastructure. This means you can capture and redeploy applications you already have running.<\/p>\n<p>To do this, click Launch CloudFormer and create an AWS CloudFormation stack that runs the CloudFormer tool. After the stack creation is complete, navigate to the CloudFormer URL available on the Outputs tab.<\/p>\n<p>Finally, <a href=\"https:\/\/docs.aws.amazon.com\/AWSCloudFormation\/latest\/UserGuide\/best-practices.html\" target=\"_blank\" rel=\"noopener\"><strong>BEST PRACTICES<\/strong><\/a>\u00a0are recommended to help you use CloudFormation effectively and securely.<\/p>\n<p>Happy coding.<\/p>\n<div class=\"pcl_tooltip_box\" style=\"display: none;\">\n<p>Image already added<\/p>\n<div class=\"arrow border\"><\/div>\n<div class=\"arrow\"><\/div>\n<\/div>\n<div class=\"pcl_global_mask\" style=\"display: none;\"><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Working with CloudFormation to code your Infrastructure is fun and easy. Thanks to the visual designer that comes with the tool which work like most IDE (e.g. NetBeans, Eclipse) to develop a program. The designer has a drag and drop interface, i.e\u00a0canvas\u00a0and an editor (text) section. The latter has a Template tab and Components tab &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/cliffordjuan.com\/index.php\/2018\/06\/10\/working-with-aws-cloudformation-is-fun\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Working with AWS CloudFormation is FUN!!!&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[4],"tags":[7,5,6],"_links":{"self":[{"href":"https:\/\/cliffordjuan.com\/index.php\/wp-json\/wp\/v2\/posts\/71"}],"collection":[{"href":"https:\/\/cliffordjuan.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cliffordjuan.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cliffordjuan.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cliffordjuan.com\/index.php\/wp-json\/wp\/v2\/comments?post=71"}],"version-history":[{"count":14,"href":"https:\/\/cliffordjuan.com\/index.php\/wp-json\/wp\/v2\/posts\/71\/revisions"}],"predecessor-version":[{"id":87,"href":"https:\/\/cliffordjuan.com\/index.php\/wp-json\/wp\/v2\/posts\/71\/revisions\/87"}],"wp:attachment":[{"href":"https:\/\/cliffordjuan.com\/index.php\/wp-json\/wp\/v2\/media?parent=71"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cliffordjuan.com\/index.php\/wp-json\/wp\/v2\/categories?post=71"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cliffordjuan.com\/index.php\/wp-json\/wp\/v2\/tags?post=71"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}