CfnLifecyclePolicyProps

class aws_cdk.aws_dlm.CfnLifecyclePolicyProps(*, copy_tags=None, create_interval=None, cross_region_copy_targets=None, default_policy=None, description=None, exclusions=None, execution_role_arn=None, extend_deletion=None, policy_details=None, retain_interval=None, state=None, tags=None)

Bases: object

Properties for defining a CfnLifecyclePolicy.

Parameters:
  • copy_tags (Union[bool, IResolvable, 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

  • create_interval (Union[int, float, 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

  • cross_region_copy_targets (Any) – [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.

  • default_policy (Optional[str]) – [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 .

  • description (Optional[str]) – A description of the lifecycle policy. The characters ^[0-9A-Za-z _-]+$ are supported.

  • exclusions (Union[IResolvable, ExclusionsProperty, Dict[str, Any], 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.

  • execution_role_arn (Optional[str]) – The Amazon Resource Name (ARN) of the IAM role used to run the operations specified by the lifecycle policy.

  • extend_deletion (Union[bool, IResolvable, 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

  • policy_details (Union[IResolvable, PolicyDetailsProperty, Dict[str, Any], None]) – The configuration details of the lifecycle policy. .. epigraph:: 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.

  • retain_interval (Union[int, float, 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

  • state (Optional[str]) – The activation state of the lifecycle policy.

  • tags (Optional[Sequence[Union[CfnTag, Dict[str, Any]]]]) – The tags to apply to the lifecycle policy during creation.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dlm-lifecyclepolicy.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_dlm as dlm

# cross_region_copy_targets: Any
# exclude_tags: Any
# exclude_volume_types: Any

cfn_lifecycle_policy_props = dlm.CfnLifecyclePolicyProps(
    copy_tags=False,
    create_interval=123,
    cross_region_copy_targets=cross_region_copy_targets,
    default_policy="defaultPolicy",
    description="description",
    exclusions=dlm.CfnLifecyclePolicy.ExclusionsProperty(
        exclude_boot_volumes=False,
        exclude_tags=exclude_tags,
        exclude_volume_types=exclude_volume_types
    ),
    execution_role_arn="executionRoleArn",
    extend_deletion=False,
    policy_details=dlm.CfnLifecyclePolicy.PolicyDetailsProperty(
        actions=[dlm.CfnLifecyclePolicy.ActionProperty(
            cross_region_copy=[dlm.CfnLifecyclePolicy.CrossRegionCopyActionProperty(
                encryption_configuration=dlm.CfnLifecyclePolicy.EncryptionConfigurationProperty(
                    encrypted=False,

                    # the properties below are optional
                    cmk_arn="cmkArn"
                ),
                target="target",

                # the properties below are optional
                retain_rule=dlm.CfnLifecyclePolicy.CrossRegionCopyRetainRuleProperty(
                    interval=123,
                    interval_unit="intervalUnit"
                )
            )],
            name="name"
        )],
        copy_tags=False,
        create_interval=123,
        cross_region_copy_targets=cross_region_copy_targets,
        event_source=dlm.CfnLifecyclePolicy.EventSourceProperty(
            type="type",

            # the properties below are optional
            parameters=dlm.CfnLifecyclePolicy.EventParametersProperty(
                event_type="eventType",
                snapshot_owner=["snapshotOwner"],

                # the properties below are optional
                description_regex="descriptionRegex"
            )
        ),
        exclusions=dlm.CfnLifecyclePolicy.ExclusionsProperty(
            exclude_boot_volumes=False,
            exclude_tags=exclude_tags,
            exclude_volume_types=exclude_volume_types
        ),
        extend_deletion=False,
        parameters=dlm.CfnLifecyclePolicy.ParametersProperty(
            exclude_boot_volume=False,
            exclude_data_volume_tags=[CfnTag(
                key="key",
                value="value"
            )],
            no_reboot=False
        ),
        policy_language="policyLanguage",
        policy_type="policyType",
        resource_locations=["resourceLocations"],
        resource_type="resourceType",
        resource_types=["resourceTypes"],
        retain_interval=123,
        schedules=[dlm.CfnLifecyclePolicy.ScheduleProperty(
            archive_rule=dlm.CfnLifecyclePolicy.ArchiveRuleProperty(
                retain_rule=dlm.CfnLifecyclePolicy.ArchiveRetainRuleProperty(
                    retention_archive_tier=dlm.CfnLifecyclePolicy.RetentionArchiveTierProperty(
                        count=123,
                        interval=123,
                        interval_unit="intervalUnit"
                    )
                )
            ),
            copy_tags=False,
            create_rule=dlm.CfnLifecyclePolicy.CreateRuleProperty(
                cron_expression="cronExpression",
                interval=123,
                interval_unit="intervalUnit",
                location="location",
                scripts=[dlm.CfnLifecyclePolicy.ScriptProperty(
                    execute_operation_on_script_failure=False,
                    execution_handler="executionHandler",
                    execution_handler_service="executionHandlerService",
                    execution_timeout=123,
                    maximum_retry_count=123,
                    stages=["stages"]
                )],
                times=["times"]
            ),
            cross_region_copy_rules=[dlm.CfnLifecyclePolicy.CrossRegionCopyRuleProperty(
                encrypted=False,

                # the properties below are optional
                cmk_arn="cmkArn",
                copy_tags=False,
                deprecate_rule=dlm.CfnLifecyclePolicy.CrossRegionCopyDeprecateRuleProperty(
                    interval=123,
                    interval_unit="intervalUnit"
                ),
                retain_rule=dlm.CfnLifecyclePolicy.CrossRegionCopyRetainRuleProperty(
                    interval=123,
                    interval_unit="intervalUnit"
                ),
                target="target",
                target_region="targetRegion"
            )],
            deprecate_rule=dlm.CfnLifecyclePolicy.DeprecateRuleProperty(
                count=123,
                interval=123,
                interval_unit="intervalUnit"
            ),
            fast_restore_rule=dlm.CfnLifecyclePolicy.FastRestoreRuleProperty(
                availability_zones=["availabilityZones"],
                count=123,
                interval=123,
                interval_unit="intervalUnit"
            ),
            name="name",
            retain_rule=dlm.CfnLifecyclePolicy.RetainRuleProperty(
                count=123,
                interval=123,
                interval_unit="intervalUnit"
            ),
            share_rules=[dlm.CfnLifecyclePolicy.ShareRuleProperty(
                target_accounts=["targetAccounts"],
                unshare_interval=123,
                unshare_interval_unit="unshareIntervalUnit"
            )],
            tags_to_add=[CfnTag(
                key="key",
                value="value"
            )],
            variable_tags=[CfnTag(
                key="key",
                value="value"
            )]
        )],
        target_tags=[CfnTag(
            key="key",
            value="value"
        )]
    ),
    retain_interval=123,
    state="state",
    tags=[CfnTag(
        key="key",
        value="value"
    )]
)

Attributes

copy_tags

[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

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dlm-lifecyclepolicy.html#cfn-dlm-lifecyclepolicy-copytags

create_interval

[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

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dlm-lifecyclepolicy.html#cfn-dlm-lifecyclepolicy-createinterval

cross_region_copy_targets

[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.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dlm-lifecyclepolicy.html#cfn-dlm-lifecyclepolicy-crossregioncopytargets

default_policy

[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 .

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dlm-lifecyclepolicy.html#cfn-dlm-lifecyclepolicy-defaultpolicy

description

A description of the lifecycle policy.

The characters ^[0-9A-Za-z _-]+$ are supported.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dlm-lifecyclepolicy.html#cfn-dlm-lifecyclepolicy-description

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.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dlm-lifecyclepolicy.html#cfn-dlm-lifecyclepolicy-exclusions

execution_role_arn

The Amazon Resource Name (ARN) of the IAM role used to run the operations specified by the lifecycle policy.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dlm-lifecyclepolicy.html#cfn-dlm-lifecyclepolicy-executionrolearn

extend_deletion

[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

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dlm-lifecyclepolicy.html#cfn-dlm-lifecyclepolicy-extenddeletion

policy_details

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.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dlm-lifecyclepolicy.html#cfn-dlm-lifecyclepolicy-policydetails

retain_interval

[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

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dlm-lifecyclepolicy.html#cfn-dlm-lifecyclepolicy-retaininterval

state

The activation state of the lifecycle policy.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dlm-lifecyclepolicy.html#cfn-dlm-lifecyclepolicy-state

tags

The tags to apply to the lifecycle policy during creation.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dlm-lifecyclepolicy.html#cfn-dlm-lifecyclepolicy-tags