Creating a backup plan
You can create a backup plan using the AWS Backup console, API, CLI, SDK, or an AWS CloudFormation template.
Topics
Creating backup plans using the AWS Backup console
AWS Backup provides different ways to get started using the AWS Backup console:
-
Start from an existing plan — You can create a new backup plan based on the configurations in an existing plan. Existing plans provided by AWS Backup are based on best practices and common backup policy configurations. When you select an existing backup plan to start from, the configurations from that backup plan are automatically populated for your new backup plan. You can then change any of these configurations according to your backup requirements.
For step-by-step instructions, see Step 1: Create a backup plan based on an existing one in the Getting Started section.
-
Build a new plan from scratch — You can create a new backup plan by specifying each of the backup configuration details described in the following sections. You can choose from the recommended default configurations.
If you try to create a backup plan that is identical to an existing plan, you get an
AlreadyExistsException
error.
Creating backup plans using a JSON document and the AWS Backup CLI
You can also define your backup plan in a JSON document and provide it using the AWS Backup console or AWS CLI. The following JSON document contains a sample backup plan that creates a daily backup at 1:00 Pacific time (the local time adjusts to the timezone’s daylight, standard, or summer time conditions if applicable). It automatically deletes a backup after retaining it for one year. For more information about customization, see Cron Expressions in the Amazon CloudWatch Events User Guide. For more information on timezones, see the TimeZone page in the Amazon Location Service API reference.
{ "BackupPlan":{ "BackupPlanName":"
test-plan
", "Rules":[ { "RuleName":"test-rule
", "TargetBackupVaultName":"test-vault
", "ScheduleExpression":"cron(0 1 ? * * *)", "ScheduleExpressionTimezone": "America/Los_Angeles", "StartWindowMinutes":"480", "CompletionWindowMinutes":"10080", "Lifecycle":{ "DeleteAfterDays":365 } } ] } }
You can store your JSON document with a name you choose. The following CLI command shows
create-backup-plan
test-backup-plan.json
:
aws backup create-backup-plan --cli-input-json file:///
PATH-TO-FILE
/test-backup-plan
.json
Backup plan options and configuration
When you define a backup plan in the AWS Backup console, you configure the following options:
Backup plan name
You must provide a unique backup plan name.
If you choose name that is identical to the name of an existing plan, you will receive an error message.
Backup rules
Backup plans are composed of one or more backup rules. To add backup rules to a backup plan, or to edit existing rules in a backup plan:
-
From the AWS Backup console, in the left navigation pane, choose Backup plans.
-
Under Backup plan name, select a backup plan.
-
Under the Backup rules section:
-
To add a backup rule, choose Add backup rule.
-
To edit an existing backup rule, select a rule, then choose Edit.
-
Note
If you have a backup plan with multiple rules if the time frame of the two rules overlap, AWS Backup optimizes the backup and takes a backup for the rule with the longer retention time. The optimization takes into account the full start window, not just when the daily backup is taken.
Each backup rule consists of the following elements.
Backup rule name
Backup rule names are case sensitive. They must contain from 1 to 50 alphanumeric characters or hyphens.
Backup frequency
The backup frequency determines how often AWS Backup creates a snapshot backup. Using the console, you can choose a frequency of every hour, 12 hours, daily, weekly, or monthly. You can also create a cron expression that creates snapshot backups as frequently as hourly. Using the AWS Backup CLI, you can schedule snapshot backups as frequently as hourly.
If you select weekly, you can specify which days of the week you want backups to be taken. If you select monthly, you can choose a specific day of the month.
You can also check the Enable continuous backups for supported resources checkbox to create a point-in-time restore (PITR)-enabled continuous backup rule. Unlike snapshot backups, continuous backups allow you to perform point-in-time restore. To learn more about continuous backups, see Point-in-Time Recovery.
Backup window
Backup windows consist of the time that the backup window begins and the duration of the window in hours. Backup jobs are started within this window. The default settings in the console are:
-
1:00 AM local to your system’s timezone (1:00 in 24-hour systems)
Start within 8 hours
Complete within 7 days
You can customize the backup frequency and backup window start time using a cron
expression. To see the six fields of AWS cron expressions, see Cron
Expressions in
the Amazon CloudWatch Events User Guide. Two examples of AWS cron expressions are
15 * ? * * *
(take a backup every hour at 15 minutes past the hour) and
0 12 * * ? *
(take a backup every day at 12 noon UTC). For a table of
examples, click the preceding link and scroll down the page.
AWS Backup evaluates cron expressions between 00:00 and 23:59. If you create a backup rule for "every 12 hours" but provide a start time of later than 11:59, it will only run once per day.
Note
In general, AWS database services cannot start backups 1 hour before or during their maintenance window and Amazon FSx cannot start backups 4 hours before or during their maintenance window or automatic backup window (Amazon Aurora is exempt from this maintenance window restriction). Snapshot backups scheduled during those times will fail.
An exception occurs when you opt in to using AWS Backup for both snapshot and continuous backups for a supported service. AWS Backup will schedule backup windows automatically to avoid conflicts. See Point-in-Time Recovery for a list of supported services and instructions on how to use AWS Backup to take continuous backups.
Overlapping backup rules
On occasion, a backup plan might contain multiple, overlapping rules. When the start windows of different rules overlap, AWS Backup retains the backup under the rule with the longer retention period. For example, consider a backup plan with two rules:
-
Backup hourly, with a 1-hour start window, and retain for 1 day.
-
Backup every 12 hours, with an 8-hour start window, and retain for 1 week.
After 24 hours, the second rule creates two backups (because it has the longer retention period). The first rule creates eight backups (because the second rule's 8-hour start window prevented more hourly backups from running). Specifically:
During this Start Window | This Rule Creates 1 Backup |
---|---|
Midnight to 8AM | 12 hours |
8 to 9 | Hourly |
9 to 10 | Hourly |
10 to 11 | Hourly |
11 to Noon | Hourly |
Noon to 8PM | 12 hours |
8 to 9 | Hourly |
9 to 10 | Hourly |
10 to 11 | Hourly |
11 to Midnight | Hourly |
During the start window, the backup job status remains in CREATED
status until it
has successfully begun or until the start window time has run out. If within the start
window time AWS Backup receives an error that allows the job to be retried,
AWS Backup will automatically retry to begin the job at least every 10 minutes
until the backup
successfully begins (the job status changes to RUNNING
) or until the job status
changes to EXPIRED
(which is expected to occur when the start window time is over).
Lifecycle
The lifecycle defines when a backup is transitioned to cold storage and when it expires. AWS Backup transitions and expires backups automatically according to the lifecycle that you define.
AWS Backup lifecycles data (that is, transitions data from warm to cold storage) that is no longer referenced by warm backups. Data in cold backups that is only referenced by other cold backups are billed at cold storage tier prices. Others continue at warm storage tier pricing.
You can specify how long AWS Backup should store your backups. In order to save you storage costs, AWS Backup automatically deletes your backups at the end of this period. The retention period for snapshots can range between 1 day and 100 years (or indefinitely if you don't enter one), while the retention period for continuous backups can range from 1 day to 35 days.
If you want your backups to be incremental, you must have at least one warm backup. Because each backup to cold storage is a full backup, AWS Backup recommends that you set your lifecycle settings to not move your backup to cold storage until after at least 8 days.
If you set your lifecycle to back up to cold storage after 1 day, each of those backups will be a full backup. This might be less cost effective than a less regular transfer to cold storage.
Backups that are transitioned to cold storage must be stored in cold storage for a minimum of 90 days. Therefore, on the console, the “retention” setting must be 90 days longer than the “transition to cold after days” setting. You can't change the “transition to cold after days” setting after a backup has been transitioned to cold.
Note
-
To see the list of resources that you can transition to cold storage, see the "Lifecycle to cold storage" section of the Feature availability by resource table. The cold storage expression is ignored for other resources.
-
When backups reach the end of their lifecycle and are marked for deletion as part of your lifecycle policy, AWS Backup deletes the backups at a randomly chosen point over the following 8 hours. This 8-hour window helps ensure consistent performance for deletion.
Backup vault
A backup vault is a container to organize your backups in. Backups created by a backup rule are organized in the backup vault that you specify in the backup rule. You can use backup vaults to set the AWS Key Management Service (AWS KMS) encryption key that is used to encrypt backups in the backup vault and to control access to the backups in the backup vault. You can also add tags to backup vaults to help you organize them. If you don't want to use the default vault, you can create your own. For step-by-step instructions for creating a backup vault, see Step 3: Create a backup vault.
Copy to Regions
As part of your backup plan, you can optionally create a backup copy in another AWS Region. For more information about backup copies, see Creating backup copies across AWS Regions.
When you define a backup copy, you configure the following options:
Destination Region
The destination Region for the backup copy.
(Advanced Settings) Backup vault
The destination backup vault for the copy.
(Advanced Settings) IAM Role
The IAM role that AWS Backup uses when creating the copy. The role must also have AWS Backup listed as a trusted entity, which enables AWS Backup to assume the role. If you choose Default and the AWS Backup default role is not present in your account, a role is created for you with the correct permissions.
(Advanced Settings) Lifecycle
Specifies when to transition the backup copy to cold storage and when to expire (delete) the copy. Backups transitioned to cold storage must be stored in cold storage for a minimum of 90 days. You can't change this value after a copy has transitioned to cold storage.
Expire specifies the number of days after creation that the copy is deleted. This must be greater than 90 days beyond the Transition to cold storage value.
Tags added to recovery points
The tags that you list here are automatically added to backups when they are created.
Tags added to backup plans
These tags are associated with the backup plan itself to help you organize and track your backup plan.
Advanced backup settings
Enables application consistent backups for third-party applications that are running on Amazon EC2 instances. Currently, AWS Backup supports Windows VSS backups. AWS Backup excludes specific Amazon EC2 instance types from Windows VSS backups. For more information, see Creating Windows VSS backups.
AWS CloudFormation templates for backup plans
We provide two sample AWS CloudFormation templates for your reference. The first template creates a simple backup plan. The second template enables VSS backups in a backup plan.
Note
If you are using the default service role, replace
service-role
with
AWSBackupServiceRolePolicyForBackup
.
Description: backup plan template to back up all resources daily at 5am UTC, and tag all recovery points with backup:daily. Resources: KMSKey: Type: AWS::KMS::Key Properties: Description: "Encryption key for daily" EnableKeyRotation: True Enabled: True KeyPolicy: Version: "2012-10-17" Statement: - Effect: Allow Principal: "AWS": { "Fn::Sub": "arn:${AWS::Partition}:iam::${AWS::AccountId}:root" } Action: - kms:* Resource: "*" BackupVaultWithDailyBackups: Type: "AWS::Backup::BackupVault" Properties: BackupVaultName: "BackupVaultWithDailyBackups" EncryptionKeyArn: !GetAtt KMSKey.Arn BackupPlanWithDailyBackups: Type: "AWS::Backup::BackupPlan" Properties: BackupPlan: BackupPlanName: "BackupPlanWithDailyBackups" BackupPlanRule: - RuleName: "RuleForDailyBackups" TargetBackupVault: !Ref BackupVaultWithDailyBackups ScheduleExpression: "cron(0 5 ? * * *)" DependsOn: BackupVaultWithDailyBackups DDBTableWithDailyBackupTag: Type: "AWS::DynamoDB::Table" Properties: TableName: "TestTable" AttributeDefinitions: - AttributeName: "Album" AttributeType: "S" KeySchema: - AttributeName: "Album" KeyType: "HASH" ProvisionedThroughput: ReadCapacityUnits: "5" WriteCapacityUnits: "5" Tags: - Key: "backup" Value: "daily" BackupRole: Type: "AWS::IAM::Role" Properties: AssumeRolePolicyDocument: Version: "2012-10-17" Statement: - Effect: "Allow" Principal: Service: - "backup.amazonaws.com" Action: - "sts:AssumeRole" ManagedPolicyArns: - "arn:aws:iam::aws:policy/service-role/
service-role
" TagBasedBackupSelection: Type: "AWS::Backup::BackupSelection" Properties: BackupSelection: SelectionName: "TagBasedBackupSelection" IamRoleArn: !GetAtt BackupRole.Arn ListOfTags: - ConditionType: "STRINGEQUALS" ConditionKey: "backup" ConditionValue: "daily" BackupPlanId: !Ref BackupPlanWithDailyBackups DependsOn: BackupPlanWithDailyBackups
Description: backup plan template to enable Windows VSS and add backup rule to take backup of assigned resources daily at 5am UTC. Resources: KMSKey: Type: AWS::KMS::Key Properties: Description: "Encryption key for daily" EnableKeyRotation: True Enabled: True KeyPolicy: Version: "2012-10-17" Statement: - Effect: Allow Principal: "AWS": { "Fn::Sub": "arn:${AWS::Partition}:iam::${AWS::AccountId}:root" } Action: - kms:* Resource: "*" BackupVaultWithDailyBackups: Type: "AWS::Backup::BackupVault" Properties: BackupVaultName: "BackupVaultWithDailyBackups" EncryptionKeyArn: !GetAtt KMSKey.Arn BackupPlanWithDailyBackups: Type: "AWS::Backup::BackupPlan" Properties: BackupPlan: BackupPlanName: "BackupPlanWithDailyBackups" AdvancedBackupSettings: - ResourceType: EC2 BackupOptions: WindowsVSS: enabled BackupPlanRule: - RuleName: "RuleForDailyBackups" TargetBackupVault: !Ref BackupVaultWithDailyBackups ScheduleExpression: "cron(0 5 ? * * *)" DependsOn: BackupVaultWithDailyBackups