AWS CloudFormation Overview

CloudFormation gives an easy way to create a collection of related AWS resources and provision them in an orderly and predictable way. CloudFormation automates and simplifies the task of repeatedly and predictably creating groups of related resources.

In addition to the supported CloudFormation resource types, CloudFormation custom resources enable management of additional AWS and non-AWS resources. Can write custom provisioning logic in templates that are run anytime you create, update (if you changed the custom resource), or delete stacks.

 

CloudFormation Template vs. Stack

CloudFormation template is a JSON or YAML-format text-based file that describes all the AWS resources you need to deploy to run your application. Can either create them from scratch or reuse a template or sample and modify it. You can also visualize your templates as diagrams and edit them using a drag-and-drop interface with the AWS CloudFormation Designer.

The stack is the set of AWS resources that are created and managed as a single unit when AWS CloudFormation instantiates a template.

 

Stack Creation, Maintenance, Updating and Deleting

Can access CloudFormation through the Management Console, which gives you a point-and-click, web-based interface to deploy and manage stacks. Templates needs to be created first, which can be done from scratch or from another template.

We can still manage individual stack resources with full control after the stack creation. Will have access to the EC2 instance, or Auto Scaling Launch Configuration user-data fields etc. Can continue using all existing AWS and third-party tools to manage your AWS resources.

You can also use CloudFormation to modify and update the resources in your existing stacks in a controlled and predictable way. By using templates to manage your stack changes, you have the ability to apply version control to your AWS infrastructure similar to code.

CloudFormation allows you to define deletion policies for resources. You can specify that snapshots be created for EBS volumes or RDS database instances before they are deleted. You can also specify that a resource should be preserved and not deleted (e.g. S3 buckets) when the stack is deleted.

 

Cloud Formation vs. Beanstalk

Cloud Formation vs. Beanstalk are designed to complement each other.

Beanstalk provides an environment to easily deploy and run applications in the cloud. It is integrated with developer tools and provides a one-stop experience for you to manage the lifecycle of your applications.

CloudFormation is a provisioning mechanism for a broad range of AWS resources. It supports the infrastructure needs of many different types of applications.

CloudFormation supports Elastic Beanstalk application environments as one of the AWS resource types. This allows you, for example, to create and manage an AWS Elastic Beanstalk–hosted application along with an RDS database or, any other supported AWS resource.

 

CloudFormation Pricing

There is no additional charge for AWS CloudFormation. You only pay for the AWS resources that are created.

Even resources that were created and rolled back will be charged.

 

Cloud Formation Stack States

Valid StackStatus values are: CREATE_IN_PROGRESS, CREATE_FAILED, CREATE_COMPLETE, ROLLBACK_IN_PROGRESS, ROLLBACK_FAILED, ROLLBACK_COMPLETE, DELETE_IN_PROGRESS, DELETE_FAILED, DELETE_COMPLETE, UPDATE_IN_PROGRESS, UPDATE_COMPLETE_CLEANUP_IN_PROGRESS, UPDATE_COMPLETE, UPDATE_ROLLBACK_IN_PROGRESS, UPDATE_ROLLBACK_FAILED, UPDATE_ROLLBACK_COMPLETE_CLEANUP_IN_PROGRESS, UPDATE_ROLLBACK_COMPLETE, REVIEW_IN_PROGRESS.

Read more about the stack here.

Rollback

If Cloud Formation encounters an error, by default, it will terminate and rollback all resources created. This can be changed while creating the stack.

Following activities will result in rollback of the stack:

  1. AMI specified in the template exist in a different region than the one in which the stack is provisioned.

  2. Specifying an EC2 instance type that is not compatible with the AMI specified.

  3. Subnet specified in the template does not exist. 

Note: Invalid JSON syntax in template will cause an error message during template validation. Since the stack will never start creating, there is no rollback as there is nothing to roll back.

 

Limits and Restrictions

  1. Each account is limited to a maximum of 200 stacks. Can contact AWS for any changes.

  2. There are no limits to the number of templates.

References (Deprecated): 

Supported AWS Services

Currently supported services are available here.

 

Geting started with AWS CloudFormation

Can access AWS CloudFormation through the Management Console, which gives you a point-and-click, web-based interface to deploy and manage stacks. You can create a new stack from inside the AWS Management Console in a few simple steps:

  1. Provide a unique name for the stack.

  2. Select a template from your local file system or from a Amazon S3 URL. This may be one of the sample templates, your own custom template, or a template you got from a third party.

  3. Specify any parameters (if the template allows you to configure the deployment) or go with the defaults.

  4. Click "Create": Start the deployment. You can see the current state of the deployment in the Console.

Learn Serverless from Serverless Programming Cookbook

Contact

Please first use the contact form or facebook page messaging to connect.

Offline Contact
We currently connect locally for discussions and sessions at Bangalore, India. Please follow us on our facebook page for details.
WhatsApp (Primary): (+91) 7411174113
Phone (Escalations): (+91) 7411174114

Business newsletter

Complete the form below, and we'll send you an e-mail every now and again with all the latest news.

About

CloudMaterials is my blog to share notes and learning materials on Cloud and Data Analytics. My current focus is on Microsoft Azure and Amazon Web Services (AWS).

I like to write and I try to document what I learn to share with others. I believe that knowledge is useless unless you share it; the more you share, the more you learn.

Recent comments

Photo Stream