CfnLifecyclePolicy
- class aws_cdk.aws_dlm.CfnLifecyclePolicy(scope, id, *, 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:
CfnResource
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.
- See:
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dlm-lifecyclepolicy.html
- CloudformationResource:
AWS::DLM::LifecyclePolicy
- 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 = dlm.CfnLifecyclePolicy(self, "MyCfnLifecyclePolicy", 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" )] )
- Parameters:
scope (
Construct
) – Scope in which this resource is defined.id (
str
) – Construct identifier for this resource (unique in its scope).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 isfalse
. Default: falsecreate_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: 1cross_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, specifyVOLUME
. - 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, specifyINSTANCE
.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, specifytrue
. - 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, specifytrue
. If you enable extended deletion ( ExtendDeletion=true ), you override both default behaviors simultaneously. If you do not specify a value, the default isfalse
. Default: falsepolicy_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: 7state (
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.
Methods
- add_deletion_override(path)
Syntactic sugar for
addOverride(path, undefined)
.- Parameters:
path (
str
) – The path of the value to delete.- Return type:
None
- add_dependency(target)
Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.
This can be used for resources across stacks (or nested stack) boundaries and the dependency will automatically be transferred to the relevant scope.
- Parameters:
target (
CfnResource
) –- Return type:
None
- add_depends_on(target)
(deprecated) Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.
- Parameters:
target (
CfnResource
) –- Deprecated:
use addDependency
- Stability:
deprecated
- Return type:
None
- add_metadata(key, value)
Add a value to the CloudFormation Resource Metadata.
- Parameters:
key (
str
) –value (
Any
) –
- See:
- Return type:
None
Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.
- add_override(path, value)
Adds an override to the synthesized CloudFormation resource.
To add a property override, either use
addPropertyOverride
or prefixpath
with “Properties.” (i.e.Properties.TopicName
).If the override is nested, separate each nested level using a dot (.) in the path parameter. If there is an array as part of the nesting, specify the index in the path.
To include a literal
.
in the property name, prefix with a\
. In most programming languages you will need to write this as"\\."
because the\
itself will need to be escaped.For example:
cfn_resource.add_override("Properties.GlobalSecondaryIndexes.0.Projection.NonKeyAttributes", ["myattribute"]) cfn_resource.add_override("Properties.GlobalSecondaryIndexes.1.ProjectionType", "INCLUDE")
would add the overrides Example:
"Properties": { "GlobalSecondaryIndexes": [ { "Projection": { "NonKeyAttributes": [ "myattribute" ] ... } ... }, { "ProjectionType": "INCLUDE" ... }, ] ... }
The
value
argument toaddOverride
will not be processed or translated in any way. Pass raw JSON values in here with the correct capitalization for CloudFormation. If you pass CDK classes or structs, they will be rendered with lowercased key names, and CloudFormation will reject the template.- Parameters:
path (
str
) –The path of the property, you can use dot notation to override values in complex types. Any intermediate keys will be created as needed.
value (
Any
) –The value. Could be primitive or complex.
- Return type:
None
- add_property_deletion_override(property_path)
Adds an override that deletes the value of a property from the resource definition.
- Parameters:
property_path (
str
) – The path to the property.- Return type:
None
- add_property_override(property_path, value)
Adds an override to a resource property.
Syntactic sugar for
addOverride("Properties.<...>", value)
.- Parameters:
property_path (
str
) – The path of the property.value (
Any
) – The value.
- Return type:
None
- apply_removal_policy(policy=None, *, apply_to_update_replace_policy=None, default=None)
Sets the deletion policy of the resource based on the removal policy specified.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you’ve removed it from the CDK application or because you’ve made a change that requires the resource to be replaced.
The resource can be deleted (
RemovalPolicy.DESTROY
), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN
). In some cases, a snapshot can be taken of the resource prior to deletion (RemovalPolicy.SNAPSHOT
). A list of resources that support this policy can be found in the following link:- Parameters:
policy (
Optional
[RemovalPolicy
]) –apply_to_update_replace_policy (
Optional
[bool
]) – Apply the same deletion policy to the resource’s “UpdateReplacePolicy”. Default: truedefault (
Optional
[RemovalPolicy
]) – The default policy to apply in case the removal policy is not defined. Default: - Default value is resource specific. To determine the default value for a resource, please consult that specific resource’s documentation.
- See:
- Return type:
None
- get_att(attribute_name, type_hint=None)
Returns a token for an runtime attribute of this resource.
Ideally, use generated attribute accessors (e.g.
resource.arn
), but this can be used for future compatibility in case there is no generated attribute.- Parameters:
attribute_name (
str
) – The name of the attribute.type_hint (
Optional
[ResolutionTypeHint
]) –
- Return type:
- get_metadata(key)
Retrieve a value value from the CloudFormation Resource Metadata.
- Parameters:
key (
str
) –- See:
- Return type:
Any
Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.
- inspect(inspector)
Examines the CloudFormation resource and discloses attributes.
- Parameters:
inspector (
TreeInspector
) – tree inspector to collect and process attributes.- Return type:
None
- obtain_dependencies()
Retrieves an array of resources this resource depends on.
This assembles dependencies on resources across stacks (including nested stacks) automatically.
- Return type:
List
[Union
[Stack
,CfnResource
]]
- obtain_resource_dependencies()
Get a shallow copy of dependencies between this resource and other resources in the same stack.
- Return type:
List
[CfnResource
]
- override_logical_id(new_logical_id)
Overrides the auto-generated logical ID with a specific ID.
- Parameters:
new_logical_id (
str
) – The new logical ID to use for this stack element.- Return type:
None
- remove_dependency(target)
Indicates that this resource no longer depends on another resource.
This can be used for resources across stacks (including nested stacks) and the dependency will automatically be removed from the relevant scope.
- Parameters:
target (
CfnResource
) –- Return type:
None
- replace_dependency(target, new_target)
Replaces one dependency with another.
- Parameters:
target (
CfnResource
) – The dependency to replace.new_target (
CfnResource
) – The new dependency to add.
- Return type:
None
- to_string()
Returns a string representation of this construct.
- Return type:
str
- Returns:
a string representation of this resource
Attributes
- CFN_RESOURCE_TYPE_NAME = 'AWS::DLM::LifecyclePolicy'
- attr_arn
The Amazon Resource Name (ARN) of the lifecycle policy.
- CloudformationAttribute:
Arn
- attr_id
Id
- Type:
cloudformationAttribute
- cfn_options
Options for this resource, such as condition, update policy etc.
- cfn_resource_type
AWS resource type.
- copy_tags
[Default policies only] Indicates whether the policy should copy tags from the source resource to the snapshot or AMI.
- create_interval
[Default policies only] Specifies how often the policy should run and create snapshots or AMIs.
- creation_stack
return:
the stack trace of the point where this Resource was created from, sourced from the +metadata+ entry typed +aws:cdk:logicalId+, and with the bottom-most node +internal+ entries filtered.
- cross_region_copy_targets
[Default policies only] Specifies destination Regions for snapshot or AMI copies.
- default_policy
[Default policies only] Specify the type of default policy to create.
- description
A description of the lifecycle policy.
- exclusions
[Default policies only] Specifies exclusion parameters for volumes or instances for which you do not want to create snapshots or AMIs.
- execution_role_arn
The Amazon Resource Name (ARN) of the IAM role used to run the operations specified by the lifecycle policy.
- 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.
- logical_id
The logical ID for this CloudFormation stack element.
The logical ID of the element is calculated from the path of the resource node in the construct tree.
To override this value, use
overrideLogicalId(newLogicalId)
.- Returns:
the logical ID as a stringified token. This value will only get resolved during synthesis.
- node
The tree node.
- policy_details
The configuration details of the lifecycle policy.
- ref
Return a string that will be resolved to a CloudFormation
{ Ref }
for this element.If, by any chance, the intrinsic reference of a resource is not a string, you could coerce it to an IResolvable through
Lazy.any({ produce: resource.ref })
.
- retain_interval
[Default policies only] Specifies how long the policy should retain snapshots or AMIs before deleting them.
- stack
The stack in which this element is defined.
CfnElements must be defined within a stack scope (directly or indirectly).
- state
The activation state of the lifecycle policy.
- tags
Tag Manager which manages the tags for this resource.
- tags_raw
The tags to apply to the lifecycle policy during creation.
Static Methods
- classmethod is_cfn_element(x)
Returns
true
if a construct is a stack element (i.e. part of the synthesized cloudformation template).Uses duck-typing instead of
instanceof
to allow stack elements from different versions of this library to be included in the same stack.- Parameters:
x (
Any
) –- Return type:
bool
- Returns:
The construct as a stack element or undefined if it is not a stack element.
- classmethod is_cfn_resource(x)
Check whether the given object is a CfnResource.
- Parameters:
x (
Any
) –- Return type:
bool
- classmethod is_construct(x)
Checks if
x
is a construct.Use this method instead of
instanceof
to properly detectConstruct
instances, even when the construct library is symlinked.Explanation: in JavaScript, multiple copies of the
constructs
library on disk are seen as independent, completely different libraries. As a consequence, the classConstruct
in each copy of theconstructs
library is seen as a different class, and an instance of one class will not test asinstanceof
the other class.npm install
will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of theconstructs
library can be accidentally installed, andinstanceof
will behave unpredictably. It is safest to avoid usinginstanceof
, and using this type-testing method instead.- Parameters:
x (
Any
) – Any object.- Return type:
bool
- Returns:
true if
x
is an object created from a class which extendsConstruct
.
ActionProperty
- class CfnLifecyclePolicy.ActionProperty(*, cross_region_copy, name)
Bases:
object
[Event-based policies only] Specifies an action for an event-based policy.
- Parameters:
cross_region_copy (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,CrossRegionCopyActionProperty
,Dict
[str
,Any
]]]]) – The rule for copying shared snapshots across Regions.name (
str
) – A descriptive name for the action.
- See:
- 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 action_property = 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" )
Attributes
- cross_region_copy
The rule for copying shared snapshots across Regions.
- name
A descriptive name for the action.
ArchiveRetainRuleProperty
- class CfnLifecyclePolicy.ArchiveRetainRuleProperty(*, retention_archive_tier)
Bases:
object
[Custom snapshot policies only] Specifies information about the archive storage tier retention period.
- Parameters:
retention_archive_tier (
Union
[IResolvable
,RetentionArchiveTierProperty
,Dict
[str
,Any
]]) – Information about retention period in the Amazon EBS Snapshots Archive. For more information, see Archive Amazon EBS snapshots .- See:
- 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 archive_retain_rule_property = dlm.CfnLifecyclePolicy.ArchiveRetainRuleProperty( retention_archive_tier=dlm.CfnLifecyclePolicy.RetentionArchiveTierProperty( count=123, interval=123, interval_unit="intervalUnit" ) )
Attributes
- retention_archive_tier
Information about retention period in the Amazon EBS Snapshots Archive.
For more information, see Archive Amazon EBS snapshots .
ArchiveRuleProperty
- class CfnLifecyclePolicy.ArchiveRuleProperty(*, retain_rule)
Bases:
object
[Custom snapshot policies only] Specifies a snapshot archiving rule for a schedule.
- Parameters:
retain_rule (
Union
[IResolvable
,ArchiveRetainRuleProperty
,Dict
[str
,Any
]]) – Information about the retention period for the snapshot archiving rule.- See:
- 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 archive_rule_property = dlm.CfnLifecyclePolicy.ArchiveRuleProperty( retain_rule=dlm.CfnLifecyclePolicy.ArchiveRetainRuleProperty( retention_archive_tier=dlm.CfnLifecyclePolicy.RetentionArchiveTierProperty( count=123, interval=123, interval_unit="intervalUnit" ) ) )
Attributes
- retain_rule
Information about the retention period for the snapshot archiving rule.
CreateRuleProperty
- class CfnLifecyclePolicy.CreateRuleProperty(*, cron_expression=None, interval=None, interval_unit=None, location=None, scripts=None, times=None)
Bases:
object
[Custom snapshot and AMI policies only] Specifies when the policy should create snapshots or AMIs.
You must specify either CronExpression , or Interval , IntervalUnit , and Times .
If you need to specify an ArchiveRule for the schedule, then you must specify a creation frequency of at least 28 days.
- Parameters:
cron_expression (
Optional
[str
]) – The schedule, as a Cron expression. The schedule interval must be between 1 hour and 1 year. For more information, see the Cron expressions reference in the Amazon EventBridge User Guide .interval (
Union
[int
,float
,None
]) – The interval between snapshots. The supported values are 1, 2, 3, 4, 6, 8, 12, and 24.interval_unit (
Optional
[str
]) – The interval unit.location (
Optional
[str
]) – [Custom snapshot policies only] Specifies the destination for snapshots created by the policy. To create snapshots in the same Region as the source resource, specifyCLOUD
. To create snapshots on the same Outpost as the source resource, specifyOUTPOST_LOCAL
. If you omit this parameter,CLOUD
is used by default. If the policy targets resources in an AWS Region , then you must create snapshots in the same Region as the source resource. If the policy targets resources on an Outpost, then you can create snapshots on the same Outpost as the source resource, or in the Region of that Outpost.scripts (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,ScriptProperty
,Dict
[str
,Any
]]],None
]) – [Custom snapshot policies that target instances only] Specifies pre and/or post scripts for a snapshot lifecycle policy that targets instances. This is useful for creating application-consistent snapshots, or for performing specific administrative tasks before or after Amazon Data Lifecycle Manager initiates snapshot creation. For more information, see Automating application-consistent snapshots with pre and post scripts .times (
Optional
[Sequence
[str
]]) – The time, in UTC, to start the operation. The supported format is hh:mm. The operation occurs within a one-hour window following the specified time. If you do not specify a time, Amazon Data Lifecycle Manager selects a time within the next 24 hours.
- See:
- 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 create_rule_property = 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"] )
Attributes
- cron_expression
The schedule, as a Cron expression.
The schedule interval must be between 1 hour and 1 year. For more information, see the Cron expressions reference in the Amazon EventBridge User Guide .
- interval
The interval between snapshots.
The supported values are 1, 2, 3, 4, 6, 8, 12, and 24.
- interval_unit
The interval unit.
- location
[Custom snapshot policies only] Specifies the destination for snapshots created by the policy.
To create snapshots in the same Region as the source resource, specify
CLOUD
. To create snapshots on the same Outpost as the source resource, specifyOUTPOST_LOCAL
. If you omit this parameter,CLOUD
is used by default.If the policy targets resources in an AWS Region , then you must create snapshots in the same Region as the source resource. If the policy targets resources on an Outpost, then you can create snapshots on the same Outpost as the source resource, or in the Region of that Outpost.
- scripts
[Custom snapshot policies that target instances only] Specifies pre and/or post scripts for a snapshot lifecycle policy that targets instances.
This is useful for creating application-consistent snapshots, or for performing specific administrative tasks before or after Amazon Data Lifecycle Manager initiates snapshot creation.
For more information, see Automating application-consistent snapshots with pre and post scripts .
- times
The operation occurs within a one-hour window following the specified time. If you do not specify a time, Amazon Data Lifecycle Manager selects a time within the next 24 hours.
- See:
- Type:
The time, in UTC, to start the operation. The supported format is hh
CrossRegionCopyActionProperty
- class CfnLifecyclePolicy.CrossRegionCopyActionProperty(*, encryption_configuration, target, retain_rule=None)
Bases:
object
[Event-based policies only] Specifies a cross-Region copy action for event-based policies.
To specify a cross-Region copy rule for snapshot and AMI policies, use CrossRegionCopyRule .
- Parameters:
encryption_configuration (
Union
[IResolvable
,EncryptionConfigurationProperty
,Dict
[str
,Any
]]) – The encryption settings for the copied snapshot.target (
str
) – The target Region.retain_rule (
Union
[IResolvable
,CrossRegionCopyRetainRuleProperty
,Dict
[str
,Any
],None
]) – Specifies a retention rule for cross-Region snapshot copies created by snapshot or event-based policies, or cross-Region AMI copies created by AMI policies. After the retention period expires, the cross-Region copy is deleted.
- See:
- 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_action_property = 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" ) )
Attributes
- encryption_configuration
The encryption settings for the copied snapshot.
- retain_rule
Specifies a retention rule for cross-Region snapshot copies created by snapshot or event-based policies, or cross-Region AMI copies created by AMI policies.
After the retention period expires, the cross-Region copy is deleted.
CrossRegionCopyDeprecateRuleProperty
- class CfnLifecyclePolicy.CrossRegionCopyDeprecateRuleProperty(*, interval, interval_unit)
Bases:
object
[Custom AMI policies only] Specifies an AMI deprecation rule for cross-Region AMI copies created by an AMI policy.
- Parameters:
interval (
Union
[int
,float
]) – The period after which to deprecate the cross-Region AMI copies. The period must be less than or equal to the cross-Region AMI copy retention period, and it can’t be greater than 10 years. This is equivalent to 120 months, 520 weeks, or 3650 days.interval_unit (
str
) – The unit of time in which to measure the Interval . For example, to deprecate a cross-Region AMI copy after 3 months, specifyInterval=3
andIntervalUnit=MONTHS
.
- See:
- 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_deprecate_rule_property = dlm.CfnLifecyclePolicy.CrossRegionCopyDeprecateRuleProperty( interval=123, interval_unit="intervalUnit" )
Attributes
- interval
The period after which to deprecate the cross-Region AMI copies.
The period must be less than or equal to the cross-Region AMI copy retention period, and it can’t be greater than 10 years. This is equivalent to 120 months, 520 weeks, or 3650 days.
- interval_unit
The unit of time in which to measure the Interval .
For example, to deprecate a cross-Region AMI copy after 3 months, specify
Interval=3
andIntervalUnit=MONTHS
.
CrossRegionCopyRetainRuleProperty
- class CfnLifecyclePolicy.CrossRegionCopyRetainRuleProperty(*, interval, interval_unit)
Bases:
object
Specifies a retention rule for cross-Region snapshot copies created by snapshot or event-based policies, or cross-Region AMI copies created by AMI policies.
After the retention period expires, the cross-Region copy is deleted.
- Parameters:
interval (
Union
[int
,float
]) – The amount of time to retain a cross-Region snapshot or AMI copy. The maximum is 100 years. This is equivalent to 1200 months, 5200 weeks, or 36500 days.interval_unit (
str
) – The unit of time for time-based retention. For example, to retain a cross-Region copy for 3 months, specifyInterval=3
andIntervalUnit=MONTHS
.
- See:
- 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_retain_rule_property = dlm.CfnLifecyclePolicy.CrossRegionCopyRetainRuleProperty( interval=123, interval_unit="intervalUnit" )
Attributes
- interval
The amount of time to retain a cross-Region snapshot or AMI copy.
The maximum is 100 years. This is equivalent to 1200 months, 5200 weeks, or 36500 days.
- interval_unit
The unit of time for time-based retention.
For example, to retain a cross-Region copy for 3 months, specify
Interval=3
andIntervalUnit=MONTHS
.
CrossRegionCopyRuleProperty
- class CfnLifecyclePolicy.CrossRegionCopyRuleProperty(*, encrypted, cmk_arn=None, copy_tags=None, deprecate_rule=None, retain_rule=None, target=None, target_region=None)
Bases:
object
[Custom snapshot and AMI policies only] Specifies a cross-Region copy rule for a snapshot and AMI policies.
To specify a cross-Region copy action for event-based polices, use CrossRegionCopyAction .
- Parameters:
encrypted (
Union
[bool
,IResolvable
]) – To encrypt a copy of an unencrypted snapshot if encryption by default is not enabled, enable encryption using this parameter. Copies of encrypted snapshots are encrypted, even if this parameter is false or if encryption by default is not enabled.cmk_arn (
Optional
[str
]) – The Amazon Resource Name (ARN) of the AWS KMS key to use for EBS encryption. If this parameter is not specified, the default KMS key for the account is used.copy_tags (
Union
[bool
,IResolvable
,None
]) – Indicates whether to copy all user-defined tags from the source snapshot or AMI to the cross-Region copy.deprecate_rule (
Union
[IResolvable
,CrossRegionCopyDeprecateRuleProperty
,Dict
[str
,Any
],None
]) – [Custom AMI policies only] The AMI deprecation rule for cross-Region AMI copies created by the rule.retain_rule (
Union
[IResolvable
,CrossRegionCopyRetainRuleProperty
,Dict
[str
,Any
],None
]) – The retention rule that indicates how long the cross-Region snapshot or AMI copies are to be retained in the destination Region.target (
Optional
[str
]) –Use this parameter for snapshot policies only. For AMI policies, use TargetRegion instead. [Custom snapshot policies only] The target Region or the Amazon Resource Name (ARN) of the target Outpost for the snapshot copies.
target_region (
Optional
[str
]) –Use this parameter for AMI policies only. For snapshot policies, use Target instead. For snapshot policies created before the Target parameter was introduced, this parameter indicates the target Region for snapshot copies. [Custom AMI policies only] The target Region or the Amazon Resource Name (ARN) of the target Outpost for the snapshot copies.
- See:
- 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_rule_property = 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" )
Attributes
- cmk_arn
The Amazon Resource Name (ARN) of the AWS KMS key to use for EBS encryption.
If this parameter is not specified, the default KMS key for the account is used.
- copy_tags
Indicates whether to copy all user-defined tags from the source snapshot or AMI to the cross-Region copy.
- deprecate_rule
[Custom AMI policies only] The AMI deprecation rule for cross-Region AMI copies created by the rule.
- encrypted
To encrypt a copy of an unencrypted snapshot if encryption by default is not enabled, enable encryption using this parameter.
Copies of encrypted snapshots are encrypted, even if this parameter is false or if encryption by default is not enabled.
- retain_rule
The retention rule that indicates how long the cross-Region snapshot or AMI copies are to be retained in the destination Region.
- target
Use this parameter for snapshot policies only. For AMI policies, use TargetRegion instead.
[Custom snapshot policies only] The target Region or the Amazon Resource Name (ARN) of the target Outpost for the snapshot copies.
- target_region
Use this parameter for AMI policies only.
For snapshot policies, use Target instead. For snapshot policies created before the Target parameter was introduced, this parameter indicates the target Region for snapshot copies.
[Custom AMI policies only] The target Region or the Amazon Resource Name (ARN) of the target Outpost for the snapshot copies.
DeprecateRuleProperty
- class CfnLifecyclePolicy.DeprecateRuleProperty(*, count=None, interval=None, interval_unit=None)
Bases:
object
[Custom AMI policies only] Specifies an AMI deprecation rule for AMIs created by an AMI lifecycle policy.
For age-based schedules, you must specify Interval and IntervalUnit . For count-based schedules, you must specify Count .
- Parameters:
count (
Union
[int
,float
,None
]) – If the schedule has a count-based retention rule, this parameter specifies the number of oldest AMIs to deprecate. The count must be less than or equal to the schedule’s retention count, and it can’t be greater than 1000.interval (
Union
[int
,float
,None
]) – If the schedule has an age-based retention rule, this parameter specifies the period after which to deprecate AMIs created by the schedule. The period must be less than or equal to the schedule’s retention period, and it can’t be greater than 10 years. This is equivalent to 120 months, 520 weeks, or 3650 days.interval_unit (
Optional
[str
]) – The unit of time in which to measure the Interval .
- See:
- 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 deprecate_rule_property = dlm.CfnLifecyclePolicy.DeprecateRuleProperty( count=123, interval=123, interval_unit="intervalUnit" )
Attributes
- count
If the schedule has a count-based retention rule, this parameter specifies the number of oldest AMIs to deprecate.
The count must be less than or equal to the schedule’s retention count, and it can’t be greater than 1000.
- interval
If the schedule has an age-based retention rule, this parameter specifies the period after which to deprecate AMIs created by the schedule.
The period must be less than or equal to the schedule’s retention period, and it can’t be greater than 10 years. This is equivalent to 120 months, 520 weeks, or 3650 days.
- interval_unit
The unit of time in which to measure the Interval .
EncryptionConfigurationProperty
- class CfnLifecyclePolicy.EncryptionConfigurationProperty(*, encrypted, cmk_arn=None)
Bases:
object
[Event-based policies only] Specifies the encryption settings for cross-Region snapshot copies created by event-based policies.
- Parameters:
encrypted (
Union
[bool
,IResolvable
]) – To encrypt a copy of an unencrypted snapshot when encryption by default is not enabled, enable encryption using this parameter. Copies of encrypted snapshots are encrypted, even if this parameter is false or when encryption by default is not enabled.cmk_arn (
Optional
[str
]) – The Amazon Resource Name (ARN) of the AWS KMS key to use for EBS encryption. If this parameter is not specified, the default KMS key for the account is used.
- See:
- 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 encryption_configuration_property = dlm.CfnLifecyclePolicy.EncryptionConfigurationProperty( encrypted=False, # the properties below are optional cmk_arn="cmkArn" )
Attributes
- cmk_arn
The Amazon Resource Name (ARN) of the AWS KMS key to use for EBS encryption.
If this parameter is not specified, the default KMS key for the account is used.
- encrypted
To encrypt a copy of an unencrypted snapshot when encryption by default is not enabled, enable encryption using this parameter.
Copies of encrypted snapshots are encrypted, even if this parameter is false or when encryption by default is not enabled.
EventParametersProperty
- class CfnLifecyclePolicy.EventParametersProperty(*, event_type, snapshot_owner, description_regex=None)
Bases:
object
[Event-based policies only] Specifies an event that activates an event-based policy.
- Parameters:
event_type (
str
) – The type of event. Currently, only snapshot sharing events are supported.snapshot_owner (
Sequence
[str
]) – The IDs of the AWS accounts that can trigger policy by sharing snapshots with your account. The policy only runs if one of the specified AWS accounts shares a snapshot with your account.description_regex (
Optional
[str
]) – The snapshot description that can trigger the policy. The description pattern is specified using a regular expression. The policy runs only if a snapshot with a description that matches the specified pattern is shared with your account. For example, specifying^.*Created for policy: policy-1234567890abcdef0.*$
configures the policy to run only if snapshots created by policypolicy-1234567890abcdef0
are shared with your account.
- See:
- 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 event_parameters_property = dlm.CfnLifecyclePolicy.EventParametersProperty( event_type="eventType", snapshot_owner=["snapshotOwner"], # the properties below are optional description_regex="descriptionRegex" )
Attributes
- description_regex
The snapshot description that can trigger the policy.
The description pattern is specified using a regular expression. The policy runs only if a snapshot with a description that matches the specified pattern is shared with your account.
For example, specifying
^.*Created for policy: policy-1234567890abcdef0.*$
configures the policy to run only if snapshots created by policypolicy-1234567890abcdef0
are shared with your account.
- event_type
The type of event.
Currently, only snapshot sharing events are supported.
- snapshot_owner
The IDs of the AWS accounts that can trigger policy by sharing snapshots with your account.
The policy only runs if one of the specified AWS accounts shares a snapshot with your account.
EventSourceProperty
- class CfnLifecyclePolicy.EventSourceProperty(*, type, parameters=None)
Bases:
object
[Event-based policies only] Specifies an event that activates an event-based policy.
- Parameters:
type (
str
) – The source of the event. Currently only managed CloudWatch Events rules are supported.parameters (
Union
[IResolvable
,EventParametersProperty
,Dict
[str
,Any
],None
]) – Information about the event.
- See:
- 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 event_source_property = 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" ) )
Attributes
- parameters
Information about the event.
- type
The source of the event.
Currently only managed CloudWatch Events rules are supported.
ExclusionsProperty
- class CfnLifecyclePolicy.ExclusionsProperty(*, exclude_boot_volumes=None, exclude_tags=None, exclude_volume_types=None)
Bases:
object
[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.
- Parameters:
exclude_boot_volumes (
Union
[bool
,IResolvable
,None
]) – [Default policies for EBS snapshots only] Indicates whether to exclude volumes that are attached to instances as the boot volume. If you exclude boot volumes, only volumes attached as data (non-boot) volumes will be backed up by the policy. To exclude boot volumes, specifytrue
.exclude_tags (
Any
) – [Default policies for EBS-backed AMIs only] Specifies whether to exclude volumes that have specific tags.exclude_volume_types (
Any
) – [Default policies for EBS snapshots only] Specifies the volume types to exclude. Volumes of the specified types will not be targeted by the policy.
- See:
- 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 # exclude_tags: Any # exclude_volume_types: Any exclusions_property = dlm.CfnLifecyclePolicy.ExclusionsProperty( exclude_boot_volumes=False, exclude_tags=exclude_tags, exclude_volume_types=exclude_volume_types )
Attributes
- exclude_boot_volumes
[Default policies for EBS snapshots only] Indicates whether to exclude volumes that are attached to instances as the boot volume.
If you exclude boot volumes, only volumes attached as data (non-boot) volumes will be backed up by the policy. To exclude boot volumes, specify
true
.
- exclude_tags
[Default policies for EBS-backed AMIs only] Specifies whether to exclude volumes that have specific tags.
- exclude_volume_types
[Default policies for EBS snapshots only] Specifies the volume types to exclude.
Volumes of the specified types will not be targeted by the policy.
FastRestoreRuleProperty
- class CfnLifecyclePolicy.FastRestoreRuleProperty(*, availability_zones=None, count=None, interval=None, interval_unit=None)
Bases:
object
[Custom snapshot policies only] Specifies a rule for enabling fast snapshot restore for snapshots created by snapshot policies.
You can enable fast snapshot restore based on either a count or a time interval.
- Parameters:
availability_zones (
Optional
[Sequence
[str
]]) – The Availability Zones in which to enable fast snapshot restore.count (
Union
[int
,float
,None
]) – The number of snapshots to be enabled with fast snapshot restore.interval (
Union
[int
,float
,None
]) – The amount of time to enable fast snapshot restore. The maximum is 100 years. This is equivalent to 1200 months, 5200 weeks, or 36500 days.interval_unit (
Optional
[str
]) – The unit of time for enabling fast snapshot restore.
- See:
- 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 fast_restore_rule_property = dlm.CfnLifecyclePolicy.FastRestoreRuleProperty( availability_zones=["availabilityZones"], count=123, interval=123, interval_unit="intervalUnit" )
Attributes
- availability_zones
The Availability Zones in which to enable fast snapshot restore.
- count
The number of snapshots to be enabled with fast snapshot restore.
- interval
The amount of time to enable fast snapshot restore.
The maximum is 100 years. This is equivalent to 1200 months, 5200 weeks, or 36500 days.
- interval_unit
The unit of time for enabling fast snapshot restore.
ParametersProperty
- class CfnLifecyclePolicy.ParametersProperty(*, exclude_boot_volume=None, exclude_data_volume_tags=None, no_reboot=None)
Bases:
object
[Custom snapshot and AMI policies only] Specifies optional parameters for snapshot and AMI policies.
The set of valid parameters depends on the combination of policy type and target resource type.
If you choose to exclude boot volumes and you specify tags that consequently exclude all of the additional data volumes attached to an instance, then Amazon Data Lifecycle Manager will not create any snapshots for the affected instance, and it will emit a
SnapshotsCreateFailed
Amazon CloudWatch metric. For more information, see Monitor your policies using Amazon CloudWatch .- Parameters:
exclude_boot_volume (
Union
[bool
,IResolvable
,None
]) – [Custom snapshot policies that target instances only] Indicates whether to exclude the root volume from multi-volume snapshot sets. The default isfalse
. If you specifytrue
, then the root volumes attached to targeted instances will be excluded from the multi-volume snapshot sets created by the policy.exclude_data_volume_tags (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,CfnTag
,Dict
[str
,Any
]]],None
]) – [Custom snapshot policies that target instances only] The tags used to identify data (non-root) volumes to exclude from multi-volume snapshot sets. If you create a snapshot lifecycle policy that targets instances and you specify tags for this parameter, then data volumes with the specified tags that are attached to targeted instances will be excluded from the multi-volume snapshot sets created by the policy.no_reboot (
Union
[bool
,IResolvable
,None
]) – [Custom AMI policies only] Indicates whether targeted instances are rebooted when the lifecycle policy runs.true
indicates that targeted instances are not rebooted when the policy runs.false
indicates that target instances are rebooted when the policy runs. The default istrue
(instances are not rebooted).
- See:
- 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 parameters_property = dlm.CfnLifecyclePolicy.ParametersProperty( exclude_boot_volume=False, exclude_data_volume_tags=[CfnTag( key="key", value="value" )], no_reboot=False )
Attributes
- exclude_boot_volume
[Custom snapshot policies that target instances only] Indicates whether to exclude the root volume from multi-volume snapshot sets.
The default is
false
. If you specifytrue
, then the root volumes attached to targeted instances will be excluded from the multi-volume snapshot sets created by the policy.
- exclude_data_volume_tags
[Custom snapshot policies that target instances only] The tags used to identify data (non-root) volumes to exclude from multi-volume snapshot sets.
If you create a snapshot lifecycle policy that targets instances and you specify tags for this parameter, then data volumes with the specified tags that are attached to targeted instances will be excluded from the multi-volume snapshot sets created by the policy.
- no_reboot
[Custom AMI policies only] Indicates whether targeted instances are rebooted when the lifecycle policy runs.
true
indicates that targeted instances are not rebooted when the policy runs.false
indicates that target instances are rebooted when the policy runs. The default istrue
(instances are not rebooted).
PolicyDetailsProperty
- class CfnLifecyclePolicy.PolicyDetailsProperty(*, actions=None, copy_tags=None, create_interval=None, cross_region_copy_targets=None, event_source=None, exclusions=None, extend_deletion=None, parameters=None, policy_language=None, policy_type=None, resource_locations=None, resource_type=None, resource_types=None, retain_interval=None, schedules=None, target_tags=None)
Bases:
object
Specifies the configuration of a lifecycle policy.
- Parameters:
actions (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,ActionProperty
,Dict
[str
,Any
]]],None
]) – [Event-based policies only] The actions to be performed when the event-based policy is activated. You can specify only one action per policy.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 isfalse
. Default: falsecreate_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: 1cross_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.event_source (
Union
[IResolvable
,EventSourceProperty
,Dict
[str
,Any
],None
]) – [Event-based policies only] The event that activates the event-based policy.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.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, specifytrue
. - 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, specifytrue
. If you enable extended deletion ( ExtendDeletion=true ), you override both default behaviors simultaneously. If you do not specify a value, the default isfalse
. Default: falseparameters (
Union
[IResolvable
,ParametersProperty
,Dict
[str
,Any
],None
]) – [Custom snapshot and AMI policies only] A set of optional parameters for snapshot and AMI lifecycle policies. .. epigraph:: If you are modifying a policy that was created or previously modified using the Amazon Data Lifecycle Manager console, then you must include this parameter and specify either the default values or the new values that you require. You can’t omit this parameter or set its values to null.policy_language (
Optional
[str
]) – The type of policy to create. Specify one of the following:. -SIMPLIFIED
To create a default policy. -STANDARD
To create a custom policy.policy_type (
Optional
[str
]) – The type of policy. SpecifyEBS_SNAPSHOT_MANAGEMENT
to create a lifecycle policy that manages the lifecycle of Amazon EBS snapshots. SpecifyIMAGE_MANAGEMENT
to create a lifecycle policy that manages the lifecycle of EBS-backed AMIs. SpecifyEVENT_BASED_POLICY
to create an event-based policy that performs specific actions when a defined event occurs in your AWS account . The default isEBS_SNAPSHOT_MANAGEMENT
.resource_locations (
Optional
[Sequence
[str
]]) – [Custom snapshot and AMI policies only] The location of the resources to backup. If the source resources are located in an AWS Region , specifyCLOUD
. If the source resources are located on an Outpost in your account, specifyOUTPOST
. If you specifyOUTPOST
, Amazon Data Lifecycle Manager backs up all resources of the specified type with matching target tags across all of the Outposts in your account.resource_type (
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, specifyVOLUME
. - 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, specifyINSTANCE
.resource_types (
Optional
[Sequence
[str
]]) – [Custom snapshot policies only] The target resource type for snapshot and AMI lifecycle policies. UseVOLUME
to create snapshots of individual volumes or useINSTANCE
to create multi-volume snapshots from the volumes for an instance.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: 7schedules (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,ScheduleProperty
,Dict
[str
,Any
]]],None
]) – [Custom snapshot and AMI policies only] The schedules of policy-defined actions for snapshot and AMI lifecycle policies. A policy can have up to four schedules—one mandatory schedule and up to three optional schedules.target_tags (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,CfnTag
,Dict
[str
,Any
]]],None
]) – [Custom snapshot and AMI policies only] The single tag that identifies targeted resources for this policy.
- See:
- 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 policy_details_property = 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" )] )
Attributes
- actions
[Event-based policies only] The actions to be performed when the event-based policy is activated.
You can specify only one action per policy.
- 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
- 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
- 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.
- event_source
[Event-based policies only] The event that activates the event-based policy.
- 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.
- 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
- parameters
[Custom snapshot and AMI policies only] A set of optional parameters for snapshot and AMI lifecycle policies.
If you are modifying a policy that was created or previously modified using the Amazon Data Lifecycle Manager console, then you must include this parameter and specify either the default values or the new values that you require. You can’t omit this parameter or set its values to null.
- policy_language
.
SIMPLIFIED
To create a default policy.STANDARD
To create a custom policy.
- See:
- Type:
The type of policy to create. Specify one of the following
- policy_type
The type of policy.
Specify
EBS_SNAPSHOT_MANAGEMENT
to create a lifecycle policy that manages the lifecycle of Amazon EBS snapshots. SpecifyIMAGE_MANAGEMENT
to create a lifecycle policy that manages the lifecycle of EBS-backed AMIs. SpecifyEVENT_BASED_POLICY
to create an event-based policy that performs specific actions when a defined event occurs in your AWS account .The default is
EBS_SNAPSHOT_MANAGEMENT
.
- resource_locations
[Custom snapshot and AMI policies only] The location of the resources to backup.
If the source resources are located in an AWS Region , specify
CLOUD
. If the source resources are located on an Outpost in your account, specifyOUTPOST
.If you specify
OUTPOST
, Amazon Data Lifecycle Manager backs up all resources of the specified type with matching target tags across all of the Outposts in your account.
- resource_type
[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
.
- resource_types
[Custom snapshot policies only] The target resource type for snapshot and AMI lifecycle policies.
Use
VOLUME
to create snapshots of individual volumes or useINSTANCE
to create multi-volume snapshots from the volumes for an instance.
- 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
- schedules
[Custom snapshot and AMI policies only] The schedules of policy-defined actions for snapshot and AMI lifecycle policies.
A policy can have up to four schedules—one mandatory schedule and up to three optional schedules.
- target_tags
[Custom snapshot and AMI policies only] The single tag that identifies targeted resources for this policy.
RetainRuleProperty
- class CfnLifecyclePolicy.RetainRuleProperty(*, count=None, interval=None, interval_unit=None)
Bases:
object
[Custom snapshot and AMI policies only] Specifies a retention rule for snapshots created by snapshot policies, or for AMIs created by AMI policies.
For snapshot policies that have an ArchiveRule , this retention rule applies to standard tier retention. When the retention threshold is met, snapshots are moved from the standard to the archive tier.
For snapshot policies that do not have an ArchiveRule , snapshots are permanently deleted when this retention threshold is met.
You can retain snapshots based on either a count or a time interval.
Count-based retention
You must specify Count . If you specify an ArchiveRule for the schedule, then you can specify a retention count of
0
to archive snapshots immediately after creation. If you specify a FastRestoreRule , ShareRule , or a CrossRegionCopyRule , then you must specify a retention count of1
or more.Age-based retention
You must specify Interval and IntervalUnit . If you specify an ArchiveRule for the schedule, then you can specify a retention interval of
0
days to archive snapshots immediately after creation. If you specify a FastRestoreRule , ShareRule , or a CrossRegionCopyRule , then you must specify a retention interval of1
day or more.- Parameters:
count (
Union
[int
,float
,None
]) –The number of snapshots to retain for each volume, up to a maximum of 1000. For example if you want to retain a maximum of three snapshots, specify
3
. When the fourth snapshot is created, the oldest retained snapshot is deleted, or it is moved to the archive tier if you have specified an ArchiveRule .interval (
Union
[int
,float
,None
]) – The amount of time to retain each snapshot. The maximum is 100 years. This is equivalent to 1200 months, 5200 weeks, or 36500 days.interval_unit (
Optional
[str
]) –The unit of time for time-based retention. For example, to retain snapshots for 3 months, specify
Interval=3
andIntervalUnit=MONTHS
. Once the snapshot has been retained for 3 months, it is deleted, or it is moved to the archive tier if you have specified an ArchiveRule .
- See:
- 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 retain_rule_property = dlm.CfnLifecyclePolicy.RetainRuleProperty( count=123, interval=123, interval_unit="intervalUnit" )
Attributes
- count
The number of snapshots to retain for each volume, up to a maximum of 1000.
For example if you want to retain a maximum of three snapshots, specify
3
. When the fourth snapshot is created, the oldest retained snapshot is deleted, or it is moved to the archive tier if you have specified an ArchiveRule .
- interval
The amount of time to retain each snapshot.
The maximum is 100 years. This is equivalent to 1200 months, 5200 weeks, or 36500 days.
- interval_unit
The unit of time for time-based retention.
For example, to retain snapshots for 3 months, specify
Interval=3
andIntervalUnit=MONTHS
. Once the snapshot has been retained for 3 months, it is deleted, or it is moved to the archive tier if you have specified an ArchiveRule .
RetentionArchiveTierProperty
- class CfnLifecyclePolicy.RetentionArchiveTierProperty(*, count=None, interval=None, interval_unit=None)
Bases:
object
[Custom snapshot policies only] Describes the retention rule for archived snapshots.
Once the archive retention threshold is met, the snapshots are permanently deleted from the archive tier. .. epigraph:
The archive retention rule must retain snapshots in the archive tier for a minimum of 90 days.
For count-based schedules , you must specify Count . For age-based schedules , you must specify Interval and IntervalUnit .
For more information about using snapshot archiving, see Considerations for snapshot lifecycle policies .
- Parameters:
count (
Union
[int
,float
,None
]) – The maximum number of snapshots to retain in the archive storage tier for each volume. The count must ensure that each snapshot remains in the archive tier for at least 90 days. For example, if the schedule creates snapshots every 30 days, you must specify a count of 3 or more to ensure that each snapshot is archived for at least 90 days.interval (
Union
[int
,float
,None
]) – Specifies the period of time to retain snapshots in the archive tier. After this period expires, the snapshot is permanently deleted.interval_unit (
Optional
[str
]) – The unit of time in which to measure the Interval . For example, to retain a snapshots in the archive tier for 6 months, specifyInterval=6
andIntervalUnit=MONTHS
.
- See:
- 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 retention_archive_tier_property = dlm.CfnLifecyclePolicy.RetentionArchiveTierProperty( count=123, interval=123, interval_unit="intervalUnit" )
Attributes
- count
The maximum number of snapshots to retain in the archive storage tier for each volume.
The count must ensure that each snapshot remains in the archive tier for at least 90 days. For example, if the schedule creates snapshots every 30 days, you must specify a count of 3 or more to ensure that each snapshot is archived for at least 90 days.
- interval
Specifies the period of time to retain snapshots in the archive tier.
After this period expires, the snapshot is permanently deleted.
- interval_unit
The unit of time in which to measure the Interval .
For example, to retain a snapshots in the archive tier for 6 months, specify
Interval=6
andIntervalUnit=MONTHS
.
ScheduleProperty
- class CfnLifecyclePolicy.ScheduleProperty(*, archive_rule=None, copy_tags=None, create_rule=None, cross_region_copy_rules=None, deprecate_rule=None, fast_restore_rule=None, name=None, retain_rule=None, share_rules=None, tags_to_add=None, variable_tags=None)
Bases:
object
[Custom snapshot and AMI policies only] Specifies a schedule for a snapshot or AMI lifecycle policy.
- Parameters:
archive_rule (
Union
[IResolvable
,ArchiveRuleProperty
,Dict
[str
,Any
],None
]) –[Custom snapshot policies that target volumes only] The snapshot archiving rule for the schedule. When you specify an archiving rule, snapshots are automatically moved from the standard tier to the archive tier once the schedule’s retention threshold is met. Snapshots are then retained in the archive tier for the archive retention period that you specify. For more information about using snapshot archiving, see Considerations for snapshot lifecycle policies .
copy_tags (
Union
[bool
,IResolvable
,None
]) – Copy all user-defined tags on a source volume to snapshots of the volume created by this policy.create_rule (
Union
[IResolvable
,CreateRuleProperty
,Dict
[str
,Any
],None
]) – The creation rule.cross_region_copy_rules (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,CrossRegionCopyRuleProperty
,Dict
[str
,Any
]]],None
]) – Specifies a rule for copying snapshots or AMIs across regions. .. epigraph:: You can’t specify cross-Region copy rules for policies that create snapshots on an Outpost. If the policy creates snapshots in a Region, then snapshots can be copied to up to three Regions or Outposts.deprecate_rule (
Union
[IResolvable
,DeprecateRuleProperty
,Dict
[str
,Any
],None
]) – [Custom AMI policies only] The AMI deprecation rule for the schedule.fast_restore_rule (
Union
[IResolvable
,FastRestoreRuleProperty
,Dict
[str
,Any
],None
]) – [Custom snapshot policies only] The rule for enabling fast snapshot restore.name (
Optional
[str
]) – The name of the schedule.retain_rule (
Union
[IResolvable
,RetainRuleProperty
,Dict
[str
,Any
],None
]) – The retention rule for snapshots or AMIs created by the policy.share_rules (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,ShareRuleProperty
,Dict
[str
,Any
]]],None
]) – [Custom snapshot policies only] The rule for sharing snapshots with other AWS accounts .tags_to_add (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,CfnTag
,Dict
[str
,Any
]]],None
]) – The tags to apply to policy-created resources. These user-defined tags are in addition to the AWS -added lifecycle tags.variable_tags (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,CfnTag
,Dict
[str
,Any
]]],None
]) – [AMI policies and snapshot policies that target instances only] A collection of key/value pairs with values determined dynamically when the policy is executed. Keys may be any valid Amazon EC2 tag key. Values must be in one of the two following formats:$(instance-id)
or$(timestamp)
. Variable tags are only valid for EBS Snapshot Management – Instance policies.
- See:
- 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 schedule_property = 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" )] )
Attributes
- archive_rule
[Custom snapshot policies that target volumes only] The snapshot archiving rule for the schedule.
When you specify an archiving rule, snapshots are automatically moved from the standard tier to the archive tier once the schedule’s retention threshold is met. Snapshots are then retained in the archive tier for the archive retention period that you specify.
For more information about using snapshot archiving, see Considerations for snapshot lifecycle policies .
- copy_tags
Copy all user-defined tags on a source volume to snapshots of the volume created by this policy.
- create_rule
The creation rule.
- cross_region_copy_rules
Specifies a rule for copying snapshots or AMIs across regions.
You can’t specify cross-Region copy rules for policies that create snapshots on an Outpost. If the policy creates snapshots in a Region, then snapshots can be copied to up to three Regions or Outposts.
- deprecate_rule
[Custom AMI policies only] The AMI deprecation rule for the schedule.
- fast_restore_rule
[Custom snapshot policies only] The rule for enabling fast snapshot restore.
- name
The name of the schedule.
- retain_rule
The retention rule for snapshots or AMIs created by the policy.
[Custom snapshot policies only] The rule for sharing snapshots with other AWS accounts .
- tags_to_add
The tags to apply to policy-created resources.
These user-defined tags are in addition to the AWS -added lifecycle tags.
- variable_tags
[AMI policies and snapshot policies that target instances only] A collection of key/value pairs with values determined dynamically when the policy is executed.
Keys may be any valid Amazon EC2 tag key. Values must be in one of the two following formats:
$(instance-id)
or$(timestamp)
. Variable tags are only valid for EBS Snapshot Management – Instance policies.
ScriptProperty
- class CfnLifecyclePolicy.ScriptProperty(*, execute_operation_on_script_failure=None, execution_handler=None, execution_handler_service=None, execution_timeout=None, maximum_retry_count=None, stages=None)
Bases:
object
[Custom snapshot policies that target instances only] Information about pre and/or post scripts for a snapshot lifecycle policy that targets instances.
For more information, see Automating application-consistent snapshots with pre and post scripts .
- Parameters:
execute_operation_on_script_failure (
Union
[bool
,IResolvable
,None
]) – Indicates whether Amazon Data Lifecycle Manager should default to crash-consistent snapshots if the pre script fails. - To default to crash consistent snapshot if the pre script fails, specifytrue
. - To skip the instance for snapshot creation if the pre script fails, specifyfalse
. This parameter is supported only if you run a pre script. If you run a post script only, omit this parameter. Default: trueexecution_handler (
Optional
[str
]) – The SSM document that includes the pre and/or post scripts to run. - If you are automating VSS backups, specifyAWS_VSS_BACKUP
. In this case, Amazon Data Lifecycle Manager automatically uses theAWSEC2-CreateVssSnapshot
SSM document. - If you are automating application-consistent snapshots for SAP HANA workloads, specifyAWSSystemsManagerSAP-CreateDLMSnapshotForSAPHANA
. - If you are using a custom SSM document that you own, specify either the name or ARN of the SSM document. If you are using a custom SSM document that is shared with you, specify the ARN of the SSM document.execution_handler_service (
Optional
[str
]) – Indicates the service used to execute the pre and/or post scripts. - If you are using custom SSM documents or automating application-consistent snapshots of SAP HANA workloads, specifyAWS_SYSTEMS_MANAGER
. - If you are automating VSS Backups, omit this parameter. Default: AWS_SYSTEMS_MANAGERexecution_timeout (
Union
[int
,float
,None
]) – Specifies a timeout period, in seconds, after which Amazon Data Lifecycle Manager fails the script run attempt if it has not completed. If a script does not complete within its timeout period, Amazon Data Lifecycle Manager fails the attempt. The timeout period applies to the pre and post scripts individually. If you are automating VSS Backups, omit this parameter. Default: 10maximum_retry_count (
Union
[int
,float
,None
]) – Specifies the number of times Amazon Data Lifecycle Manager should retry scripts that fail. - If the pre script fails, Amazon Data Lifecycle Manager retries the entire snapshot creation process, including running the pre and post scripts. - If the post script fails, Amazon Data Lifecycle Manager retries the post script only; in this case, the pre script will have completed and the snapshot might have been created. If you do not want Amazon Data Lifecycle Manager to retry failed scripts, specify0
. Default: 0stages (
Optional
[Sequence
[str
]]) – Indicate which scripts Amazon Data Lifecycle Manager should run on target instances. Pre scripts run before Amazon Data Lifecycle Manager initiates snapshot creation. Post scripts run after Amazon Data Lifecycle Manager initiates snapshot creation. - To run a pre script only, specifyPRE
. In this case, Amazon Data Lifecycle Manager calls the SSM document with thepre-script
parameter before initiating snapshot creation. - To run a post script only, specifyPOST
. In this case, Amazon Data Lifecycle Manager calls the SSM document with thepost-script
parameter after initiating snapshot creation. - To run both pre and post scripts, specify bothPRE
andPOST
. In this case, Amazon Data Lifecycle Manager calls the SSM document with thepre-script
parameter before initiating snapshot creation, and then it calls the SSM document again with thepost-script
parameter after initiating snapshot creation. If you are automating VSS Backups, omit this parameter. Default: PRE and POST
- See:
- 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 script_property = 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"] )
Attributes
- execute_operation_on_script_failure
Indicates whether Amazon Data Lifecycle Manager should default to crash-consistent snapshots if the pre script fails.
To default to crash consistent snapshot if the pre script fails, specify
true
.To skip the instance for snapshot creation if the pre script fails, specify
false
.
This parameter is supported only if you run a pre script. If you run a post script only, omit this parameter.
Default: true
- execution_handler
The SSM document that includes the pre and/or post scripts to run.
If you are automating VSS backups, specify
AWS_VSS_BACKUP
. In this case, Amazon Data Lifecycle Manager automatically uses theAWSEC2-CreateVssSnapshot
SSM document.If you are automating application-consistent snapshots for SAP HANA workloads, specify
AWSSystemsManagerSAP-CreateDLMSnapshotForSAPHANA
.If you are using a custom SSM document that you own, specify either the name or ARN of the SSM document. If you are using a custom SSM document that is shared with you, specify the ARN of the SSM document.
- execution_handler_service
Indicates the service used to execute the pre and/or post scripts.
If you are using custom SSM documents or automating application-consistent snapshots of SAP HANA workloads, specify
AWS_SYSTEMS_MANAGER
.If you are automating VSS Backups, omit this parameter.
Default: AWS_SYSTEMS_MANAGER
- execution_timeout
Specifies a timeout period, in seconds, after which Amazon Data Lifecycle Manager fails the script run attempt if it has not completed.
If a script does not complete within its timeout period, Amazon Data Lifecycle Manager fails the attempt. The timeout period applies to the pre and post scripts individually.
If you are automating VSS Backups, omit this parameter.
Default: 10
- maximum_retry_count
Specifies the number of times Amazon Data Lifecycle Manager should retry scripts that fail.
If the pre script fails, Amazon Data Lifecycle Manager retries the entire snapshot creation process, including running the pre and post scripts.
If the post script fails, Amazon Data Lifecycle Manager retries the post script only; in this case, the pre script will have completed and the snapshot might have been created.
If you do not want Amazon Data Lifecycle Manager to retry failed scripts, specify
0
.Default: 0
- stages
Indicate which scripts Amazon Data Lifecycle Manager should run on target instances.
Pre scripts run before Amazon Data Lifecycle Manager initiates snapshot creation. Post scripts run after Amazon Data Lifecycle Manager initiates snapshot creation.
To run a pre script only, specify
PRE
. In this case, Amazon Data Lifecycle Manager calls the SSM document with thepre-script
parameter before initiating snapshot creation.To run a post script only, specify
POST
. In this case, Amazon Data Lifecycle Manager calls the SSM document with thepost-script
parameter after initiating snapshot creation.To run both pre and post scripts, specify both
PRE
andPOST
. In this case, Amazon Data Lifecycle Manager calls the SSM document with thepre-script
parameter before initiating snapshot creation, and then it calls the SSM document again with thepost-script
parameter after initiating snapshot creation.
If you are automating VSS Backups, omit this parameter.
Default: PRE and POST