liveBook · Manning

CloudFormation stack

As explained in Amazon Web Services in Action, Third Edition: An in-depth guide to AWS

A CloudFormation stack is a managed collection of AWS resources created and updated as a unit from a template.

A CloudFormation stack is the infrastructure created from a template. Think of the template as a reusable plan and the stack as one deployment of that plan: you can create multiple stacks from the same template. A stack groups the AWS resources needed for an application, from a single virtual machine to a forum with networking, a database, and a cache. section 4.5.2 section 11.4

To create a stack in the AWS Management Console:

  • Open CloudFormation, select Stacks, and choose Create Stack → With New Resources (Standard). section 4.5.2
  • Select a ready template, such as one supplied by an Amazon S3 URL. Give the stack a name and fill in its parameters; an EC2 example asks for an instance type, subnet, and VPC. section 4.5.2
  • Review the configuration and create the stack. Optional tags can help identify an application's resources or track a cost center. section 4.5.2 section 2.1

Deploying a forum

A Discourse template defines a VPC, security groups, a Redis cache, a PostgreSQL database, and an EC2 instance. Create a stack from that template with the AWS CLI, supplying an administrator email parameter and the named-IAM capability. Once creation finishes, read the instance's public IP address from the stack outputs and open the site in a browser. section 11.4 section 11.4.5

Wait for CREATE_COMPLETE before using a stack's outputs; a Redis example exposes an instance ID and cache address for testing. When an experiment is finished and its data is no longer needed, delete its stack through the console or AWS CLI. This removes the example infrastructure and stops charges for resources you no longer need. Keep a stack that later work still depends on. section 11.1.2 section 2.4 section 11.4.5

How Amazon Web Services in Action, Third Edition: An in-depth guide to AWS covers it

How deep it goes
Walks through console creation, parameters, outputs, and deletion, while deferring VPC and subnet details.
Examples
Uses a virtual-machine template, a WordPress deployment, Redis testing, and a Discourse forum stack.
What it assumes
Assumes access to an AWS account but postpones detailed knowledge of VPCs, subnets, and security groups.
What you can do after
Operate/configure it through the AWS console or CLI, read stack outputs, and delete experimental infrastructure.
How it connects
Connects CloudFormation templates and parameters to EC2, VPC, Redis, and PostgreSQL deployments.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Amazon Web Services in Action, Third Edition: An in-depth guide to AWS. The section links point to the parts of the book it draws on.