{"id":2128,"date":"2019-08-22T07:27:13","date_gmt":"2019-08-22T07:27:13","guid":{"rendered":"https:\/\/www.testpreptraining.com\/tutorial\/?page_id=2128"},"modified":"2020-05-02T07:35:23","modified_gmt":"2020-05-02T07:35:23","slug":"cloudformation-stacks","status":"publish","type":"page","link":"https:\/\/www.testpreptraining.ai\/tutorial\/aws-devops-engineer\/cloudformation-stacks\/","title":{"rendered":"CloudFormation Stacks"},"content":{"rendered":"\n<ul class=\"wp-block-list\"><li>In CloudFormation, manage related resources as a single unit called a stack. <\/li><li>create, update, and delete a collection of resources by <ul><li>creating<\/li><\/ul><ul><li>updating<\/li><\/ul><ul><li>and deleting stacks. <\/li><\/ul><\/li><li>Resources in stack are defined by the stack&#8217;s AWS CloudFormation template. <\/li><li>Creating Stack &#8211; Stack Name, region cannot be changed, VPC (instances need internet access to communicate with OpsWorks Orchestration Engine),<\/li><li>Subnet can be changed, OS cannot be changed (windows\/linux), SSH keys, Custom Cookbooks for Git, Advanced options (not changed mostly, <\/li><li>can be changed later)<\/li><li>Stack Options:<ul><li>Resources tab &#8211; allows registration of exisiting resource with stack(EIPs, Volumes, RDS)<\/li><\/ul><ul><li>Layers &#8211; logical group of instances share common config elements; Ex: General settings, Auto healing enabled switch; Recipes tab can add recipes<\/li><\/ul><ul><li>Network &#8211; allows ELB, associate EIPs; EBS Voumes &#8211; allow EBS optimized instances; Security &#8211; allows to select instance profiles\/SGs<\/li><\/ul><ul><li>Layer Types: OpsWorks Layer, ECS, RDS<\/li><\/ul><\/li><li>An RDS instance can only be associated with one opsworks stack.<\/li><li>A stack clone operation doesn\u2019t copy an existing RDS instance.<\/li><li> work with stacks by using AWS CloudFormation console, API, or AWS CLI.  <\/li><\/ul>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"266\" height=\"226\" src=\"https:\/\/www.testpreptraining.ai\/tutorial\/wp-content\/uploads\/2019\/08\/image019-1.png\" alt=\"\" class=\"wp-image-2129\"\/><\/figure><\/div>\n\n\n\n<p>Stack Creation Depends\nOn:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Template Upload\/S3 Template reference<\/li><li>Template Syntax Check<\/li><li>Stack Name &amp; verification &amp; ingestion<\/li><li>CFN template processing &amp; stack creation<\/li><li>Resource ordering<\/li><li>Resource creation<\/li><li>Output Generation<\/li><li>Stack completion or Rollback<\/li><li>DependsOn &#8211; influences automatic dependency\nchecking of CFN; directs CFN how to handle dependencies;<\/li><\/ul>\n\n\n\n<p><strong>CFN Nesting<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>to allow huge set of infra to be split over multiple\ntemplates, 460k template size limit for S3, 200 resource limit per template,<\/li><li>100 mapping, 60 parameters, 60 outputs limit per\nstack\/template, nesting can overcome these limits.<\/li><li>resource type &#8211; AWS::CloudFormation::Stack<\/li><\/ul>\n\n\n\n<p><strong>CFN Creation Policies, Wait Conditions &amp; Wait Condition Handlers:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Influence when a resource is marked as competed\n&#8211; delaying until its actually ready.<\/li><li>Creation Policies &#8211; only be used on EC2 instance\nand ASG. Creation Policy Definition &amp; Signal Configuration<\/li><li>WC &amp; WCH can be used in complex scenarios\ninvolving complex interaction between resources; two related components;<\/li><li>WCH is a CFN resource with no properties, but it\ngenerated signed URL which can be used to communicate SUCCESS or FAILURE.<\/li><li>WC &#8211; 4 components 1) they DependOn the resources\nwaiting on 2) a Handle property reference 3) response timeout 4) count (default\n1)<\/li><li>WCH &#8211; Signed URL<\/li><\/ul>\n\n\n\n<p><strong>CFN Custom Resources<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>resource type within CFN that is backed by SNS\nor Lambda; Custom::ResourceName(SNSTopic or Lambda Function); ServiceToken &#8211;\narn for SNS topic<\/li><li>Use the presigned URL; provide a response\npayload; Important elements: status, stack id &amp; request id, physical &amp;\nlogical resource id, data<\/li><li>Use cases: stack linked to on-premise resource\ncreation, stack linked to advanced logic &#8211; resource discovery, stack deletion\nlinke to <\/li><li>advanced tidy operations &#8211; backup\/montioring\ndeactivation, stacks linked to on-premise CMS, web stack creation &#8211; linked to\nmonitoring\/penetration<\/li><li>testing system, stack creation\/deletion updates\na lambda based backup solution &#8211; EBS snapshotting, Stack deletion spawns\naccount wide pruning for orphaned EBS volumes.<\/li><\/ul>\n\n\n\n<p><strong>Using CloudFormation Console<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>The CloudFormation console URL is &#8211; https:\/\/console.aws.amazon.com\/cloudformation\/.<\/li><li>Creating a stack using the AWS CloudFormation console, is wizard-driven process with steps<ul><li>Starting the Create Stack wizard<\/li><\/ul><ul><li>Selecting a stack template<\/li><\/ul><ul><li>Specifying stack parameters<\/li><\/ul><ul><li>Setting AWS CloudFormation Stack Options<\/li><\/ul><ul><li>Reviewing stack<\/li><\/ul><\/li><li>After stack creation, <ul><li>monitor the stack&#8217;s progress<\/li><\/ul><ul><li>view the stack&#8217;s resources and outputs<\/li><\/ul><ul><li>update the stack<\/li><\/ul><ul><li>delete it<\/li><\/ul><\/li><li>Amazon EC2 key pair for authentication is needed for access<\/li><li>No additional charge for AWS CloudFormation<\/li><li>AWS Management Console can also list stack&#8217;s data and resources like<ul><li>stack name, stack ID, and root stack<\/li><\/ul><ul><li>tags associated with stack<\/li><\/ul><ul><li>resources part of stack<\/li><\/ul><ul><li>stack&#8217;s parameters and their values<\/li><\/ul><\/li><li>Stack Status Codes lists the status of stack like<ul><li>CREATE_COMPLETE &#8211; Successful creation of one or more stacks<\/li><\/ul><ul><li>CREATE_IN_PROGRESS &#8211; Ongoing creation of one or more stacks.<\/li><\/ul><ul><li>CREATE_FAILED &#8211; Unsuccessful creation of one or more stacks.<\/li><\/ul><\/li><\/ul>\n\n\n\n<p><strong>Using AWS CLI for CloudFormation Templates<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>To create a stack you run \u201caws cloudformation\ncreate-stack\u201d command and must list stack name, location of template, and input\nparameters.<\/li><li>For information about CloudFormation stacks &#8211; aws\ncloudformation list-stacks and aws cloudformation describe-stacks.<\/li><li>To delete a stack, you run the aws\ncloudformation delete-stack command.<\/li><\/ul>\n\n\n\n<p><strong>Nested Stacks<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>They are stacks created as part of other stacks.<\/li><li>Needs the AWS::CloudFormation::Stack resource for creating nested stack<\/li><li>Example<ul><li>Stack A is the root stack for all the other, nested, stacks in the hierarchy.<\/li><\/ul><ul><li>For stack B, stack A is both the parent stack, as well as the root stack.<\/li><\/ul><ul><li>For stack D, stack C is the parent stack; while for stack C, stack B is the parent stack.<\/li><\/ul><\/li><\/ul>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"236\" height=\"400\" src=\"https:\/\/www.testpreptraining.ai\/tutorial\/wp-content\/uploads\/2019\/08\/image020-1-236x400.png\" alt=\"\" class=\"wp-image-2130\" srcset=\"https:\/\/www.testpreptraining.ai\/tutorial\/wp-content\/uploads\/2019\/08\/image020-1-236x400.png 236w, https:\/\/www.testpreptraining.ai\/tutorial\/wp-content\/uploads\/2019\/08\/image020-1.png 254w\" sizes=\"auto, (max-width: 236px) 100vw, 236px\" \/><\/figure><\/div>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In CloudFormation, manage related resources as a single unit called a stack. create, update, and delete a collection of resources by creating updating and deleting stacks. Resources in stack are defined by the stack&#8217;s AWS CloudFormation template. Creating Stack &#8211; Stack Name, region cannot be changed, VPC (instances need internet access to communicate with OpsWorks&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":2084,"menu_order":11,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_acf_changed":false,"footnotes":""},"categories":[2],"tags":[7,386,383,372,380],"class_list":["post-2128","page","type-page","status-publish","hentry","category-amazon-aws","tag-aws","tag-cloudformation-stacks","tag-containers","tag-devops","tag-devops-engineer"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>CloudFormation Stacks - Testprep Training Tutorials<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.testpreptraining.ai\/tutorial\/aws-devops-engineer\/cloudformation-stacks\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"CloudFormation Stacks - Testprep Training Tutorials\" \/>\n<meta property=\"og:description\" content=\"In CloudFormation, manage related resources as a single unit called a stack. create, update, and delete a collection of resources by creating updating and deleting stacks. Resources in stack are defined by the stack&#8217;s AWS CloudFormation template. Creating Stack &#8211; Stack Name, region cannot be changed, VPC (instances need internet access to communicate with OpsWorks...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.testpreptraining.ai\/tutorial\/aws-devops-engineer\/cloudformation-stacks\/\" \/>\n<meta property=\"og:site_name\" content=\"Testprep Training Tutorials\" \/>\n<meta property=\"article:modified_time\" content=\"2020-05-02T07:35:23+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.testpreptraining.ai\/tutorial\/wp-content\/uploads\/2019\/08\/image019-1.png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.testpreptraining.ai\/tutorial\/aws-devops-engineer\/cloudformation-stacks\/\",\"url\":\"https:\/\/www.testpreptraining.ai\/tutorial\/aws-devops-engineer\/cloudformation-stacks\/\",\"name\":\"CloudFormation Stacks - Testprep Training Tutorials\",\"isPartOf\":{\"@id\":\"https:\/\/www.testpreptraining.ai\/tutorial\/#website\"},\"datePublished\":\"2019-08-22T07:27:13+00:00\",\"dateModified\":\"2020-05-02T07:35:23+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.testpreptraining.ai\/tutorial\/aws-devops-engineer\/cloudformation-stacks\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.testpreptraining.ai\/tutorial\/aws-devops-engineer\/cloudformation-stacks\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.testpreptraining.ai\/tutorial\/aws-devops-engineer\/cloudformation-stacks\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.testpreptraining.ai\/tutorial\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"AWS Certified DevOps Engineer Professional\",\"item\":\"https:\/\/www.testpreptraining.ai\/tutorial\/aws-devops-engineer\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"CloudFormation Stacks\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.testpreptraining.ai\/tutorial\/#website\",\"url\":\"https:\/\/www.testpreptraining.ai\/tutorial\/\",\"name\":\"Testprep Training Tutorials\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/www.testpreptraining.ai\/tutorial\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.testpreptraining.ai\/tutorial\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.testpreptraining.ai\/tutorial\/#organization\",\"name\":\"Testprep Training\",\"url\":\"https:\/\/www.testpreptraining.ai\/tutorial\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.testpreptraining.ai\/tutorial\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.testpreptraining.com\/tutorial\/wp-content\/uploads\/2020\/07\/tpt-logo-6.png\",\"contentUrl\":\"https:\/\/www.testpreptraining.com\/tutorial\/wp-content\/uploads\/2020\/07\/tpt-logo-6.png\",\"width\":583,\"height\":153,\"caption\":\"Testprep Training\"},\"image\":{\"@id\":\"https:\/\/www.testpreptraining.ai\/tutorial\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"CloudFormation Stacks - Testprep Training Tutorials","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.testpreptraining.ai\/tutorial\/aws-devops-engineer\/cloudformation-stacks\/","og_locale":"en_US","og_type":"article","og_title":"CloudFormation Stacks - Testprep Training Tutorials","og_description":"In CloudFormation, manage related resources as a single unit called a stack. create, update, and delete a collection of resources by creating updating and deleting stacks. Resources in stack are defined by the stack&#8217;s AWS CloudFormation template. Creating Stack &#8211; Stack Name, region cannot be changed, VPC (instances need internet access to communicate with OpsWorks...","og_url":"https:\/\/www.testpreptraining.ai\/tutorial\/aws-devops-engineer\/cloudformation-stacks\/","og_site_name":"Testprep Training Tutorials","article_modified_time":"2020-05-02T07:35:23+00:00","og_image":[{"url":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-content\/uploads\/2019\/08\/image019-1.png"}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.testpreptraining.ai\/tutorial\/aws-devops-engineer\/cloudformation-stacks\/","url":"https:\/\/www.testpreptraining.ai\/tutorial\/aws-devops-engineer\/cloudformation-stacks\/","name":"CloudFormation Stacks - Testprep Training Tutorials","isPartOf":{"@id":"https:\/\/www.testpreptraining.ai\/tutorial\/#website"},"datePublished":"2019-08-22T07:27:13+00:00","dateModified":"2020-05-02T07:35:23+00:00","breadcrumb":{"@id":"https:\/\/www.testpreptraining.ai\/tutorial\/aws-devops-engineer\/cloudformation-stacks\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.testpreptraining.ai\/tutorial\/aws-devops-engineer\/cloudformation-stacks\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.testpreptraining.ai\/tutorial\/aws-devops-engineer\/cloudformation-stacks\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.testpreptraining.ai\/tutorial\/"},{"@type":"ListItem","position":2,"name":"AWS Certified DevOps Engineer Professional","item":"https:\/\/www.testpreptraining.ai\/tutorial\/aws-devops-engineer\/"},{"@type":"ListItem","position":3,"name":"CloudFormation Stacks"}]},{"@type":"WebSite","@id":"https:\/\/www.testpreptraining.ai\/tutorial\/#website","url":"https:\/\/www.testpreptraining.ai\/tutorial\/","name":"Testprep Training Tutorials","description":"","publisher":{"@id":"https:\/\/www.testpreptraining.ai\/tutorial\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.testpreptraining.ai\/tutorial\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.testpreptraining.ai\/tutorial\/#organization","name":"Testprep Training","url":"https:\/\/www.testpreptraining.ai\/tutorial\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.testpreptraining.ai\/tutorial\/#\/schema\/logo\/image\/","url":"https:\/\/www.testpreptraining.com\/tutorial\/wp-content\/uploads\/2020\/07\/tpt-logo-6.png","contentUrl":"https:\/\/www.testpreptraining.com\/tutorial\/wp-content\/uploads\/2020\/07\/tpt-logo-6.png","width":583,"height":153,"caption":"Testprep Training"},"image":{"@id":"https:\/\/www.testpreptraining.ai\/tutorial\/#\/schema\/logo\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/pages\/2128","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/comments?post=2128"}],"version-history":[{"count":4,"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/pages\/2128\/revisions"}],"predecessor-version":[{"id":5272,"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/pages\/2128\/revisions\/5272"}],"up":[{"embeddable":true,"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/pages\/2084"}],"wp:attachment":[{"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/media?parent=2128"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/categories?post=2128"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/tags?post=2128"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}