

# Amazon CloudFormation templates for CodeDeploy reference
<a name="reference-cloudformation-templates"></a>

This section introduces the Amazon CloudFormation resources, transform, and hook designed to work with CodeDeploy deployments. For a walkthrough of creating a stack update managed by the Amazon CloudFormation hook for CodeDeploy, see [Create an Amazon ECS blue/green deployment through Amazon CloudFormation](deployments-create-ecs-cfn.md)

**Note**  
Amazon CloudFormation hooks are part of the Amazon CloudFormation components for Amazon and are different from CodeDeploy lifecycle event hooks.

In addition to the other methods available to you in CodeDeploy, you can use Amazon CloudFormation templates to perform the following tasks:
+ Create applications.
+ Create deployment groups and specify a target revision.
+ Create deployment configurations.
+ Create Amazon EC2 instances.

Amazon CloudFormation is a service that helps you model and set up your Amazon resources using templates. An Amazon CloudFormation template is a text file whose format complies with the JSON standard. You create a template that describes all of the Amazon resources you want, and Amazon CloudFormation takes care of provisioning and configuring those resources for you.

For more information, see [What is Amazon CloudFormation?](https://docs.amazonaws.cn/AWSCloudFormation/latest/UserGuide/Welcome.html) and [Working with Amazon CloudFormation templates](https://docs.amazonaws.cn/AWSCloudFormation/latest/UserGuide/template-guide.html) in *Amazon CloudFormation User Guide*. 

If you plan to use Amazon CloudFormation templates that are compatible with CodeDeploy in your organization, as an administrator, you must grant access to Amazon CloudFormation and to the Amazon services and actions on which Amazon CloudFormation depends. To grant permissions to create applications, deployment groups, and deployment configurations, add the following policy to the permission set of the users who will work with Amazon CloudFormation: 

------
#### [ JSON ]

****  

```
{
  "Version":"2012-10-17",		 	 	 
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [                
        "cloudformation:*"        
      ],
      "Resource": "*"
    }
  ]
}
```

------

For more information about policies, see the following topics:
+ To view the policy that must be added to the permission set of users who will create Amazon EC2 instances, see [Create an Amazon EC2 instance for CodeDeploy (Amazon CloudFormation template)](instances-ec2-create-cloudformation-template.md).
+ For information about adding policies to permission sets, see [Create a permission set](https://docs.amazonaws.cn/singlesignon/latest/userguide/howtocreatepermissionset.html) in the *IAM User Guide*. 
+ To learn how to restrict users to a limited set of CodeDeploy actions and resources, see [Amazon managed (predefined) policies for CodeDeploy](managed-policies.md).

The following table shows the actions an Amazon CloudFormation template can perform on your behalf and includes links to more information about the Amazon resource types and their property types you can add to an Amazon CloudFormation template. 

[\[See the AWS documentation website for more details\]](http://docs.amazonaws.cn/en_us/codedeploy/latest/userguide/reference-cloudformation-templates.html)