

# Using Amazon ECS with Amazon CloudFormation
<a name="ecs-with-cloudformation"></a>

Amazon ECS is integrated with Amazon CloudFormation, a service that you can use to model and set up Amazon resources with templates that you define. Amazon CloudFormation uses **templates** that are either a `YAML` or `JSON` formatted text file. Templates are like blueprints for the Amazon resource you want to create. When you create and submit a template, Amazon CloudFormation creates a **stack**. You manage the resources you defined in your template through the stack. When you want to create, update, or delete a resource, you create, update, or delete the stack that was created from that resource. When it comes to updating your stacks, you need to create a **change set** first. Change sets show you what is impacted by the change before you make it. This keeps you from deleting databases accidently by changing your database name, for example. For more information on templates, stacks, and change sets, see [How Amazon CloudFormation works](https://docs.amazonaws.cn/AWSCloudFormation/latest/UserGuide/cloudformation-overview.html#cfn-concepts-stacks) in the *Amazon CloudFormation User Guide*.

By using Amazon CloudFormation, you can spend less time creating and managing your resources and infrastructure. You can create a template that describes all the Amazon resources that you want, such as Amazon ECS clusters, task definitions, services. Then, Amazon CloudFormation takes care of provisioning and configuring those resources for you. 

Amazon CloudFormation also allows you to reuse your template to set up your Amazon ECS resources in a consistent and repeatable manner. You describe your resources one time and then provision the same resources again across multiple Amazon Web Services accounts and Amazon Web Services Regions.

Amazon CloudFormation templates can be used with both the Amazon Web Services Management Console or the Amazon Command Line Interface to create resources.

To learn more about Amazon CloudFormation, see the following resources:
+ [Amazon CloudFormation](https://www.amazonaws.cn/cloudformation/)
+ [Amazon CloudFormation User Guide](https://docs.amazonaws.cn/AWSCloudFormation/latest/UserGuide/Welcome.html)
+ [Amazon CloudFormation Command Line Interface User Guide](https://docs.amazonaws.cn/cloudformation-cli/latest/userguide/what-is-cloudformation-cli.html)

**Topics**
+ [Creating Amazon ECS resources using the Amazon CloudFormation console](ecs-cloudformation-console.md)
+ [Creating Amazon ECS resources using Amazon CLI commands for Amazon CloudFormation](ecs-cloudformation-cli.md)
+ [Amazon CloudFormation example templates for Amazon ECS](working-with-templates.md)