

# Amazon Backup and Amazon CloudFormation
<a name="integrate-cloudformation-with-aws-backup"></a>

## In general
<a name="aws-backup-cf-integration-general"></a>

With Amazon CloudFormation, you can provision and manage your Amazon resources in a safe, repeatable manner using templates that you create. You can use Amazon CloudFormation templates and StackSets to manage your backup plans, backup resource selections, and backup vaults. For information about using Amazon CloudFormation, see [How Does Amazon CloudFormation Work?](https://docs.amazonaws.cn/AWSCloudFormation/latest/UserGuide/cfn-whatis-howdoesitwork.html) in the *Amazon CloudFormation User Guide*.

Before you create your Amazon CloudFormation template or StackSet, consider the following:
+ Create separate templates for your backup plans and your backup vaults. You can only delete backup vaults that are empty. You can't delete a stack that includes backup vaults if they contain recovery points.
+ Verify you have a service role available before you create your stack. The Amazon Backup default service role is created for you the first time you assign resources to a backup plan. If you haven't assigned resources to your backup plan, do so before creating your stack. You can also specify a custom role that you create. For more information about roles, see [IAM service roles](iam-service-roles.md).

## Deploying a backup vault, backup plan, and resource assignment using Amazon CloudFormation
<a name="aws-backup-cf-integration-backup-end-to-end"></a>

For a sample Amazon CloudFormation template that deploys a backup vault, backup plans, and resource assignment, see [Assign Amazon Backup resources through Amazon CloudFormation](assigning-resources-cfn.md).

## Deploying backup plans using Amazon CloudFormation
<a name="aws-backup-cf-integration-backup-plans"></a>

For sample Amazon CloudFormation templates that deploy backup plans, see [Amazon CloudFormation templates for backup plans](plan-cfn.md).

## Deploying Amazon Backup Audit Manager frameworks and report plans using Amazon CloudFormation
<a name="aws-backup-cf-integration-bam"></a>

For sample Amazon CloudFormation templates that deploy Amazon Backup Audit Manager frameworks and report plans, see [Using Amazon Backup Audit Manager with Amazon CloudFormation](bam-cfn-integration.md).

## Deploying backup plans across accounts using Amazon CloudFormation
<a name="aws-backup-cf-integration-organizations"></a>

You can [ use Amazon CloudFormation StackSets across multiple accounts in an Amazon Organization](https://www.amazonaws.cn/blogs/aws/new-use-aws-cloudformation-stacksets-for-multiple-accounts-in-an-aws-organization/). Sample templates are available in the [Amazon CloudFormation User Guide](https://docs.amazonaws.cn/AWSCloudFormation/latest/UserGuide/stacksets-sampletemplates.html).

An excellent starting point and reference is the publication [Automate centralized backup at scale across Amazon services using Amazon Backup](https://www.amazonaws.cn/blogs/storage/automate-centralized-backup-at-scale-across-aws-services-using-aws-backup/). With Ibukun Oyewumi and Sabith Venkitachalapathy (Jul. 2021).

## Learning more about Amazon CloudFormation
<a name="aws-backup-cf-learn-more"></a>

For information about using Amazon CloudFormation with Amazon Backup, see [Amazon Backup Resource Type Reference](https://docs.amazonaws.cn/AWSCloudFormation/latest/UserGuide/AWS_Backup.html) in the *Amazon CloudFormation User Guide*.

For information about controlling access to Amazon service resources when using Amazon CloudFormation, see [Controlling Access with Amazon Identity and Access Management](https://docs.amazonaws.cn/AWSCloudFormation/latest/UserGuide/using-iam-template.html) in the *Amazon CloudFormation User Guide*.