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:
-
AMI specified in the template exist in a different region than the one in which the stack is provisioned.
-
Specifying an EC2 instance type that is not compatible with the AMI specified.
-
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
-
Each account is limited to a maximum of 200 stacks. Can contact AWS for any changes.
-
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:
-
Provide a unique name for the stack.
-
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.
-
Specify any parameters (if the template allows you to configure the deployment) or go with the defaults.
-
Click "Create": Start the deployment. You can see the current state of the deployment in the Console.
- heartin's blog
- Log in or register to post comments
Recent comments