AWS::DLM::LifecyclePolicy
Specifies a lifecycle policy, which is used to automate operations on Amazon EBS resources.
The properties are required when you add a lifecycle policy and optional when you update a lifecycle policy.
Syntax
To declare this entity in your AWS CloudFormation template, use the following syntax:
JSON
{ "Type" : "AWS::DLM::LifecyclePolicy", "Properties" : { "Description" :
String
, "ExecutionRoleArn" :String
, "PolicyDetails" :PolicyDetails
, "State" :String
, "Tags" :[ Tag, ... ]
} }
YAML
Type: AWS::DLM::LifecyclePolicy Properties: Description:
String
ExecutionRoleArn:String
PolicyDetails:PolicyDetails
State:String
Tags:- Tag
Properties
Description
-
A description of the lifecycle policy. The characters ^[0-9A-Za-z _-]+$ are supported.
Required: Conditional
Type: String
Minimum:
0
Maximum:
500
Pattern:
[0-9A-Za-z _-]+
Update requires: No interruption
ExecutionRoleArn
-
The Amazon Resource Name (ARN) of the IAM role used to run the operations specified by the lifecycle policy.
Required: Conditional
Type: String
Minimum:
0
Maximum:
2048
Pattern:
arn:aws(-[a-z]{1,3}){0,2}:iam::\d+:role/.*
Update requires: No interruption
PolicyDetails
-
The configuration details of the lifecycle policy.
Required: Conditional
Type: PolicyDetails
Update requires: No interruption
State
-
The activation state of the lifecycle policy.
Required: Conditional
Type: String
Allowed values:
DISABLED | ENABLED | ERROR
Update requires: No interruption
Tags
-
The tags to apply to the lifecycle policy during creation.
Required: No
Type: List of Tag
Update requires: No interruption
Return values
Ref
When you pass the logical ID of this resource to the intrinsic Ref
function, Ref
returns the ID of the lifecycle policy.
For more information about using the Ref
function, see Ref.
Fn::GetAtt
The Fn::GetAtt
intrinsic function returns a value for a specified attribute of this type. The following are the available attributes and sample return values.
For more information about using the Fn::GetAtt
intrinsic function, see Fn::GetAtt.
Examples
Creating a Lifecycle Policy
The following example demonstrates how to create a basic snapshot lifecycle policy with a cross-Region copy rule.
JSON
{ "Description": "Basic LifecyclePolicy", "Resources": { "BasicLifecyclePolicy": { "Type": "AWS::DLM::LifecyclePolicy", "Properties": { "Description": "Lifecycle Policy using CloudFormation", "State": "ENABLED", "ExecutionRoleArn": "arn:aws:iam::123456789012:role/service-role/AWSDataLifecycleManagerDefaultRole", "PolicyDetails": { "ResourceTypes": [ "VOLUME" ], "TargetTags": [{ "Key": "costcenter", "Value": "115" }], "Schedules": [{ "Name": "Daily Snapshots", "TagsToAdd": [{ "Key": "type", "Value": "DailySnapshot" }], "CreateRule": { "Interval": 12, "IntervalUnit": "HOURS", "Times": [ "13:00" ] }, "RetainRule": { "Count": 1 }, "CopyTags": true, "CrossRegionCopyRules": [{ "Encrypted": false, "Target": "us-east-1" }] }] } } } } }
YAML
Description: Basic LifecyclePolicy Resources: BasicLifecyclePolicy: Type: AWS::DLM::LifecyclePolicy Properties: Description: Lifecycle Policy using CloudFormation State: ENABLED ExecutionRoleArn: arn:aws:iam::123456789012:role/service-role/AWSDataLifecycleManagerDefaultRole PolicyDetails: ResourceTypes: - VOLUME TargetTags: - Key: costcenter Value: '115' Schedules: - Name: Daily Snapshots TagsToAdd: - Key: type Value: DailySnapshot CreateRule: Interval: 12 IntervalUnit: HOURS Times: - '13:00' RetainRule: Count: 1 CopyTags: true CrossRegionCopyRules: - Encrypted: false Target: us-east-1
See also
-
CreateLifecyclePolicy in the Amazon Data Lifecycle Manager API Reference
-
Automating the Amazon EBS Snapshot Lifecycle in the Amazon Elastic Compute Cloud User Guide