UpdateLifecyclePolicy
Updates the specified lifecycle policy.
For more information about updating a policy, see Modify lifecycle policies.
Request Syntax
PATCH /policies/policyId
HTTP/1.1
Content-type: application/json
{
"CopyTags": boolean
,
"CreateInterval": number
,
"CrossRegionCopyTargets": [
{
"TargetRegion": "string
"
}
],
"Description": "string
",
"Exclusions": {
"ExcludeBootVolumes": boolean
,
"ExcludeTags": [
{
"Key": "string
",
"Value": "string
"
}
],
"ExcludeVolumeTypes": [ "string
" ]
},
"ExecutionRoleArn": "string
",
"ExtendDeletion": boolean
,
"PolicyDetails": {
"Actions": [
{
"CrossRegionCopy": [
{
"EncryptionConfiguration": {
"CmkArn": "string
",
"Encrypted": boolean
},
"RetainRule": {
"Interval": number
,
"IntervalUnit": "string
"
},
"Target": "string
"
}
],
"Name": "string
"
}
],
"CopyTags": boolean
,
"CreateInterval": number
,
"CrossRegionCopyTargets": [
{
"TargetRegion": "string
"
}
],
"EventSource": {
"Parameters": {
"DescriptionRegex": "string
",
"EventType": "string
",
"SnapshotOwner": [ "string
" ]
},
"Type": "string
"
},
"Exclusions": {
"ExcludeBootVolumes": boolean
,
"ExcludeTags": [
{
"Key": "string
",
"Value": "string
"
}
],
"ExcludeVolumeTypes": [ "string
" ]
},
"ExtendDeletion": boolean
,
"Parameters": {
"ExcludeBootVolume": boolean
,
"ExcludeDataVolumeTags": [
{
"Key": "string
",
"Value": "string
"
}
],
"NoReboot": boolean
},
"PolicyLanguage": "string
",
"PolicyType": "string
",
"ResourceLocations": [ "string
" ],
"ResourceType": "string
",
"ResourceTypes": [ "string
" ],
"RetainInterval": number
,
"Schedules": [
{
"ArchiveRule": {
"RetainRule": {
"RetentionArchiveTier": {
"Count": number
,
"Interval": number
,
"IntervalUnit": "string
"
}
}
},
"CopyTags": boolean
,
"CreateRule": {
"CronExpression": "string
",
"Interval": number
,
"IntervalUnit": "string
",
"Location": "string
",
"Scripts": [
{
"ExecuteOperationOnScriptFailure": boolean
,
"ExecutionHandler": "string
",
"ExecutionHandlerService": "string
",
"ExecutionTimeout": number
,
"MaximumRetryCount": number
,
"Stages": [ "string
" ]
}
],
"Times": [ "string
" ]
},
"CrossRegionCopyRules": [
{
"CmkArn": "string
",
"CopyTags": boolean
,
"DeprecateRule": {
"Interval": number
,
"IntervalUnit": "string
"
},
"Encrypted": boolean
,
"RetainRule": {
"Interval": number
,
"IntervalUnit": "string
"
},
"Target": "string
",
"TargetRegion": "string
"
}
],
"DeprecateRule": {
"Count": number
,
"Interval": number
,
"IntervalUnit": "string
"
},
"FastRestoreRule": {
"AvailabilityZones": [ "string
" ],
"Count": number
,
"Interval": number
,
"IntervalUnit": "string
"
},
"Name": "string
",
"RetainRule": {
"Count": number
,
"Interval": number
,
"IntervalUnit": "string
"
},
"ShareRules": [
{
"TargetAccounts": [ "string
" ],
"UnshareInterval": number
,
"UnshareIntervalUnit": "string
"
}
],
"TagsToAdd": [
{
"Key": "string
",
"Value": "string
"
}
],
"VariableTags": [
{
"Key": "string
",
"Value": "string
"
}
]
}
],
"TargetTags": [
{
"Key": "string
",
"Value": "string
"
}
]
},
"RetainInterval": number
,
"State": "string
"
}
URI Request Parameters
The request uses the following URI parameters.
- policyId
-
The identifier of the lifecycle policy.
Length Constraints: Minimum length of 0. Maximum length of 64.
Pattern:
policy-[a-f0-9]+
Required: Yes
Request Body
The request accepts the following data in JSON format.
- CopyTags
-
[Default policies only] Indicates whether the policy should copy tags from the source resource to the snapshot or AMI.
Type: Boolean
Required: No
- CreateInterval
-
[Default policies only] Specifies how often the policy should run and create snapshots or AMIs. The creation frequency can range from 1 to 7 days.
Type: Integer
Valid Range: Minimum value of 1.
Required: No
- CrossRegionCopyTargets
-
[Default policies only] Specifies destination Regions for snapshot or AMI copies. You can specify up to 3 destination Regions. If you do not want to create cross-Region copies, omit this parameter.
Type: Array of CrossRegionCopyTarget objects
Array Members: Minimum number of 0 items. Maximum number of 3 items.
Required: No
- Description
-
A description of the lifecycle policy.
Type: String
Length Constraints: Minimum length of 0. Maximum length of 500.
Pattern:
[0-9A-Za-z _-]+
Required: No
- Exclusions
-
[Default policies only] Specifies exclusion parameters for volumes or instances for which you do not want to create snapshots or AMIs. The policy will not create snapshots or AMIs for target resources that match any of the specified exclusion parameters.
Type: Exclusions object
Required: No
- ExecutionRoleArn
-
The Amazon Resource Name (ARN) of the IAM role used to run the operations specified by the lifecycle policy.
Type: String
Length Constraints: Minimum length of 0. Maximum length of 2048.
Pattern:
arn:aws(-[a-z]{1,3}){0,2}:iam::\d+:role/.*
Required: No
- ExtendDeletion
-
[Default policies only] Defines the snapshot or AMI retention behavior for the policy if the source volume or instance is deleted, or if the policy enters the error, disabled, or deleted state.
By default (ExtendDeletion=false):
-
If a source resource is deleted, Amazon Data Lifecycle Manager will continue to delete previously created snapshots or AMIs, up to but not including the last one, based on the specified retention period. If you want Amazon Data Lifecycle Manager to delete all snapshots or AMIs, including the last one, specify
true
. -
If a policy enters the error, disabled, or deleted state, Amazon Data Lifecycle Manager stops deleting snapshots and AMIs. If you want Amazon Data Lifecycle Manager to continue deleting snapshots or AMIs, including the last one, if the policy enters one of these states, specify
true
.
If you enable extended deletion (ExtendDeletion=true), you override both default behaviors simultaneously.
Default: false
Type: Boolean
Required: No
-
- PolicyDetails
-
The configuration of the lifecycle policy. You cannot update the policy type or the resource type.
Type: PolicyDetails object
Required: No
- RetainInterval
-
[Default policies only] Specifies how long the policy should retain snapshots or AMIs before deleting them. The retention period can range from 2 to 14 days, but it must be greater than the creation frequency to ensure that the policy retains at least 1 snapshot or AMI at any given time.
Type: Integer
Valid Range: Minimum value of 1.
Required: No
- State
-
The desired activation state of the lifecycle policy after creation.
Type: String
Valid Values:
ENABLED | DISABLED
Required: No
Response Syntax
HTTP/1.1 200
Response Elements
If the action is successful, the service sends back an HTTP 200 response with an empty HTTP body.
Errors
For information about the errors that are common to all actions, see Common Errors.
- InternalServerException
-
The service failed in an unexpected way.
HTTP Status Code: 500
- InvalidRequestException
-
Bad request. The request is missing required parameters or has invalid parameters.
HTTP Status Code: 400
- LimitExceededException
-
The request failed because a limit was exceeded.
HTTP Status Code: 429
- ResourceNotFoundException
-
A requested resource was not found.
HTTP Status Code: 404
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following: