Class CfnLifecyclePolicy
java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.CfnElement
software.amazon.awscdk.CfnRefElement
software.amazon.awscdk.CfnResource
software.amazon.awscdk.services.dlm.CfnLifecyclePolicy
- All Implemented Interfaces:
IInspectable,ITaggable,ILifecyclePolicyRef,software.amazon.jsii.JsiiSerializable,software.constructs.IConstruct,software.constructs.IDependable
@Generated(value="jsii-pacmak/1.116.0 (build 0eddcff)",
date="2025-10-24T13:34:34.976Z")
@Stability(Stable)
public class CfnLifecyclePolicy
extends CfnResource
implements IInspectable, ILifecyclePolicyRef, ITaggable
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.
Example:
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.dlm.*;
Object crossRegionCopyTargets;
Object excludeTags;
Object excludeVolumeTypes;
CfnLifecyclePolicy cfnLifecyclePolicy = CfnLifecyclePolicy.Builder.create(this, "MyCfnLifecyclePolicy")
.copyTags(false)
.createInterval(123)
.crossRegionCopyTargets(crossRegionCopyTargets)
.defaultPolicy("defaultPolicy")
.description("description")
.exclusions(ExclusionsProperty.builder()
.excludeBootVolumes(false)
.excludeTags(excludeTags)
.excludeVolumeTypes(excludeVolumeTypes)
.build())
.executionRoleArn("executionRoleArn")
.extendDeletion(false)
.policyDetails(PolicyDetailsProperty.builder()
.actions(List.of(ActionProperty.builder()
.crossRegionCopy(List.of(CrossRegionCopyActionProperty.builder()
.encryptionConfiguration(EncryptionConfigurationProperty.builder()
.encrypted(false)
// the properties below are optional
.cmkArn("cmkArn")
.build())
.target("target")
// the properties below are optional
.retainRule(CrossRegionCopyRetainRuleProperty.builder()
.interval(123)
.intervalUnit("intervalUnit")
.build())
.build()))
.name("name")
.build()))
.copyTags(false)
.createInterval(123)
.crossRegionCopyTargets(crossRegionCopyTargets)
.eventSource(EventSourceProperty.builder()
.type("type")
// the properties below are optional
.parameters(EventParametersProperty.builder()
.eventType("eventType")
.snapshotOwner(List.of("snapshotOwner"))
// the properties below are optional
.descriptionRegex("descriptionRegex")
.build())
.build())
.exclusions(ExclusionsProperty.builder()
.excludeBootVolumes(false)
.excludeTags(excludeTags)
.excludeVolumeTypes(excludeVolumeTypes)
.build())
.extendDeletion(false)
.parameters(ParametersProperty.builder()
.excludeBootVolume(false)
.excludeDataVolumeTags(List.of(CfnTag.builder()
.key("key")
.value("value")
.build()))
.noReboot(false)
.build())
.policyLanguage("policyLanguage")
.policyType("policyType")
.resourceLocations(List.of("resourceLocations"))
.resourceType("resourceType")
.resourceTypes(List.of("resourceTypes"))
.retainInterval(123)
.schedules(List.of(ScheduleProperty.builder()
.archiveRule(ArchiveRuleProperty.builder()
.retainRule(ArchiveRetainRuleProperty.builder()
.retentionArchiveTier(RetentionArchiveTierProperty.builder()
.count(123)
.interval(123)
.intervalUnit("intervalUnit")
.build())
.build())
.build())
.copyTags(false)
.createRule(CreateRuleProperty.builder()
.cronExpression("cronExpression")
.interval(123)
.intervalUnit("intervalUnit")
.location("location")
.scripts(List.of(ScriptProperty.builder()
.executeOperationOnScriptFailure(false)
.executionHandler("executionHandler")
.executionHandlerService("executionHandlerService")
.executionTimeout(123)
.maximumRetryCount(123)
.stages(List.of("stages"))
.build()))
.times(List.of("times"))
.build())
.crossRegionCopyRules(List.of(CrossRegionCopyRuleProperty.builder()
.encrypted(false)
// the properties below are optional
.cmkArn("cmkArn")
.copyTags(false)
.deprecateRule(CrossRegionCopyDeprecateRuleProperty.builder()
.interval(123)
.intervalUnit("intervalUnit")
.build())
.retainRule(CrossRegionCopyRetainRuleProperty.builder()
.interval(123)
.intervalUnit("intervalUnit")
.build())
.target("target")
.targetRegion("targetRegion")
.build()))
.deprecateRule(DeprecateRuleProperty.builder()
.count(123)
.interval(123)
.intervalUnit("intervalUnit")
.build())
.fastRestoreRule(FastRestoreRuleProperty.builder()
.availabilityZones(List.of("availabilityZones"))
.count(123)
.interval(123)
.intervalUnit("intervalUnit")
.build())
.name("name")
.retainRule(RetainRuleProperty.builder()
.count(123)
.interval(123)
.intervalUnit("intervalUnit")
.build())
.shareRules(List.of(ShareRuleProperty.builder()
.targetAccounts(List.of("targetAccounts"))
.unshareInterval(123)
.unshareIntervalUnit("unshareIntervalUnit")
.build()))
.tagsToAdd(List.of(CfnTag.builder()
.key("key")
.value("value")
.build()))
.variableTags(List.of(CfnTag.builder()
.key("key")
.value("value")
.build()))
.build()))
.targetTags(List.of(CfnTag.builder()
.key("key")
.value("value")
.build()))
.build())
.retainInterval(123)
.state("state")
.tags(List.of(CfnTag.builder()
.key("key")
.value("value")
.build()))
.build();
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface[Event-based policies only] Specifies an action for an event-based policy.static interface[Custom snapshot policies only] Specifies information about the archive storage tier retention period.static interface[Custom snapshot policies only] Specifies a snapshot archiving rule for a schedule.static final classA fluent builder forCfnLifecyclePolicy.static interface[Custom snapshot and AMI policies only] Specifies when the policy should create snapshots or AMIs.static interface[Event-based policies only] Specifies a cross-Region copy action for event-based policies.static interface[Custom AMI policies only] Specifies an AMI deprecation rule for cross-Region AMI copies created by an AMI policy.static interfaceSpecifies a retention rule for cross-Region snapshot copies created by snapshot or event-based policies, or cross-Region AMI copies created by AMI policies.static interface[Custom snapshot and AMI policies only] Specifies a cross-Region copy rule for a snapshot and AMI policies.static interface[Custom AMI policies only] Specifies an AMI deprecation rule for AMIs created by an AMI lifecycle policy.static interface[Event-based policies only] Specifies the encryption settings for cross-Region snapshot copies created by event-based policies.static interface[Event-based policies only] Specifies an event that activates an event-based policy.static interface[Event-based policies only] Specifies an event that activates an event-based policy.static interface[Default policies only] Specifies exclusion parameters for volumes or instances for which you do not want to create snapshots or AMIs.static interface[Custom snapshot policies only] Specifies a rule for enabling fast snapshot restore for snapshots created by snapshot policies.static interface[Custom snapshot and AMI policies only] Specifies optional parameters for snapshot and AMI policies.static interfaceSpecifies the configuration of a lifecycle policy.static interface[Custom snapshot and AMI policies only] Specifies a retention rule for snapshots created by snapshot policies, or for AMIs created by AMI policies.static interface[Custom snapshot policies only] Describes the retention rule for archived snapshots.static interface[Custom snapshot and AMI policies only] Specifies a schedule for a snapshot or AMI lifecycle policy.static interface[Custom snapshot policies that target instances only] Information about pre and/or post scripts for a snapshot lifecycle policy that targets instances.static interface[Custom snapshot policies only] Specifies a rule for sharing snapshots across AWS accounts .Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.IInspectable
IInspectable.Jsii$Default, IInspectable.Jsii$ProxyNested classes/interfaces inherited from interface software.amazon.awscdk.services.dlm.ILifecyclePolicyRef
ILifecyclePolicyRef.Jsii$Default, ILifecyclePolicyRef.Jsii$ProxyNested classes/interfaces inherited from interface software.amazon.awscdk.ITaggable
ITaggable.Jsii$Default, ITaggable.Jsii$Proxy -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe CloudFormation resource type name for this resource class. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCfnLifecyclePolicy(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedCfnLifecyclePolicy(software.amazon.jsii.JsiiObjectRef objRef) CfnLifecyclePolicy(software.constructs.Construct scope, String id) CfnLifecyclePolicy(software.constructs.Construct scope, String id, CfnLifecyclePolicyProps props) -
Method Summary
Modifier and TypeMethodDescriptionThe Amazon Resource Name (ARN) of the lifecycle policy.[Default policies only] Indicates whether the policy should copy tags from the source resource to the snapshot or AMI.[Default policies only] Specifies how often the policy should run and create snapshots or AMIs.[Default policies only] Specifies destination Regions for snapshot or AMI copies.[Default policies only] Specify the type of default policy to create.A description of the lifecycle policy.[Default policies only] Specifies exclusion parameters for volumes or instances for which you do not want to create snapshots or AMIs.The Amazon Resource Name (ARN) of the IAM role used to run the operations specified by the lifecycle policy.[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.A reference to a LifecyclePolicy resource.The configuration details of the lifecycle policy.[Default policies only] Specifies how long the policy should retain snapshots or AMIs before deleting them.getState()The activation state of the lifecycle policy.getTags()Tag Manager which manages the tags for this resource.The tags to apply to the lifecycle policy during creation.voidinspect(TreeInspector inspector) Examines the CloudFormation resource and discloses attributes.renderProperties(Map<String, Object> props) voidsetCopyTags(Boolean value) [Default policies only] Indicates whether the policy should copy tags from the source resource to the snapshot or AMI.voidsetCopyTags(IResolvable value) [Default policies only] Indicates whether the policy should copy tags from the source resource to the snapshot or AMI.voidsetCreateInterval(Number value) [Default policies only] Specifies how often the policy should run and create snapshots or AMIs.voidsetCrossRegionCopyTargets(Object value) [Default policies only] Specifies destination Regions for snapshot or AMI copies.voidsetDefaultPolicy(String value) [Default policies only] Specify the type of default policy to create.voidsetDescription(String value) A description of the lifecycle policy.voidsetExclusions(IResolvable value) [Default policies only] Specifies exclusion parameters for volumes or instances for which you do not want to create snapshots or AMIs.void[Default policies only] Specifies exclusion parameters for volumes or instances for which you do not want to create snapshots or AMIs.voidsetExecutionRoleArn(String value) The Amazon Resource Name (ARN) of the IAM role used to run the operations specified by the lifecycle policy.voidsetExtendDeletion(Boolean value) [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.voidsetExtendDeletion(IResolvable value) [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.voidsetPolicyDetails(IResolvable value) The configuration details of the lifecycle policy.voidThe configuration details of the lifecycle policy.voidsetRetainInterval(Number value) [Default policies only] Specifies how long the policy should retain snapshots or AMIs before deleting them.voidThe activation state of the lifecycle policy.voidsetTagsRaw(List<CfnTag> value) The tags to apply to the lifecycle policy during creation.Methods inherited from class software.amazon.awscdk.CfnResource
addDeletionOverride, addDependency, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getAtt, getCfnOptions, getCfnResourceType, getMetadata, getUpdatedProperites, getUpdatedProperties, isCfnResource, obtainDependencies, obtainResourceDependencies, removeDependency, replaceDependency, shouldSynthesize, toString, validatePropertiesMethods inherited from class software.amazon.awscdk.CfnRefElement
getRefMethods inherited from class software.amazon.awscdk.CfnElement
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalIdMethods inherited from class software.constructs.Construct
getNode, isConstructMethods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface software.constructs.IConstruct
getNodeMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
-
-
Constructor Details
-
CfnLifecyclePolicy
protected CfnLifecyclePolicy(software.amazon.jsii.JsiiObjectRef objRef) -
CfnLifecyclePolicy
protected CfnLifecyclePolicy(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
CfnLifecyclePolicy
@Stability(Stable) public CfnLifecyclePolicy(@NotNull software.constructs.Construct scope, @NotNull String id, @Nullable CfnLifecyclePolicyProps props) - Parameters:
scope- Scope in which this resource is defined. This parameter is required.id- Construct identifier for this resource (unique in its scope). This parameter is required.props- Resource properties.
-
CfnLifecyclePolicy
@Stability(Stable) public CfnLifecyclePolicy(@NotNull software.constructs.Construct scope, @NotNull String id) - Parameters:
scope- Scope in which this resource is defined. This parameter is required.id- Construct identifier for this resource (unique in its scope). This parameter is required.
-
-
Method Details
-
inspect
Examines the CloudFormation resource and discloses attributes.- Specified by:
inspectin interfaceIInspectable- Parameters:
inspector- tree inspector to collect and process attributes. This parameter is required.
-
renderProperties
@Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String, Object> props) - Overrides:
renderPropertiesin classCfnResource- Parameters:
props- This parameter is required.
-
getAttrArn
The Amazon Resource Name (ARN) of the lifecycle policy. -
getAttrId
-
getCfnProperties
- Overrides:
getCfnPropertiesin classCfnResource
-
getLifecyclePolicyRef
A reference to a LifecyclePolicy resource.- Specified by:
getLifecyclePolicyRefin interfaceILifecyclePolicyRef
-
getTags
Tag Manager which manages the tags for this resource. -
getCopyTags
[Default policies only] Indicates whether the policy should copy tags from the source resource to the snapshot or AMI.Returns union: either
BooleanorIResolvable -
setCopyTags
[Default policies only] Indicates whether the policy should copy tags from the source resource to the snapshot or AMI. -
setCopyTags
[Default policies only] Indicates whether the policy should copy tags from the source resource to the snapshot or AMI. -
getCreateInterval
[Default policies only] Specifies how often the policy should run and create snapshots or AMIs. -
setCreateInterval
[Default policies only] Specifies how often the policy should run and create snapshots or AMIs. -
getCrossRegionCopyTargets
[Default policies only] Specifies destination Regions for snapshot or AMI copies. -
setCrossRegionCopyTargets
[Default policies only] Specifies destination Regions for snapshot or AMI copies. -
getDefaultPolicy
[Default policies only] Specify the type of default policy to create. -
setDefaultPolicy
[Default policies only] Specify the type of default policy to create. -
getDescription
A description of the lifecycle policy. -
setDescription
A description of the lifecycle policy. -
getExclusions
[Default policies only] Specifies exclusion parameters for volumes or instances for which you do not want to create snapshots or AMIs.Returns union: either
IResolvableorCfnLifecyclePolicy.ExclusionsProperty -
setExclusions
[Default policies only] Specifies exclusion parameters for volumes or instances for which you do not want to create snapshots or AMIs. -
setExclusions
[Default policies only] Specifies exclusion parameters for volumes or instances for which you do not want to create snapshots or AMIs. -
getExecutionRoleArn
The Amazon Resource Name (ARN) of the IAM role used to run the operations specified by the lifecycle policy. -
setExecutionRoleArn
The Amazon Resource Name (ARN) of the IAM role used to run the operations specified by the lifecycle policy. -
getExtendDeletion
[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.Returns union: either
BooleanorIResolvable -
setExtendDeletion
[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. -
setExtendDeletion
[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. -
getPolicyDetails
The configuration details of the lifecycle policy.Returns union: either
IResolvableorCfnLifecyclePolicy.PolicyDetailsProperty -
setPolicyDetails
The configuration details of the lifecycle policy. -
setPolicyDetails
@Stability(Stable) public void setPolicyDetails(@Nullable CfnLifecyclePolicy.PolicyDetailsProperty value) The configuration details of the lifecycle policy. -
getRetainInterval
[Default policies only] Specifies how long the policy should retain snapshots or AMIs before deleting them. -
setRetainInterval
[Default policies only] Specifies how long the policy should retain snapshots or AMIs before deleting them. -
getState
The activation state of the lifecycle policy. -
setState
The activation state of the lifecycle policy. -
getTagsRaw
The tags to apply to the lifecycle policy during creation. -
setTagsRaw
The tags to apply to the lifecycle policy during creation.
-