Create Amazon Data Lifecycle Manager MultiAvailabilityZone policies
Use a MultiAvailabilityZone policy to automatically back up the multi-AZ Amazon EBS
volumes in a Region. Amazon Data Lifecycle Manager takes a snapshot of each targeted volume every 15 minutes
and retains only the most recent snapshot of each volume. You can optionally copy each
snapshot to up to three other Regions.
This section explains how to create MultiAvailabilityZone policies.
Considerations for MultiAvailabilityZone policies
Keep the following in mind when working with MultiAvailabilityZone policies:
-
MultiAvailabilityZone policies target all multi-AZ EBS volumes in the Region.
To exclude specific volumes, specify exclusion parameters.
-
MultiAvailabilityZone policies create a snapshot of each targeted volume every
15 minutes. The creation frequency is fixed.
-
MultiAvailabilityZone policies retain only the most recent completed snapshot
of each volume. The retention is fixed.
-
MultiAvailabilityZone policies can optionally copy snapshots to other Regions. At each
copy interval, Amazon Data Lifecycle Manager copies the most recent completed snapshot of each volume to up to three
destination Regions and keeps only that copy per Region. You can't copy tags to cross-Region
copies.
-
If a snapshot takes longer than 15 minutes to complete, Amazon Data Lifecycle Manager creates the next
snapshot as soon as the previous one completes.
-
You can create one MultiAvailabilityZone policy per Region.
-
If a targeted volume is deleted, Amazon Data Lifecycle Manager stops creating snapshots for it. The most
recent snapshot of the volume is retained; you must manually delete it if it is not
required.
-
If a MultiAvailabilityZone policy is deleted or enters the error or disabled
state, Amazon Data Lifecycle Manager stops creating snapshots. Snapshots and cross-Region copies that the
policy already created are retained.
-
When you enable a MultiAvailabilityZone policy, Amazon Data Lifecycle Manager creates a managed Amazon
EventBridge rule in your account to track snapshot completions. Do not delete or
modify this rule. If the rule is deleted, the policy enters the error state;
re-enable the policy to recreate the rule.
-
A MultiAvailabilityZone policy keeps only one recent recovery point per volume
and replaces it every 15 minutes. Logical corruption, such as accidental deletion,
ransomware, or an application bug, can reach the only snapshot and its cross-Region
copy within one or two cycles. To recover from accidental deletion or corruption,
also use a default or custom snapshot policy with longer retention.
-
A default policy for EBS snapshots also targets multi-AZ volumes. If you use
both a MultiAvailabilityZone policy and a default or custom policy, Amazon Data Lifecycle Manager creates
two sets of snapshots, which affects cost.
Create MultiAvailabilityZone policy
- Console
-
To create a MultiAvailabilityZone policy
-
Open the Amazon EC2 console at
https://console.aws.amazon.com/ec2/.
-
In the navigation panel, choose Lifecycle Manager and
then choose Create lifecycle policy.
-
For Policy type, choose MultiAvailabilityZone
policy.
-
For Description, enter a brief description for the
policy.
For IAM role, choose the IAM role that has permissions
to manage snapshots.
We recommend that you choose Default to use the default
IAM role provided by Amazon Data Lifecycle Manager. However, you can also use a custom IAM role that
you previously created.
(Optional) Configure the Exclusion parameters
to exclude specific volumes from the scheduled backups. Excluded volumes will
not be backed up by the policy.
-
To exclude boot volumes, select Exclude boot volumes.
-
To exclude specific volume types, choose Exclude specific
volume types and then select the volume types to exclude. Only gp3
and io2 volumes can be multi-AZ, so only gp3 and io2 are meaningful for this
policy.
-
To exclude volumes that have specific tags, choose Add tag
and then specify the tag keys and values. The policy will not create snapshots
of volumes that have any of the specified tags.
(Optional) In the Advanced settings,
specify additional operations that the policy should perform.
-
To copy assigned tags from the source volumes to their snapshots, select
Copy tags from volumes.
-
To copy snapshots created by the policy to other Regions, select
Create cross-Region copy, specify a copy interval, and
then select up to 3 destination Regions. At each copy interval, Amazon Data Lifecycle Manager copies
the most recent completed snapshot of each volume to your destination Regions,
and keeps only that copy per Region. If no new snapshot has completed for a
volume since the last copy, that cycle is skipped for the volume; the same
snapshot is never copied twice.
-
If the source snapshot is encrypted, or if encryption by default
is enabled for the destination Region, the copied snapshots are
encrypted using the default KMS key for EBS encryption in the
destination Region.
-
If the source snapshot is unencrypted and encryption by default
is disabled for the destination Region, the copied snapshots are
unencrypted.
-
(Optional) To add a tag to the policy, choose Add
tag and then specify the tag key and value pair.
-
Choose Create MultiAvailabilityZone policy.
- AWS CLI
-
To create a MultiAvailabilityZone policy
Use the
create-lifecycle-policy command with --policy-class MULTI_AVAILABILITY_ZONE_POLICY.
$ aws dlm create-lifecycle-policy \
--state ENABLED | DISABLED \
--description "policy_description" \
--execution-role-arn role_arn \
--policy-class MULTI_AVAILABILITY_ZONE_POLICY \
--copy-tags | --no-copy-tags \
--exclusions ExcludeBootVolumes=true | false,ExcludeTags=[{Key=tag_key,Value=tag_value}],ExcludeVolumeTypes="gp3 | io2" \
--cross-region-copy-configuration '{"CopyInterval":{"Interval":copy_interval,"IntervalUnit":"HOURS | DAYS"},"Destinations":[{"TargetRegion":"destination_region_code_1"},{"TargetRegion":"destination_region_code_2"}]}'
Only gp3 and io2 volumes can be multi-AZ, so only gp3 and io2 are
meaningful values for ExcludeVolumeTypes in a MultiAvailabilityZone
policy.
For example, to create a MultiAvailabilityZone policy that targets all
multi-AZ volumes in the Region and uses the default IAM role:
$ aws dlm create-lifecycle-policy \
--state ENABLED \
--description "MultiAvailabilityZone snapshot policy" \
--execution-role-arn arn:aws:iam::account_id:role/AWSDataLifecycleManagerDefaultRole \
--policy-class MULTI_AVAILABILITY_ZONE_POLICY