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
