create_lifecycle_policy
async
¶
create_lifecycle_policy(
*,
config_overrides: Optional[AsyncDLMClientConfig] = None,
execution_role_arn: Optional[ExecutionRoleArn] = None,
description: Optional[PolicyDescription] = None,
state: Optional[SettablePolicyStateValues] = None,
policy_details: Optional[PolicyDetails] = None,
tags: Optional[TagMap] = None,
default_policy: Optional[DefaultPolicyTypeValues] = None,
create_interval: Optional[CreateInterval] = None,
retain_interval: Optional[RetainInterval] = None,
copy_tags: Optional[CopyTagsNullable] = None,
extend_deletion: Optional[ExtendDeletion] = None,
cross_region_copy_targets: Optional[CrossRegionCopyTargetList] = None,
exclusions: Optional[Exclusions] = None,
) -> CreateLifecyclePolicyResponse
Creates an Amazon Data Lifecycle Manager lifecycle policy. Amazon Data Lifecycle Manager supports the following policy types:
-
Custom EBS snapshot policy
-
Custom EBS-backed AMI policy
-
Cross-account copy event policy
-
Default policy for EBS snapshots
-
Default policy for EBS-backed AMIs
For more information, see Default policies vs custom policies.
If you create a default policy, you can specify the request parameters either in the request body, or in the PolicyDetails request structure, but not both.
Parameters:
-
execution_role_arn(Optional[ExecutionRoleArn], default:None) –The Amazon Resource Name (ARN) of the IAM role used to run the operations specified by the lifecycle policy.
-
description(Optional[PolicyDescription], default:None) –A description of the lifecycle policy. The characters ^[0-9A-Za-z _-]+$ are supported.
-
state(Optional[SettablePolicyStateValues], default:None) –The activation state of the lifecycle policy after creation.
-
policy_details(Optional[PolicyDetails], default:None) –The configuration details of the lifecycle policy.
If you create a default policy, you can specify the request parameters either in the request body, or in the PolicyDetails request structure, but not both.
-
tags(Optional[TagMap], default:None) –The tags to apply to the lifecycle policy during creation.
-
default_policy(Optional[DefaultPolicyTypeValues], default:None) –[Default policies only] Specify the type of default policy to create.
-
To create a default policy for EBS snapshots, that creates snapshots of all volumes in the Region that do not have recent backups, specify
VOLUME. -
To create a default policy for EBS-backed AMIs, that creates EBS-backed AMIs from all instances in the Region that do not have recent backups, specify
INSTANCE.
-
-
create_interval(Optional[CreateInterval], default:None) –[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. If you do not specify a value, the default is 1.
Default: 1
-
retain_interval(Optional[RetainInterval], default:None) –[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. If you do not specify a value, the default is 7.
Default: 7
-
copy_tags(Optional[CopyTagsNullable], default:None) –[Default policies only] Indicates whether the policy should copy tags from the source resource to the snapshot or AMI. If you do not specify a value, the default is
false.Default: false
-
extend_deletion(Optional[ExtendDeletion], default:None) –[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.
If you do not specify a value, the default is
false.Default: false
-
-
cross_region_copy_targets(Optional[CrossRegionCopyTargetList], default:None) –[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.
-
exclusions(Optional[Exclusions], default:None) –[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.
Raises:
-
InternalServerException–The service failed in an unexpected way.
-
InvalidRequestException–Bad request. The request is missing required parameters or has invalid parameters.
-
LimitExceededException–The request failed because a limit was exceeded.
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_dlm/_services/async_dlm.py
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 | |