AWS Classic

Pulumi Official
Package maintained by Pulumi
v5.9.2 published on Friday, Jun 24, 2022 by Pulumi

LifecyclePolicy

Provides a Data Lifecycle Manager (DLM) lifecycle policy for managing snapshots.

Example Usage

Basic

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var dlmLifecycleRole = new Aws.Iam.Role("dlmLifecycleRole", new Aws.Iam.RoleArgs
        {
            AssumeRolePolicy = @"{
  ""Version"": ""2012-10-17"",
  ""Statement"": [
    {
      ""Action"": ""sts:AssumeRole"",
      ""Principal"": {
        ""Service"": ""dlm.amazonaws.com""
      },
      ""Effect"": ""Allow"",
      ""Sid"": """"
    }
  ]
}
",
        });
        var dlmLifecycle = new Aws.Iam.RolePolicy("dlmLifecycle", new Aws.Iam.RolePolicyArgs
        {
            Role = dlmLifecycleRole.Id,
            Policy = @"{
   ""Version"": ""2012-10-17"",
   ""Statement"": [
      {
         ""Effect"": ""Allow"",
         ""Action"": [
            ""ec2:CreateSnapshot"",
            ""ec2:CreateSnapshots"",
            ""ec2:DeleteSnapshot"",
            ""ec2:DescribeInstances"",
            ""ec2:DescribeVolumes"",
            ""ec2:DescribeSnapshots""
         ],
         ""Resource"": ""*""
      },
      {
         ""Effect"": ""Allow"",
         ""Action"": [
            ""ec2:CreateTags""
         ],
         ""Resource"": ""arn:aws:ec2:*::snapshot/*""
      }
   ]
}
",
        });
        var example = new Aws.Dlm.LifecyclePolicy("example", new Aws.Dlm.LifecyclePolicyArgs
        {
            Description = "example DLM lifecycle policy",
            ExecutionRoleArn = dlmLifecycleRole.Arn,
            State = "ENABLED",
            PolicyDetails = new Aws.Dlm.Inputs.LifecyclePolicyPolicyDetailsArgs
            {
                ResourceTypes = 
                {
                    "VOLUME",
                },
                Schedules = 
                {
                    new Aws.Dlm.Inputs.LifecyclePolicyPolicyDetailsScheduleArgs
                    {
                        Name = "2 weeks of daily snapshots",
                        CreateRule = new Aws.Dlm.Inputs.LifecyclePolicyPolicyDetailsScheduleCreateRuleArgs
                        {
                            Interval = 24,
                            IntervalUnit = "HOURS",
                            Times = 
                            {
                                "23:45",
                            },
                        },
                        RetainRule = new Aws.Dlm.Inputs.LifecyclePolicyPolicyDetailsScheduleRetainRuleArgs
                        {
                            Count = 14,
                        },
                        TagsToAdd = 
                        {
                            { "SnapshotCreator", "DLM" },
                        },
                        CopyTags = false,
                    },
                },
                TargetTags = 
                {
                    { "Snapshot", "true" },
                },
            },
        });
    }

}
package main

import (
	"fmt"

	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/dlm"
	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/iam"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		dlmLifecycleRole, err := iam.NewRole(ctx, "dlmLifecycleRole", &iam.RoleArgs{
			AssumeRolePolicy: pulumi.Any(fmt.Sprintf("%v%v%v%v%v%v%v%v%v%v%v%v%v", "{\n", "  \"Version\": \"2012-10-17\",\n", "  \"Statement\": [\n", "    {\n", "      \"Action\": \"sts:AssumeRole\",\n", "      \"Principal\": {\n", "        \"Service\": \"dlm.amazonaws.com\"\n", "      },\n", "      \"Effect\": \"Allow\",\n", "      \"Sid\": \"\"\n", "    }\n", "  ]\n", "}\n")),
		})
		if err != nil {
			return err
		}
		_, err = iam.NewRolePolicy(ctx, "dlmLifecycle", &iam.RolePolicyArgs{
			Role:   dlmLifecycleRole.ID(),
			Policy: pulumi.Any(fmt.Sprintf("%v%v%v%v%v%v%v%v%v%v%v%v%v%v%v%v%v%v%v%v%v%v%v%v", "{\n", "   \"Version\": \"2012-10-17\",\n", "   \"Statement\": [\n", "      {\n", "         \"Effect\": \"Allow\",\n", "         \"Action\": [\n", "            \"ec2:CreateSnapshot\",\n", "            \"ec2:CreateSnapshots\",\n", "            \"ec2:DeleteSnapshot\",\n", "            \"ec2:DescribeInstances\",\n", "            \"ec2:DescribeVolumes\",\n", "            \"ec2:DescribeSnapshots\"\n", "         ],\n", "         \"Resource\": \"*\"\n", "      },\n", "      {\n", "         \"Effect\": \"Allow\",\n", "         \"Action\": [\n", "            \"ec2:CreateTags\"\n", "         ],\n", "         \"Resource\": \"arn:aws:ec2:*::snapshot/*\"\n", "      }\n", "   ]\n", "}\n")),
		})
		if err != nil {
			return err
		}
		_, err = dlm.NewLifecyclePolicy(ctx, "example", &dlm.LifecyclePolicyArgs{
			Description:      pulumi.String("example DLM lifecycle policy"),
			ExecutionRoleArn: dlmLifecycleRole.Arn,
			State:            pulumi.String("ENABLED"),
			PolicyDetails: &dlm.LifecyclePolicyPolicyDetailsArgs{
				ResourceTypes: pulumi.StringArray{
					pulumi.String("VOLUME"),
				},
				Schedules: dlm.LifecyclePolicyPolicyDetailsScheduleArray{
					&dlm.LifecyclePolicyPolicyDetailsScheduleArgs{
						Name: pulumi.String("2 weeks of daily snapshots"),
						CreateRule: &dlm.LifecyclePolicyPolicyDetailsScheduleCreateRuleArgs{
							Interval:     pulumi.Int(24),
							IntervalUnit: pulumi.String("HOURS"),
							Times: pulumi.String{
								"23:45",
							},
						},
						RetainRule: &dlm.LifecyclePolicyPolicyDetailsScheduleRetainRuleArgs{
							Count: pulumi.Int(14),
						},
						TagsToAdd: pulumi.StringMap{
							"SnapshotCreator": pulumi.String("DLM"),
						},
						CopyTags: pulumi.Bool(false),
					},
				},
				TargetTags: pulumi.StringMap{
					"Snapshot": pulumi.String("true"),
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import java.util.*;
import java.io.*;
import java.nio.*;
import com.pulumi.*;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var dlmLifecycleRole = new Role("dlmLifecycleRole", RoleArgs.builder()        
            .assumeRolePolicy("""
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Action": "sts:AssumeRole",
      "Principal": {
        "Service": "dlm.amazonaws.com"
      },
      "Effect": "Allow",
      "Sid": ""
    }
  ]
}
            """)
            .build());

        var dlmLifecycle = new RolePolicy("dlmLifecycle", RolePolicyArgs.builder()        
            .role(dlmLifecycleRole.id())
            .policy("""
{
   "Version": "2012-10-17",
   "Statement": [
      {
         "Effect": "Allow",
         "Action": [
            "ec2:CreateSnapshot",
            "ec2:CreateSnapshots",
            "ec2:DeleteSnapshot",
            "ec2:DescribeInstances",
            "ec2:DescribeVolumes",
            "ec2:DescribeSnapshots"
         ],
         "Resource": "*"
      },
      {
         "Effect": "Allow",
         "Action": [
            "ec2:CreateTags"
         ],
         "Resource": "arn:aws:ec2:*::snapshot/*"
      }
   ]
}
            """)
            .build());

        var example = new LifecyclePolicy("example", LifecyclePolicyArgs.builder()        
            .description("example DLM lifecycle policy")
            .executionRoleArn(dlmLifecycleRole.arn())
            .state("ENABLED")
            .policyDetails(LifecyclePolicyPolicyDetailsArgs.builder()
                .resourceTypes("VOLUME")
                .schedules(LifecyclePolicyPolicyDetailsScheduleArgs.builder()
                    .name("2 weeks of daily snapshots")
                    .createRule(LifecyclePolicyPolicyDetailsScheduleCreateRuleArgs.builder()
                        .interval(24)
                        .intervalUnit("HOURS")
                        .times("23:45")
                        .build())
                    .retainRule(LifecyclePolicyPolicyDetailsScheduleRetainRuleArgs.builder()
                        .count(14)
                        .build())
                    .tagsToAdd(Map.of("SnapshotCreator", "DLM"))
                    .copyTags(false)
                    .build())
                .targetTags(Map.of("Snapshot", "true"))
                .build())
            .build());

    }
}
import pulumi
import pulumi_aws as aws

dlm_lifecycle_role = aws.iam.Role("dlmLifecycleRole", assume_role_policy="""{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Action": "sts:AssumeRole",
      "Principal": {
        "Service": "dlm.amazonaws.com"
      },
      "Effect": "Allow",
      "Sid": ""
    }
  ]
}
""")
dlm_lifecycle = aws.iam.RolePolicy("dlmLifecycle",
    role=dlm_lifecycle_role.id,
    policy="""{
   "Version": "2012-10-17",
   "Statement": [
      {
         "Effect": "Allow",
         "Action": [
            "ec2:CreateSnapshot",
            "ec2:CreateSnapshots",
            "ec2:DeleteSnapshot",
            "ec2:DescribeInstances",
            "ec2:DescribeVolumes",
            "ec2:DescribeSnapshots"
         ],
         "Resource": "*"
      },
      {
         "Effect": "Allow",
         "Action": [
            "ec2:CreateTags"
         ],
         "Resource": "arn:aws:ec2:*::snapshot/*"
      }
   ]
}
""")
example = aws.dlm.LifecyclePolicy("example",
    description="example DLM lifecycle policy",
    execution_role_arn=dlm_lifecycle_role.arn,
    state="ENABLED",
    policy_details=aws.dlm.LifecyclePolicyPolicyDetailsArgs(
        resource_types=["VOLUME"],
        schedules=[aws.dlm.LifecyclePolicyPolicyDetailsScheduleArgs(
            name="2 weeks of daily snapshots",
            create_rule=aws.dlm.LifecyclePolicyPolicyDetailsScheduleCreateRuleArgs(
                interval=24,
                interval_unit="HOURS",
                times=["23:45"],
            ),
            retain_rule=aws.dlm.LifecyclePolicyPolicyDetailsScheduleRetainRuleArgs(
                count=14,
            ),
            tags_to_add={
                "SnapshotCreator": "DLM",
            },
            copy_tags=False,
        )],
        target_tags={
            "Snapshot": "true",
        },
    ))
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const dlmLifecycleRole = new aws.iam.Role("dlmLifecycleRole", {assumeRolePolicy: `{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Action": "sts:AssumeRole",
      "Principal": {
        "Service": "dlm.amazonaws.com"
      },
      "Effect": "Allow",
      "Sid": ""
    }
  ]
}
`});
const dlmLifecycle = new aws.iam.RolePolicy("dlmLifecycle", {
    role: dlmLifecycleRole.id,
    policy: `{
   "Version": "2012-10-17",
   "Statement": [
      {
         "Effect": "Allow",
         "Action": [
            "ec2:CreateSnapshot",
            "ec2:CreateSnapshots",
            "ec2:DeleteSnapshot",
            "ec2:DescribeInstances",
            "ec2:DescribeVolumes",
            "ec2:DescribeSnapshots"
         ],
         "Resource": "*"
      },
      {
         "Effect": "Allow",
         "Action": [
            "ec2:CreateTags"
         ],
         "Resource": "arn:aws:ec2:*::snapshot/*"
      }
   ]
}
`,
});
const example = new aws.dlm.LifecyclePolicy("example", {
    description: "example DLM lifecycle policy",
    executionRoleArn: dlmLifecycleRole.arn,
    state: "ENABLED",
    policyDetails: {
        resourceTypes: ["VOLUME"],
        schedules: [{
            name: "2 weeks of daily snapshots",
            createRule: {
                interval: 24,
                intervalUnit: "HOURS",
                times: ["23:45"],
            },
            retainRule: {
                count: 14,
            },
            tagsToAdd: {
                SnapshotCreator: "DLM",
            },
            copyTags: false,
        }],
        targetTags: {
            Snapshot: "true",
        },
    },
});
resources:
  dlmLifecycleRole:
    type: aws:iam:Role
    properties:
      assumeRolePolicy: |
        {
          "Version": "2012-10-17",
          "Statement": [
            {
              "Action": "sts:AssumeRole",
              "Principal": {
                "Service": "dlm.amazonaws.com"
              },
              "Effect": "Allow",
              "Sid": ""
            }
          ]
        }        
  dlmLifecycle:
    type: aws:iam:RolePolicy
    properties:
      role: ${dlmLifecycleRole.id}
      policy: |
        {
           "Version": "2012-10-17",
           "Statement": [
              {
                 "Effect": "Allow",
                 "Action": [
                    "ec2:CreateSnapshot",
                    "ec2:CreateSnapshots",
                    "ec2:DeleteSnapshot",
                    "ec2:DescribeInstances",
                    "ec2:DescribeVolumes",
                    "ec2:DescribeSnapshots"
                 ],
                 "Resource": "*"
              },
              {
                 "Effect": "Allow",
                 "Action": [
                    "ec2:CreateTags"
                 ],
                 "Resource": "arn:aws:ec2:*::snapshot/*"
              }
           ]
        }        
  example:
    type: aws:dlm:LifecyclePolicy
    properties:
      description: example DLM lifecycle policy
      executionRoleArn: ${dlmLifecycleRole.arn}
      state: ENABLED
      policyDetails:
        resourceTypes:
          - VOLUME
        schedules:
          - name: 2 weeks of daily snapshots
            createRule:
              interval: 24
              intervalUnit: HOURS
              times:
                - 23:45
            retainRule:
              count: 14
            tagsToAdd:
              SnapshotCreator: DLM
            copyTags: false
        targetTags:
          Snapshot: true

Example Cross-Region Snapshot Copy Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var current = Output.Create(Aws.GetCallerIdentity.InvokeAsync());
        var dlmCrossRegionCopyCmk = new Aws.Kms.Key("dlmCrossRegionCopyCmk", new Aws.Kms.KeyArgs
        {
            Description = "Example Alternate Region KMS Key",
            Policy = current.Apply(current => @$"{{
  ""Version"": ""2012-10-17"",
  ""Id"": ""dlm-cross-region-copy-cmk"",
  ""Statement"": [
    {{
      ""Sid"": ""Enable IAM User Permissions"",
      ""Effect"": ""Allow"",
      ""Principal"": {{
        ""AWS"": ""arn:aws:iam::{current.AccountId}:root""
      }},
      ""Action"": ""kms:*"",
      ""Resource"": ""*""
    }}
  ]
}}
"),
        }, new CustomResourceOptions
        {
            Provider = aws.Alternate,
        });
        var example = new Aws.Dlm.LifecyclePolicy("example", new Aws.Dlm.LifecyclePolicyArgs
        {
            Description = "example DLM lifecycle policy",
            ExecutionRoleArn = aws_iam_role.Dlm_lifecycle_role.Arn,
            State = "ENABLED",
            PolicyDetails = new Aws.Dlm.Inputs.LifecyclePolicyPolicyDetailsArgs
            {
                ResourceTypes = 
                {
                    "VOLUME",
                },
                Schedules = 
                {
                    new Aws.Dlm.Inputs.LifecyclePolicyPolicyDetailsScheduleArgs
                    {
                        Name = "2 weeks of daily snapshots",
                        CreateRule = new Aws.Dlm.Inputs.LifecyclePolicyPolicyDetailsScheduleCreateRuleArgs
                        {
                            Interval = 24,
                            IntervalUnit = "HOURS",
                            Times = 
                            {
                                "23:45",
                            },
                        },
                        RetainRule = new Aws.Dlm.Inputs.LifecyclePolicyPolicyDetailsScheduleRetainRuleArgs
                        {
                            Count = 14,
                        },
                        TagsToAdd = 
                        {
                            { "SnapshotCreator", "DLM" },
                        },
                        CopyTags = false,
                        CrossRegionCopyRules = 
                        {
                            new Aws.Dlm.Inputs.LifecyclePolicyPolicyDetailsScheduleCrossRegionCopyRuleArgs
                            {
                                Target = "us-west-2",
                                Encrypted = true,
                                CmkArn = dlmCrossRegionCopyCmk.Arn,
                                CopyTags = true,
                                RetainRule = new Aws.Dlm.Inputs.LifecyclePolicyPolicyDetailsScheduleCrossRegionCopyRuleRetainRuleArgs
                                {
                                    Interval = 30,
                                    IntervalUnit = "DAYS",
                                },
                            },
                        },
                    },
                },
                TargetTags = 
                {
                    { "Snapshot", "true" },
                },
            },
        });
    }

}
package main

import (
	"fmt"

	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws"
	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/dlm"
	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/kms"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		current, err := aws.GetCallerIdentity(ctx, nil, nil)
		if err != nil {
			return err
		}
		dlmCrossRegionCopyCmk, err := kms.NewKey(ctx, "dlmCrossRegionCopyCmk", &kms.KeyArgs{
			Description: pulumi.String("Example Alternate Region KMS Key"),
			Policy:      pulumi.String(fmt.Sprintf("%v%v%v%v%v%v%v%v%v%v%v%v%v%v%v%v%v", "{\n", "  \"Version\": \"2012-10-17\",\n", "  \"Id\": \"dlm-cross-region-copy-cmk\",\n", "  \"Statement\": [\n", "    {\n", "      \"Sid\": \"Enable IAM User Permissions\",\n", "      \"Effect\": \"Allow\",\n", "      \"Principal\": {\n", "        \"AWS\": \"arn:aws:iam::", current.AccountId, ":root\"\n", "      },\n", "      \"Action\": \"kms:*\",\n", "      \"Resource\": \"*\"\n", "    }\n", "  ]\n", "}\n")),
		}, pulumi.Provider(aws.Alternate))
		if err != nil {
			return err
		}
		_, err = dlm.NewLifecyclePolicy(ctx, "example", &dlm.LifecyclePolicyArgs{
			Description:      pulumi.String("example DLM lifecycle policy"),
			ExecutionRoleArn: pulumi.Any(aws_iam_role.Dlm_lifecycle_role.Arn),
			State:            pulumi.String("ENABLED"),
			PolicyDetails: &dlm.LifecyclePolicyPolicyDetailsArgs{
				ResourceTypes: pulumi.StringArray{
					pulumi.String("VOLUME"),
				},
				Schedules: dlm.LifecyclePolicyPolicyDetailsScheduleArray{
					&dlm.LifecyclePolicyPolicyDetailsScheduleArgs{
						Name: pulumi.String("2 weeks of daily snapshots"),
						CreateRule: &dlm.LifecyclePolicyPolicyDetailsScheduleCreateRuleArgs{
							Interval:     pulumi.Int(24),
							IntervalUnit: pulumi.String("HOURS"),
							Times: pulumi.String{
								"23:45",
							},
						},
						RetainRule: &dlm.LifecyclePolicyPolicyDetailsScheduleRetainRuleArgs{
							Count: pulumi.Int(14),
						},
						TagsToAdd: pulumi.StringMap{
							"SnapshotCreator": pulumi.String("DLM"),
						},
						CopyTags: pulumi.Bool(false),
						CrossRegionCopyRules: dlm.LifecyclePolicyPolicyDetailsScheduleCrossRegionCopyRuleArray{
							&dlm.LifecyclePolicyPolicyDetailsScheduleCrossRegionCopyRuleArgs{
								Target:    pulumi.String("us-west-2"),
								Encrypted: pulumi.Bool(true),
								CmkArn:    dlmCrossRegionCopyCmk.Arn,
								CopyTags:  pulumi.Bool(true),
								RetainRule: &dlm.LifecyclePolicyPolicyDetailsScheduleCrossRegionCopyRuleRetainRuleArgs{
									Interval:     pulumi.Int(30),
									IntervalUnit: pulumi.String("DAYS"),
								},
							},
						},
					},
				},
				TargetTags: pulumi.StringMap{
					"Snapshot": pulumi.String("true"),
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import java.util.*;
import java.io.*;
import java.nio.*;
import com.pulumi.*;
import com.pulumi.resources.CustomResourceOptions;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var current = Output.of(AwsFunctions.getCallerIdentity());

        var dlmCrossRegionCopyCmk = new Key("dlmCrossRegionCopyCmk", KeyArgs.builder()        
            .description("Example Alternate Region KMS Key")
            .policy("""
{
  "Version": "2012-10-17",
  "Id": "dlm-cross-region-copy-cmk",
  "Statement": [
    {
      "Sid": "Enable IAM User Permissions",
      "Effect": "Allow",
      "Principal": {
        "AWS": "arn:aws:iam::%s:root"
      },
      "Action": "kms:*",
      "Resource": "*"
    }
  ]
}
", current.apply(getCallerIdentityResult -> getCallerIdentityResult.accountId())))
            .build(), CustomResourceOptions.builder()
                .provider(aws.alternate())
                .build());

        var example = new LifecyclePolicy("example", LifecyclePolicyArgs.builder()        
            .description("example DLM lifecycle policy")
            .executionRoleArn(aws_iam_role.dlm_lifecycle_role().arn())
            .state("ENABLED")
            .policyDetails(LifecyclePolicyPolicyDetailsArgs.builder()
                .resourceTypes("VOLUME")
                .schedules(LifecyclePolicyPolicyDetailsScheduleArgs.builder()
                    .name("2 weeks of daily snapshots")
                    .createRule(LifecyclePolicyPolicyDetailsScheduleCreateRuleArgs.builder()
                        .interval(24)
                        .intervalUnit("HOURS")
                        .times("23:45")
                        .build())
                    .retainRule(LifecyclePolicyPolicyDetailsScheduleRetainRuleArgs.builder()
                        .count(14)
                        .build())
                    .tagsToAdd(Map.of("SnapshotCreator", "DLM"))
                    .copyTags(false)
                    .crossRegionCopyRules(LifecyclePolicyPolicyDetailsScheduleCrossRegionCopyRuleArgs.builder()
                        .target("us-west-2")
                        .encrypted(true)
                        .cmkArn(dlmCrossRegionCopyCmk.arn())
                        .copyTags(true)
                        .retainRule(LifecyclePolicyPolicyDetailsScheduleCrossRegionCopyRuleRetainRuleArgs.builder()
                            .interval(30)
                            .intervalUnit("DAYS")
                            .build())
                        .build())
                    .build())
                .targetTags(Map.of("Snapshot", "true"))
                .build())
            .build());

    }
}
import pulumi
import pulumi_aws as aws

current = aws.get_caller_identity()
dlm_cross_region_copy_cmk = aws.kms.Key("dlmCrossRegionCopyCmk",
    description="Example Alternate Region KMS Key",
    policy=f"""{{
  "Version": "2012-10-17",
  "Id": "dlm-cross-region-copy-cmk",
  "Statement": [
    {{
      "Sid": "Enable IAM User Permissions",
      "Effect": "Allow",
      "Principal": {{
        "AWS": "arn:aws:iam::{current.account_id}:root"
      }},
      "Action": "kms:*",
      "Resource": "*"
    }}
  ]
}}
""",
    opts=pulumi.ResourceOptions(provider=aws["alternate"]))
example = aws.dlm.LifecyclePolicy("example",
    description="example DLM lifecycle policy",
    execution_role_arn=aws_iam_role["dlm_lifecycle_role"]["arn"],
    state="ENABLED",
    policy_details=aws.dlm.LifecyclePolicyPolicyDetailsArgs(
        resource_types=["VOLUME"],
        schedules=[aws.dlm.LifecyclePolicyPolicyDetailsScheduleArgs(
            name="2 weeks of daily snapshots",
            create_rule=aws.dlm.LifecyclePolicyPolicyDetailsScheduleCreateRuleArgs(
                interval=24,
                interval_unit="HOURS",
                times=["23:45"],
            ),
            retain_rule=aws.dlm.LifecyclePolicyPolicyDetailsScheduleRetainRuleArgs(
                count=14,
            ),
            tags_to_add={
                "SnapshotCreator": "DLM",
            },
            copy_tags=False,
            cross_region_copy_rules=[aws.dlm.LifecyclePolicyPolicyDetailsScheduleCrossRegionCopyRuleArgs(
                target="us-west-2",
                encrypted=True,
                cmk_arn=dlm_cross_region_copy_cmk.arn,
                copy_tags=True,
                retain_rule=aws.dlm.LifecyclePolicyPolicyDetailsScheduleCrossRegionCopyRuleRetainRuleArgs(
                    interval=30,
                    interval_unit="DAYS",
                ),
            )],
        )],
        target_tags={
            "Snapshot": "true",
        },
    ))
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const current = aws.getCallerIdentity({});
const dlmCrossRegionCopyCmk = new aws.kms.Key("dlmCrossRegionCopyCmk", {
    description: "Example Alternate Region KMS Key",
    policy: current.then(current => `{
  "Version": "2012-10-17",
  "Id": "dlm-cross-region-copy-cmk",
  "Statement": [
    {
      "Sid": "Enable IAM User Permissions",
      "Effect": "Allow",
      "Principal": {
        "AWS": "arn:aws:iam::${current.accountId}:root"
      },
      "Action": "kms:*",
      "Resource": "*"
    }
  ]
}
`),
}, {
    provider: aws.alternate,
});
const example = new aws.dlm.LifecyclePolicy("example", {
    description: "example DLM lifecycle policy",
    executionRoleArn: aws_iam_role.dlm_lifecycle_role.arn,
    state: "ENABLED",
    policyDetails: {
        resourceTypes: ["VOLUME"],
        schedules: [{
            name: "2 weeks of daily snapshots",
            createRule: {
                interval: 24,
                intervalUnit: "HOURS",
                times: ["23:45"],
            },
            retainRule: {
                count: 14,
            },
            tagsToAdd: {
                SnapshotCreator: "DLM",
            },
            copyTags: false,
            crossRegionCopyRules: [{
                target: "us-west-2",
                encrypted: true,
                cmkArn: dlmCrossRegionCopyCmk.arn,
                copyTags: true,
                retainRule: {
                    interval: 30,
                    intervalUnit: "DAYS",
                },
            }],
        }],
        targetTags: {
            Snapshot: "true",
        },
    },
});
resources:
  dlmCrossRegionCopyCmk:
    type: aws:kms:Key
    properties:
      description: Example Alternate Region KMS Key
      policy: |
        {
          "Version": "2012-10-17",
          "Id": "dlm-cross-region-copy-cmk",
          "Statement": [
            {
              "Sid": "Enable IAM User Permissions",
              "Effect": "Allow",
              "Principal": {
                "AWS": "arn:aws:iam::${current.accountId}:root"
              },
              "Action": "kms:*",
              "Resource": "*"
            }
          ]
        }        
    options:
      provider: ${aws.alternate}
  example:
    type: aws:dlm:LifecyclePolicy
    properties:
      description: example DLM lifecycle policy
      executionRoleArn: ${aws_iam_role.dlm_lifecycle_role.arn}
      state: ENABLED
      policyDetails:
        resourceTypes:
          - VOLUME
        schedules:
          - name: 2 weeks of daily snapshots
            createRule:
              interval: 24
              intervalUnit: HOURS
              times:
                - 23:45
            retainRule:
              count: 14
            tagsToAdd:
              SnapshotCreator: DLM
            copyTags: false
            crossRegionCopyRules:
              - target: us-west-2
                encrypted: true
                cmkArn: ${dlmCrossRegionCopyCmk.arn}
                copyTags: true
                retainRule:
                  interval: 30
                  intervalUnit: DAYS
        targetTags:
          Snapshot: true
variables:
  current:
    Fn::Invoke:
      Function: aws:getCallerIdentity
      Arguments: {}

Create a LifecyclePolicy Resource

new LifecyclePolicy(name: string, args: LifecyclePolicyArgs, opts?: CustomResourceOptions);
@overload
def LifecyclePolicy(resource_name: str,
                    opts: Optional[ResourceOptions] = None,
                    description: Optional[str] = None,
                    execution_role_arn: Optional[str] = None,
                    policy_details: Optional[LifecyclePolicyPolicyDetailsArgs] = None,
                    state: Optional[str] = None,
                    tags: Optional[Mapping[str, str]] = None)
@overload
def LifecyclePolicy(resource_name: str,
                    args: LifecyclePolicyArgs,
                    opts: Optional[ResourceOptions] = None)
func NewLifecyclePolicy(ctx *Context, name string, args LifecyclePolicyArgs, opts ...ResourceOption) (*LifecyclePolicy, error)
public LifecyclePolicy(string name, LifecyclePolicyArgs args, CustomResourceOptions? opts = null)
public LifecyclePolicy(String name, LifecyclePolicyArgs args)
public LifecyclePolicy(String name, LifecyclePolicyArgs args, CustomResourceOptions options)
type: aws:dlm:LifecyclePolicy
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args LifecyclePolicyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args LifecyclePolicyArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args LifecyclePolicyArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args LifecyclePolicyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args LifecyclePolicyArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

LifecyclePolicy Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The LifecyclePolicy resource accepts the following input properties:

Description string

A description for the DLM lifecycle policy.

ExecutionRoleArn string

The ARN of an IAM role that is able to be assumed by the DLM service.

PolicyDetails LifecyclePolicyPolicyDetailsArgs

See the policy_details configuration block. Max of 1.

State string

Whether the lifecycle policy should be enabled or disabled. ENABLED or DISABLED are valid values. Defaults to ENABLED.

Tags Dictionary<string, string>

Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

Description string

A description for the DLM lifecycle policy.

ExecutionRoleArn string

The ARN of an IAM role that is able to be assumed by the DLM service.

PolicyDetails LifecyclePolicyPolicyDetailsArgs

See the policy_details configuration block. Max of 1.

State string

Whether the lifecycle policy should be enabled or disabled. ENABLED or DISABLED are valid values. Defaults to ENABLED.

Tags map[string]string

Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

description String

A description for the DLM lifecycle policy.

executionRoleArn String

The ARN of an IAM role that is able to be assumed by the DLM service.

policyDetails LifecyclePolicyPolicyDetailsArgs

See the policy_details configuration block. Max of 1.

state String

Whether the lifecycle policy should be enabled or disabled. ENABLED or DISABLED are valid values. Defaults to ENABLED.

tags Map<String,String>

Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

description string

A description for the DLM lifecycle policy.

executionRoleArn string

The ARN of an IAM role that is able to be assumed by the DLM service.

policyDetails LifecyclePolicyPolicyDetailsArgs

See the policy_details configuration block. Max of 1.

state string

Whether the lifecycle policy should be enabled or disabled. ENABLED or DISABLED are valid values. Defaults to ENABLED.

tags {[key: string]: string}

Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

description str

A description for the DLM lifecycle policy.

execution_role_arn str

The ARN of an IAM role that is able to be assumed by the DLM service.

policy_details LifecyclePolicyPolicyDetailsArgs

See the policy_details configuration block. Max of 1.

state str

Whether the lifecycle policy should be enabled or disabled. ENABLED or DISABLED are valid values. Defaults to ENABLED.

tags Mapping[str, str]

Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

description String

A description for the DLM lifecycle policy.

executionRoleArn String

The ARN of an IAM role that is able to be assumed by the DLM service.

policyDetails Property Map

See the policy_details configuration block. Max of 1.

state String

Whether the lifecycle policy should be enabled or disabled. ENABLED or DISABLED are valid values. Defaults to ENABLED.

tags Map<String>

Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

Outputs

All input properties are implicitly available as output properties. Additionally, the LifecyclePolicy resource produces the following output properties:

Arn string

Amazon Resource Name (ARN) of the DLM Lifecycle Policy.

Id string

The provider-assigned unique ID for this managed resource.

TagsAll Dictionary<string, string>

A map of tags assigned to the resource, including those inherited from the provider .

Arn string

Amazon Resource Name (ARN) of the DLM Lifecycle Policy.

Id string

The provider-assigned unique ID for this managed resource.

TagsAll map[string]string

A map of tags assigned to the resource, including those inherited from the provider .

arn String

Amazon Resource Name (ARN) of the DLM Lifecycle Policy.

id String

The provider-assigned unique ID for this managed resource.

tagsAll Map<String,String>

A map of tags assigned to the resource, including those inherited from the provider .

arn string

Amazon Resource Name (ARN) of the DLM Lifecycle Policy.

id string

The provider-assigned unique ID for this managed resource.

tagsAll {[key: string]: string}

A map of tags assigned to the resource, including those inherited from the provider .

arn str

Amazon Resource Name (ARN) of the DLM Lifecycle Policy.

id str

The provider-assigned unique ID for this managed resource.

tags_all Mapping[str, str]

A map of tags assigned to the resource, including those inherited from the provider .

arn String

Amazon Resource Name (ARN) of the DLM Lifecycle Policy.

id String

The provider-assigned unique ID for this managed resource.

tagsAll Map<String>

A map of tags assigned to the resource, including those inherited from the provider .

Look up an Existing LifecyclePolicy Resource

Get an existing LifecyclePolicy resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: LifecyclePolicyState, opts?: CustomResourceOptions): LifecyclePolicy
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        arn: Optional[str] = None,
        description: Optional[str] = None,
        execution_role_arn: Optional[str] = None,
        policy_details: Optional[LifecyclePolicyPolicyDetailsArgs] = None,
        state: Optional[str] = None,
        tags: Optional[Mapping[str, str]] = None,
        tags_all: Optional[Mapping[str, str]] = None) -> LifecyclePolicy
func GetLifecyclePolicy(ctx *Context, name string, id IDInput, state *LifecyclePolicyState, opts ...ResourceOption) (*LifecyclePolicy, error)
public static LifecyclePolicy Get(string name, Input<string> id, LifecyclePolicyState? state, CustomResourceOptions? opts = null)
public static LifecyclePolicy get(String name, Output<String> id, LifecyclePolicyState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
Arn string

Amazon Resource Name (ARN) of the DLM Lifecycle Policy.

Description string

A description for the DLM lifecycle policy.

ExecutionRoleArn string

The ARN of an IAM role that is able to be assumed by the DLM service.

PolicyDetails LifecyclePolicyPolicyDetailsArgs

See the policy_details configuration block. Max of 1.

State string

Whether the lifecycle policy should be enabled or disabled. ENABLED or DISABLED are valid values. Defaults to ENABLED.

Tags Dictionary<string, string>

Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

TagsAll Dictionary<string, string>

A map of tags assigned to the resource, including those inherited from the provider .

Arn string

Amazon Resource Name (ARN) of the DLM Lifecycle Policy.

Description string

A description for the DLM lifecycle policy.

ExecutionRoleArn string

The ARN of an IAM role that is able to be assumed by the DLM service.

PolicyDetails LifecyclePolicyPolicyDetailsArgs

See the policy_details configuration block. Max of 1.

State string

Whether the lifecycle policy should be enabled or disabled. ENABLED or DISABLED are valid values. Defaults to ENABLED.

Tags map[string]string

Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

TagsAll map[string]string

A map of tags assigned to the resource, including those inherited from the provider .

arn String

Amazon Resource Name (ARN) of the DLM Lifecycle Policy.

description String

A description for the DLM lifecycle policy.

executionRoleArn String

The ARN of an IAM role that is able to be assumed by the DLM service.

policyDetails LifecyclePolicyPolicyDetailsArgs

See the policy_details configuration block. Max of 1.

state String

Whether the lifecycle policy should be enabled or disabled. ENABLED or DISABLED are valid values. Defaults to ENABLED.

tags Map<String,String>

Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

tagsAll Map<String,String>

A map of tags assigned to the resource, including those inherited from the provider .

arn string

Amazon Resource Name (ARN) of the DLM Lifecycle Policy.

description string

A description for the DLM lifecycle policy.

executionRoleArn string

The ARN of an IAM role that is able to be assumed by the DLM service.

policyDetails LifecyclePolicyPolicyDetailsArgs

See the policy_details configuration block. Max of 1.

state string

Whether the lifecycle policy should be enabled or disabled. ENABLED or DISABLED are valid values. Defaults to ENABLED.

tags {[key: string]: string}

Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

tagsAll {[key: string]: string}

A map of tags assigned to the resource, including those inherited from the provider .

arn str

Amazon Resource Name (ARN) of the DLM Lifecycle Policy.

description str

A description for the DLM lifecycle policy.

execution_role_arn str

The ARN of an IAM role that is able to be assumed by the DLM service.

policy_details LifecyclePolicyPolicyDetailsArgs

See the policy_details configuration block. Max of 1.

state str

Whether the lifecycle policy should be enabled or disabled. ENABLED or DISABLED are valid values. Defaults to ENABLED.

tags Mapping[str, str]

Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

tags_all Mapping[str, str]

A map of tags assigned to the resource, including those inherited from the provider .

arn String

Amazon Resource Name (ARN) of the DLM Lifecycle Policy.

description String

A description for the DLM lifecycle policy.

executionRoleArn String

The ARN of an IAM role that is able to be assumed by the DLM service.

policyDetails Property Map

See the policy_details configuration block. Max of 1.

state String

Whether the lifecycle policy should be enabled or disabled. ENABLED or DISABLED are valid values. Defaults to ENABLED.

tags Map<String>

Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

tagsAll Map<String>

A map of tags assigned to the resource, including those inherited from the provider .

Supporting Types

LifecyclePolicyPolicyDetails

Action LifecyclePolicyPolicyDetailsAction

The actions to be performed when the event-based policy is triggered. You can specify only one action per policy. This parameter is required for event-based policies only. If you are creating a snapshot or AMI policy, omit this parameter. See the action configuration block.

EventSource LifecyclePolicyPolicyDetailsEventSource

The event that triggers the event-based policy. This parameter is required for event-based policies only. If you are creating a snapshot or AMI policy, omit this parameter. See the event_source configuration block.

Parameters LifecyclePolicyPolicyDetailsParameters

Information about the event. See the parameters configuration block.

PolicyType string

The valid target resource types and actions a policy can manage. Specify EBS_SNAPSHOT_MANAGEMENT to create a lifecycle policy that manages the lifecycle of Amazon EBS snapshots. Specify IMAGE_MANAGEMENT to create a lifecycle policy that manages the lifecycle of EBS-backed AMIs. Specify EVENT_BASED_POLICY to create an event-based policy that performs specific actions when a defined event occurs in your AWS account. Default value is EBS_SNAPSHOT_MANAGEMENT.

ResourceLocations string

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, specify OUTPOST. 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. Valid values are CLOUD and OUTPOST.

ResourceTypes List<string>

A list of resource types that should be targeted by the lifecycle policy. Valid values are VOLUME and INSTANCE.

Schedules List<LifecyclePolicyPolicyDetailsSchedule>

See the schedule configuration block.

TargetTags Dictionary<string, string>

A map of tag keys and their values. Any resources that match the resource_types and are tagged with any of these tags will be targeted.

Action LifecyclePolicyPolicyDetailsAction

The actions to be performed when the event-based policy is triggered. You can specify only one action per policy. This parameter is required for event-based policies only. If you are creating a snapshot or AMI policy, omit this parameter. See the action configuration block.

EventSource LifecyclePolicyPolicyDetailsEventSource

The event that triggers the event-based policy. This parameter is required for event-based policies only. If you are creating a snapshot or AMI policy, omit this parameter. See the event_source configuration block.

Parameters LifecyclePolicyPolicyDetailsParameters

Information about the event. See the parameters configuration block.

PolicyType string

The valid target resource types and actions a policy can manage. Specify EBS_SNAPSHOT_MANAGEMENT to create a lifecycle policy that manages the lifecycle of Amazon EBS snapshots. Specify IMAGE_MANAGEMENT to create a lifecycle policy that manages the lifecycle of EBS-backed AMIs. Specify EVENT_BASED_POLICY to create an event-based policy that performs specific actions when a defined event occurs in your AWS account. Default value is EBS_SNAPSHOT_MANAGEMENT.

ResourceLocations string

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, specify OUTPOST. 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. Valid values are CLOUD and OUTPOST.

ResourceTypes []string

A list of resource types that should be targeted by the lifecycle policy. Valid values are VOLUME and INSTANCE.

Schedules []LifecyclePolicyPolicyDetailsSchedule

See the schedule configuration block.

TargetTags map[string]string

A map of tag keys and their values. Any resources that match the resource_types and are tagged with any of these tags will be targeted.

action LifecyclePolicyPolicyDetailsAction

The actions to be performed when the event-based policy is triggered. You can specify only one action per policy. This parameter is required for event-based policies only. If you are creating a snapshot or AMI policy, omit this parameter. See the action configuration block.

eventSource LifecyclePolicyPolicyDetailsEventSource

The event that triggers the event-based policy. This parameter is required for event-based policies only. If you are creating a snapshot or AMI policy, omit this parameter. See the event_source configuration block.

parameters LifecyclePolicyPolicyDetailsParameters

Information about the event. See the parameters configuration block.

policyType String

The valid target resource types and actions a policy can manage. Specify EBS_SNAPSHOT_MANAGEMENT to create a lifecycle policy that manages the lifecycle of Amazon EBS snapshots. Specify IMAGE_MANAGEMENT to create a lifecycle policy that manages the lifecycle of EBS-backed AMIs. Specify EVENT_BASED_POLICY to create an event-based policy that performs specific actions when a defined event occurs in your AWS account. Default value is EBS_SNAPSHOT_MANAGEMENT.

resourceLocations String

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, specify OUTPOST. 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. Valid values are CLOUD and OUTPOST.

resourceTypes List<String>

A list of resource types that should be targeted by the lifecycle policy. Valid values are VOLUME and INSTANCE.

schedules List<LifecyclePolicyPolicyDetailsSchedule>

See the schedule configuration block.

targetTags Map<String,String>

A map of tag keys and their values. Any resources that match the resource_types and are tagged with any of these tags will be targeted.

action LifecyclePolicyPolicyDetailsAction

The actions to be performed when the event-based policy is triggered. You can specify only one action per policy. This parameter is required for event-based policies only. If you are creating a snapshot or AMI policy, omit this parameter. See the action configuration block.

eventSource LifecyclePolicyPolicyDetailsEventSource

The event that triggers the event-based policy. This parameter is required for event-based policies only. If you are creating a snapshot or AMI policy, omit this parameter. See the event_source configuration block.

parameters LifecyclePolicyPolicyDetailsParameters

Information about the event. See the parameters configuration block.

policyType string

The valid target resource types and actions a policy can manage. Specify EBS_SNAPSHOT_MANAGEMENT to create a lifecycle policy that manages the lifecycle of Amazon EBS snapshots. Specify IMAGE_MANAGEMENT to create a lifecycle policy that manages the lifecycle of EBS-backed AMIs. Specify EVENT_BASED_POLICY to create an event-based policy that performs specific actions when a defined event occurs in your AWS account. Default value is EBS_SNAPSHOT_MANAGEMENT.

resourceLocations string

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, specify OUTPOST. 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. Valid values are CLOUD and OUTPOST.

resourceTypes string[]

A list of resource types that should be targeted by the lifecycle policy. Valid values are VOLUME and INSTANCE.

schedules LifecyclePolicyPolicyDetailsSchedule[]

See the schedule configuration block.

targetTags {[key: string]: string}

A map of tag keys and their values. Any resources that match the resource_types and are tagged with any of these tags will be targeted.

action LifecyclePolicyPolicyDetailsAction

The actions to be performed when the event-based policy is triggered. You can specify only one action per policy. This parameter is required for event-based policies only. If you are creating a snapshot or AMI policy, omit this parameter. See the action configuration block.

event_source LifecyclePolicyPolicyDetailsEventSource

The event that triggers the event-based policy. This parameter is required for event-based policies only. If you are creating a snapshot or AMI policy, omit this parameter. See the event_source configuration block.

parameters LifecyclePolicyPolicyDetailsParameters

Information about the event. See the parameters configuration block.

policy_type str

The valid target resource types and actions a policy can manage. Specify EBS_SNAPSHOT_MANAGEMENT to create a lifecycle policy that manages the lifecycle of Amazon EBS snapshots. Specify IMAGE_MANAGEMENT to create a lifecycle policy that manages the lifecycle of EBS-backed AMIs. Specify EVENT_BASED_POLICY to create an event-based policy that performs specific actions when a defined event occurs in your AWS account. Default value is EBS_SNAPSHOT_MANAGEMENT.

resource_locations str

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, specify OUTPOST. 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. Valid values are CLOUD and OUTPOST.

resource_types Sequence[str]

A list of resource types that should be targeted by the lifecycle policy. Valid values are VOLUME and INSTANCE.

schedules Sequence[LifecyclePolicyPolicyDetailsSchedule]

See the schedule configuration block.

target_tags Mapping[str, str]

A map of tag keys and their values. Any resources that match the resource_types and are tagged with any of these tags will be targeted.

action Property Map

The actions to be performed when the event-based policy is triggered. You can specify only one action per policy. This parameter is required for event-based policies only. If you are creating a snapshot or AMI policy, omit this parameter. See the action configuration block.

eventSource Property Map

The event that triggers the event-based policy. This parameter is required for event-based policies only. If you are creating a snapshot or AMI policy, omit this parameter. See the event_source configuration block.

parameters Property Map

Information about the event. See the parameters configuration block.

policyType String

The valid target resource types and actions a policy can manage. Specify EBS_SNAPSHOT_MANAGEMENT to create a lifecycle policy that manages the lifecycle of Amazon EBS snapshots. Specify IMAGE_MANAGEMENT to create a lifecycle policy that manages the lifecycle of EBS-backed AMIs. Specify EVENT_BASED_POLICY to create an event-based policy that performs specific actions when a defined event occurs in your AWS account. Default value is EBS_SNAPSHOT_MANAGEMENT.

resourceLocations String

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, specify OUTPOST. 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. Valid values are CLOUD and OUTPOST.

resourceTypes List<String>

A list of resource types that should be targeted by the lifecycle policy. Valid values are VOLUME and INSTANCE.

schedules List<Property Map>

See the schedule configuration block.

targetTags Map<String>

A map of tag keys and their values. Any resources that match the resource_types and are tagged with any of these tags will be targeted.

LifecyclePolicyPolicyDetailsAction

CrossRegionCopies List<LifecyclePolicyPolicyDetailsActionCrossRegionCopy>

The rule for copying shared snapshots across Regions. See the cross_region_copy configuration block.

Name string

A name for the schedule.

CrossRegionCopies []LifecyclePolicyPolicyDetailsActionCrossRegionCopy

The rule for copying shared snapshots across Regions. See the cross_region_copy configuration block.

Name string

A name for the schedule.

crossRegionCopies List<LifecyclePolicyPolicyDetailsActionCrossRegionCopy>

The rule for copying shared snapshots across Regions. See the cross_region_copy configuration block.

name String

A name for the schedule.

crossRegionCopies LifecyclePolicyPolicyDetailsActionCrossRegionCopy[]

The rule for copying shared snapshots across Regions. See the cross_region_copy configuration block.

name string

A name for the schedule.

cross_region_copies Sequence[LifecyclePolicyPolicyDetailsActionCrossRegionCopy]

The rule for copying shared snapshots across Regions. See the cross_region_copy configuration block.

name str

A name for the schedule.

crossRegionCopies List<Property Map>

The rule for copying shared snapshots across Regions. See the cross_region_copy configuration block.

name String

A name for the schedule.

LifecyclePolicyPolicyDetailsActionCrossRegionCopy

EncryptionConfiguration LifecyclePolicyPolicyDetailsActionCrossRegionCopyEncryptionConfiguration

The encryption settings for the copied snapshot. See the encryption_configuration block. Max of 1 per action.

Target string

The target Region or the Amazon Resource Name (ARN) of the target Outpost for the snapshot copies.

RetainRule LifecyclePolicyPolicyDetailsActionCrossRegionCopyRetainRule

The retention rule that indicates how long snapshot copies are to be retained in the destination Region. See the retain_rule block. Max of 1 per schedule.

EncryptionConfiguration LifecyclePolicyPolicyDetailsActionCrossRegionCopyEncryptionConfiguration

The encryption settings for the copied snapshot. See the encryption_configuration block. Max of 1 per action.

Target string

The target Region or the Amazon Resource Name (ARN) of the target Outpost for the snapshot copies.

RetainRule LifecyclePolicyPolicyDetailsActionCrossRegionCopyRetainRule

The retention rule that indicates how long snapshot copies are to be retained in the destination Region. See the retain_rule block. Max of 1 per schedule.

encryptionConfiguration LifecyclePolicyPolicyDetailsActionCrossRegionCopyEncryptionConfiguration

The encryption settings for the copied snapshot. See the encryption_configuration block. Max of 1 per action.

target String

The target Region or the Amazon Resource Name (ARN) of the target Outpost for the snapshot copies.

retainRule LifecyclePolicyPolicyDetailsActionCrossRegionCopyRetainRule

The retention rule that indicates how long snapshot copies are to be retained in the destination Region. See the retain_rule block. Max of 1 per schedule.

encryptionConfiguration LifecyclePolicyPolicyDetailsActionCrossRegionCopyEncryptionConfiguration

The encryption settings for the copied snapshot. See the encryption_configuration block. Max of 1 per action.

target string

The target Region or the Amazon Resource Name (ARN) of the target Outpost for the snapshot copies.

retainRule LifecyclePolicyPolicyDetailsActionCrossRegionCopyRetainRule

The retention rule that indicates how long snapshot copies are to be retained in the destination Region. See the retain_rule block. Max of 1 per schedule.

encryption_configuration LifecyclePolicyPolicyDetailsActionCrossRegionCopyEncryptionConfiguration

The encryption settings for the copied snapshot. See the encryption_configuration block. Max of 1 per action.

target str

The target Region or the Amazon Resource Name (ARN) of the target Outpost for the snapshot copies.

retain_rule LifecyclePolicyPolicyDetailsActionCrossRegionCopyRetainRule

The retention rule that indicates how long snapshot copies are to be retained in the destination Region. See the retain_rule block. Max of 1 per schedule.

encryptionConfiguration Property Map

The encryption settings for the copied snapshot. See the encryption_configuration block. Max of 1 per action.

target String

The target Region or the Amazon Resource Name (ARN) of the target Outpost for the snapshot copies.

retainRule Property Map

The retention rule that indicates how long snapshot copies are to be retained in the destination Region. See the retain_rule block. Max of 1 per schedule.

LifecyclePolicyPolicyDetailsActionCrossRegionCopyEncryptionConfiguration

CmkArn string

The Amazon Resource Name (ARN) of the AWS KMS customer master key (CMK) to use for EBS encryption. If this argument is not specified, the default KMS key for the account is used.

Encrypted bool

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.

CmkArn string

The Amazon Resource Name (ARN) of the AWS KMS customer master key (CMK) to use for EBS encryption. If this argument is not specified, the default KMS key for the account is used.

Encrypted bool

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.

cmkArn String

The Amazon Resource Name (ARN) of the AWS KMS customer master key (CMK) to use for EBS encryption. If this argument is not specified, the default KMS key for the account is used.

encrypted Boolean

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.

cmkArn string

The Amazon Resource Name (ARN) of the AWS KMS customer master key (CMK) to use for EBS encryption. If this argument is not specified, the default KMS key for the account is used.

encrypted boolean

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 str

The Amazon Resource Name (ARN) of the AWS KMS customer master key (CMK) to use for EBS encryption. If this argument is not specified, the default KMS key for the account is used.

encrypted bool

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.

cmkArn String

The Amazon Resource Name (ARN) of the AWS KMS customer master key (CMK) to use for EBS encryption. If this argument is not specified, the default KMS key for the account is used.

encrypted Boolean

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.

LifecyclePolicyPolicyDetailsActionCrossRegionCopyRetainRule

Interval int

The amount of time to retain each snapshot. The maximum is 100 years. This is equivalent to 1200 months, 5200 weeks, or 36500 days.

IntervalUnit string

The unit of time for time-based retention. Valid values: DAYS, WEEKS, MONTHS, or YEARS.

Interval int

The amount of time to retain each snapshot. The maximum is 100 years. This is equivalent to 1200 months, 5200 weeks, or 36500 days.

IntervalUnit string

The unit of time for time-based retention. Valid values: DAYS, WEEKS, MONTHS, or YEARS.

interval Integer

The amount of time to retain each snapshot. The maximum is 100 years. This is equivalent to 1200 months, 5200 weeks, or 36500 days.

intervalUnit String

The unit of time for time-based retention. Valid values: DAYS, WEEKS, MONTHS, or YEARS.

interval number

The amount of time to retain each snapshot. The maximum is 100 years. This is equivalent to 1200 months, 5200 weeks, or 36500 days.

intervalUnit string

The unit of time for time-based retention. Valid values: DAYS, WEEKS, MONTHS, or YEARS.

interval int

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 str

The unit of time for time-based retention. Valid values: DAYS, WEEKS, MONTHS, or YEARS.

interval Number

The amount of time to retain each snapshot. The maximum is 100 years. This is equivalent to 1200 months, 5200 weeks, or 36500 days.

intervalUnit String

The unit of time for time-based retention. Valid values: DAYS, WEEKS, MONTHS, or YEARS.

LifecyclePolicyPolicyDetailsEventSource

Parameters LifecyclePolicyPolicyDetailsEventSourceParameters

Information about the event. See the parameters configuration block.

Type string

The source of the event. Currently only managed CloudWatch Events rules are supported. Valid values are MANAGED_CWE.

Parameters LifecyclePolicyPolicyDetailsEventSourceParameters

Information about the event. See the parameters configuration block.

Type string

The source of the event. Currently only managed CloudWatch Events rules are supported. Valid values are MANAGED_CWE.

parameters LifecyclePolicyPolicyDetailsEventSourceParameters

Information about the event. See the parameters configuration block.

type String

The source of the event. Currently only managed CloudWatch Events rules are supported. Valid values are MANAGED_CWE.

parameters LifecyclePolicyPolicyDetailsEventSourceParameters

Information about the event. See the parameters configuration block.

type string

The source of the event. Currently only managed CloudWatch Events rules are supported. Valid values are MANAGED_CWE.

parameters LifecyclePolicyPolicyDetailsEventSourceParameters

Information about the event. See the parameters configuration block.

type str

The source of the event. Currently only managed CloudWatch Events rules are supported. Valid values are MANAGED_CWE.

parameters Property Map

Information about the event. See the parameters configuration block.

type String

The source of the event. Currently only managed CloudWatch Events rules are supported. Valid values are MANAGED_CWE.

LifecyclePolicyPolicyDetailsEventSourceParameters

DescriptionRegex string

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.

EventType string

The type of event. Currently, only shareSnapshot events are supported.

SnapshotOwners List<string>

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.

DescriptionRegex string

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.

EventType string

The type of event. Currently, only shareSnapshot events are supported.

SnapshotOwners []string

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.

descriptionRegex String

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.

eventType String

The type of event. Currently, only shareSnapshot events are supported.

snapshotOwners List<String>

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.

descriptionRegex string

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.

eventType string

The type of event. Currently, only shareSnapshot events are supported.

snapshotOwners string[]

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

event_type str

The type of event. Currently, only shareSnapshot events are supported.

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

descriptionRegex String

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.

eventType String

The type of event. Currently, only shareSnapshot events are supported.

snapshotOwners List<String>

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.

LifecyclePolicyPolicyDetailsParameters

ExcludeBootVolume bool

Indicates whether to exclude the root volume from snapshots created using CreateSnapshots. The default is false.

NoReboot bool

Applies to AMI lifecycle 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 is true (instances are not rebooted).

ExcludeBootVolume bool

Indicates whether to exclude the root volume from snapshots created using CreateSnapshots. The default is false.

NoReboot bool

Applies to AMI lifecycle 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 is true (instances are not rebooted).

excludeBootVolume Boolean

Indicates whether to exclude the root volume from snapshots created using CreateSnapshots. The default is false.

noReboot Boolean

Applies to AMI lifecycle 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 is true (instances are not rebooted).

excludeBootVolume boolean

Indicates whether to exclude the root volume from snapshots created using CreateSnapshots. The default is false.

noReboot boolean

Applies to AMI lifecycle 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 is true (instances are not rebooted).

exclude_boot_volume bool

Indicates whether to exclude the root volume from snapshots created using CreateSnapshots. The default is false.

no_reboot bool

Applies to AMI lifecycle 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 is true (instances are not rebooted).

excludeBootVolume Boolean

Indicates whether to exclude the root volume from snapshots created using CreateSnapshots. The default is false.

noReboot Boolean

Applies to AMI lifecycle 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 is true (instances are not rebooted).

LifecyclePolicyPolicyDetailsSchedule

CreateRule LifecyclePolicyPolicyDetailsScheduleCreateRule

See the create_rule block. Max of 1 per schedule.

Name string

A name for the schedule.

RetainRule LifecyclePolicyPolicyDetailsScheduleRetainRule

The retention rule that indicates how long snapshot copies are to be retained in the destination Region. See the retain_rule block. Max of 1 per schedule.

CopyTags bool

Whether to copy all user-defined tags from the source snapshot to the cross-region snapshot copy.

CrossRegionCopyRules List<LifecyclePolicyPolicyDetailsScheduleCrossRegionCopyRule>

See the cross_region_copy_rule block. Max of 3 per schedule.

DeprecateRule LifecyclePolicyPolicyDetailsScheduleDeprecateRule

The AMI deprecation rule for cross-Region AMI copies created by the rule. See the deprecate_rule block.

FastRestoreRule LifecyclePolicyPolicyDetailsScheduleFastRestoreRule

See the fast_restore_rule block. Max of 1 per schedule.

ShareRule LifecyclePolicyPolicyDetailsScheduleShareRule

See the share_rule block. Max of 1 per schedule.

TagsToAdd Dictionary<string, string>

A map of tag keys and their values. DLM lifecycle policies will already tag the snapshot with the tags on the volume. This configuration adds extra tags on top of these.

VariableTags Dictionary<string, string>

A map of tag keys and variable values, where the values are determined when the policy is executed. Only $(instance-id) or $(timestamp) are valid values. Can only be used when resource_types is INSTANCE.

CreateRule LifecyclePolicyPolicyDetailsScheduleCreateRule

See the create_rule block. Max of 1 per schedule.

Name string

A name for the schedule.

RetainRule LifecyclePolicyPolicyDetailsScheduleRetainRule

The retention rule that indicates how long snapshot copies are to be retained in the destination Region. See the retain_rule block. Max of 1 per schedule.

CopyTags bool

Whether to copy all user-defined tags from the source snapshot to the cross-region snapshot copy.

CrossRegionCopyRules []LifecyclePolicyPolicyDetailsScheduleCrossRegionCopyRule

See the cross_region_copy_rule block. Max of 3 per schedule.

DeprecateRule LifecyclePolicyPolicyDetailsScheduleDeprecateRule

The AMI deprecation rule for cross-Region AMI copies created by the rule. See the deprecate_rule block.

FastRestoreRule LifecyclePolicyPolicyDetailsScheduleFastRestoreRule

See the fast_restore_rule block. Max of 1 per schedule.

ShareRule LifecyclePolicyPolicyDetailsScheduleShareRule

See the share_rule block. Max of 1 per schedule.

TagsToAdd map[string]string

A map of tag keys and their values. DLM lifecycle policies will already tag the snapshot with the tags on the volume. This configuration adds extra tags on top of these.

VariableTags map[string]string

A map of tag keys and variable values, where the values are determined when the policy is executed. Only $(instance-id) or $(timestamp) are valid values. Can only be used when resource_types is INSTANCE.

createRule LifecyclePolicyPolicyDetailsScheduleCreateRule

See the create_rule block. Max of 1 per schedule.

name String

A name for the schedule.

retainRule LifecyclePolicyPolicyDetailsScheduleRetainRule

The retention rule that indicates how long snapshot copies are to be retained in the destination Region. See the retain_rule block. Max of 1 per schedule.

copyTags Boolean

Whether to copy all user-defined tags from the source snapshot to the cross-region snapshot copy.

crossRegionCopyRules List<LifecyclePolicyPolicyDetailsScheduleCrossRegionCopyRule>

See the cross_region_copy_rule block. Max of 3 per schedule.

deprecateRule LifecyclePolicyPolicyDetailsScheduleDeprecateRule

The AMI deprecation rule for cross-Region AMI copies created by the rule. See the deprecate_rule block.

fastRestoreRule LifecyclePolicyPolicyDetailsScheduleFastRestoreRule

See the fast_restore_rule block. Max of 1 per schedule.

shareRule LifecyclePolicyPolicyDetailsScheduleShareRule

See the share_rule block. Max of 1 per schedule.

tagsToAdd Map<String,String>

A map of tag keys and their values. DLM lifecycle policies will already tag the snapshot with the tags on the volume. This configuration adds extra tags on top of these.

variableTags Map<String,String>

A map of tag keys and variable values, where the values are determined when the policy is executed. Only $(instance-id) or $(timestamp) are valid values. Can only be used when resource_types is INSTANCE.

createRule LifecyclePolicyPolicyDetailsScheduleCreateRule

See the create_rule block. Max of 1 per schedule.

name string

A name for the schedule.

retainRule LifecyclePolicyPolicyDetailsScheduleRetainRule

The retention rule that indicates how long snapshot copies are to be retained in the destination Region. See the retain_rule block. Max of 1 per schedule.

copyTags boolean

Whether to copy all user-defined tags from the source snapshot to the cross-region snapshot copy.

crossRegionCopyRules LifecyclePolicyPolicyDetailsScheduleCrossRegionCopyRule[]

See the cross_region_copy_rule block. Max of 3 per schedule.

deprecateRule LifecyclePolicyPolicyDetailsScheduleDeprecateRule

The AMI deprecation rule for cross-Region AMI copies created by the rule. See the deprecate_rule block.

fastRestoreRule LifecyclePolicyPolicyDetailsScheduleFastRestoreRule

See the fast_restore_rule block. Max of 1 per schedule.

shareRule LifecyclePolicyPolicyDetailsScheduleShareRule

See the share_rule block. Max of 1 per schedule.

tagsToAdd {[key: string]: string}

A map of tag keys and their values. DLM lifecycle policies will already tag the snapshot with the tags on the volume. This configuration adds extra tags on top of these.

variableTags {[key: string]: string}

A map of tag keys and variable values, where the values are determined when the policy is executed. Only $(instance-id) or $(timestamp) are valid values. Can only be used when resource_types is INSTANCE.

create_rule LifecyclePolicyPolicyDetailsScheduleCreateRule

See the create_rule block. Max of 1 per schedule.

name str

A name for the schedule.

retain_rule LifecyclePolicyPolicyDetailsScheduleRetainRule

The retention rule that indicates how long snapshot copies are to be retained in the destination Region. See the retain_rule block. Max of 1 per schedule.

copy_tags bool

Whether to copy all user-defined tags from the source snapshot to the cross-region snapshot copy.

cross_region_copy_rules Sequence[LifecyclePolicyPolicyDetailsScheduleCrossRegionCopyRule]

See the cross_region_copy_rule block. Max of 3 per schedule.

deprecate_rule LifecyclePolicyPolicyDetailsScheduleDeprecateRule

The AMI deprecation rule for cross-Region AMI copies created by the rule. See the deprecate_rule block.

fast_restore_rule LifecyclePolicyPolicyDetailsScheduleFastRestoreRule

See the fast_restore_rule block. Max of 1 per schedule.

share_rule LifecyclePolicyPolicyDetailsScheduleShareRule

See the share_rule block. Max of 1 per schedule.

tags_to_add Mapping[str, str]

A map of tag keys and their values. DLM lifecycle policies will already tag the snapshot with the tags on the volume. This configuration adds extra tags on top of these.

variable_tags Mapping[str, str]

A map of tag keys and variable values, where the values are determined when the policy is executed. Only $(instance-id) or $(timestamp) are valid values. Can only be used when resource_types is INSTANCE.

createRule Property Map

See the create_rule block. Max of 1 per schedule.

name String

A name for the schedule.

retainRule Property Map

The retention rule that indicates how long snapshot copies are to be retained in the destination Region. See the retain_rule block. Max of 1 per schedule.

copyTags Boolean

Whether to copy all user-defined tags from the source snapshot to the cross-region snapshot copy.

crossRegionCopyRules List<Property Map>

See the cross_region_copy_rule block. Max of 3 per schedule.

deprecateRule Property Map

The AMI deprecation rule for cross-Region AMI copies created by the rule. See the deprecate_rule block.

fastRestoreRule Property Map

See the fast_restore_rule block. Max of 1 per schedule.

shareRule Property Map

See the share_rule block. Max of 1 per schedule.

tagsToAdd Map<String>

A map of tag keys and their values. DLM lifecycle policies will already tag the snapshot with the tags on the volume. This configuration adds extra tags on top of these.

variableTags Map<String>

A map of tag keys and variable values, where the values are determined when the policy is executed. Only $(instance-id) or $(timestamp) are valid values. Can only be used when resource_types is INSTANCE.

LifecyclePolicyPolicyDetailsScheduleCreateRule

CronExpression string

The schedule, as a Cron expression. The schedule interval must be between 1 hour and 1 year.

Interval int

The amount of time to retain each snapshot. The maximum is 100 years. This is equivalent to 1200 months, 5200 weeks, or 36500 days.

IntervalUnit string

The unit of time for time-based retention. Valid values: DAYS, WEEKS, MONTHS, or YEARS.

Location string

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, specify OUTPOST_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. Valid values are CLOUD and OUTPOST_LOCAL.

Times string

A list of times in 24 hour clock format that sets when the lifecycle policy should be evaluated. Max of 1.

CronExpression string

The schedule, as a Cron expression. The schedule interval must be between 1 hour and 1 year.

Interval int

The amount of time to retain each snapshot. The maximum is 100 years. This is equivalent to 1200 months, 5200 weeks, or 36500 days.

IntervalUnit string

The unit of time for time-based retention. Valid values: DAYS, WEEKS, MONTHS, or YEARS.

Location string

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, specify OUTPOST_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. Valid values are CLOUD and OUTPOST_LOCAL.

Times string

A list of times in 24 hour clock format that sets when the lifecycle policy should be evaluated. Max of 1.

cronExpression String

The schedule, as a Cron expression. The schedule interval must be between 1 hour and 1 year.

interval Integer

The amount of time to retain each snapshot. The maximum is 100 years. This is equivalent to 1200 months, 5200 weeks, or 36500 days.

intervalUnit String

The unit of time for time-based retention. Valid values: DAYS, WEEKS, MONTHS, or YEARS.

location String

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, specify OUTPOST_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. Valid values are CLOUD and OUTPOST_LOCAL.

times String

A list of times in 24 hour clock format that sets when the lifecycle policy should be evaluated. Max of 1.

cronExpression string

The schedule, as a Cron expression. The schedule interval must be between 1 hour and 1 year.

interval number

The amount of time to retain each snapshot. The maximum is 100 years. This is equivalent to 1200 months, 5200 weeks, or 36500 days.

intervalUnit string

The unit of time for time-based retention. Valid values: DAYS, WEEKS, MONTHS, or YEARS.

location string

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, specify OUTPOST_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. Valid values are CLOUD and OUTPOST_LOCAL.

times string

A list of times in 24 hour clock format that sets when the lifecycle policy should be evaluated. Max of 1.

cron_expression str

The schedule, as a Cron expression. The schedule interval must be between 1 hour and 1 year.

interval int

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 str

The unit of time for time-based retention. Valid values: DAYS, WEEKS, MONTHS, or YEARS.

location str

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, specify OUTPOST_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. Valid values are CLOUD and OUTPOST_LOCAL.

times str

A list of times in 24 hour clock format that sets when the lifecycle policy should be evaluated. Max of 1.

cronExpression String

The schedule, as a Cron expression. The schedule interval must be between 1 hour and 1 year.

interval Number

The amount of time to retain each snapshot. The maximum is 100 years. This is equivalent to 1200 months, 5200 weeks, or 36500 days.

intervalUnit String

The unit of time for time-based retention. Valid values: DAYS, WEEKS, MONTHS, or YEARS.

location String

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, specify OUTPOST_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. Valid values are CLOUD and OUTPOST_LOCAL.

times String

A list of times in 24 hour clock format that sets when the lifecycle policy should be evaluated. Max of 1.

LifecyclePolicyPolicyDetailsScheduleCrossRegionCopyRule

Encrypted bool

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.

Target string

The target Region or the Amazon Resource Name (ARN) of the target Outpost for the snapshot copies.

CmkArn string

The Amazon Resource Name (ARN) of the AWS KMS customer master key (CMK) to use for EBS encryption. If this argument is not specified, the default KMS key for the account is used.

CopyTags bool

Whether to copy all user-defined tags from the source snapshot to the cross-region snapshot copy.

DeprecateRule LifecyclePolicyPolicyDetailsScheduleCrossRegionCopyRuleDeprecateRule

The AMI deprecation rule for cross-Region AMI copies created by the rule. See the deprecate_rule block.

RetainRule LifecyclePolicyPolicyDetailsScheduleCrossRegionCopyRuleRetainRule

The retention rule that indicates how long snapshot copies are to be retained in the destination Region. See the retain_rule block. Max of 1 per schedule.

Encrypted bool

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.

Target string

The target Region or the Amazon Resource Name (ARN) of the target Outpost for the snapshot copies.

CmkArn string

The Amazon Resource Name (ARN) of the AWS KMS customer master key (CMK) to use for EBS encryption. If this argument is not specified, the default KMS key for the account is used.

CopyTags bool

Whether to copy all user-defined tags from the source snapshot to the cross-region snapshot copy.

DeprecateRule LifecyclePolicyPolicyDetailsScheduleCrossRegionCopyRuleDeprecateRule

The AMI deprecation rule for cross-Region AMI copies created by the rule. See the deprecate_rule block.

RetainRule LifecyclePolicyPolicyDetailsScheduleCrossRegionCopyRuleRetainRule

The retention rule that indicates how long snapshot copies are to be retained in the destination Region. See the retain_rule block. Max of 1 per schedule.

encrypted Boolean

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.

target String

The target Region or the Amazon Resource Name (ARN) of the target Outpost for the snapshot copies.

cmkArn String

The Amazon Resource Name (ARN) of the AWS KMS customer master key (CMK) to use for EBS encryption. If this argument is not specified, the default KMS key for the account is used.

copyTags Boolean

Whether to copy all user-defined tags from the source snapshot to the cross-region snapshot copy.

deprecateRule LifecyclePolicyPolicyDetailsScheduleCrossRegionCopyRuleDeprecateRule

The AMI deprecation rule for cross-Region AMI copies created by the rule. See the deprecate_rule block.

retainRule LifecyclePolicyPolicyDetailsScheduleCrossRegionCopyRuleRetainRule

The retention rule that indicates how long snapshot copies are to be retained in the destination Region. See the retain_rule block. Max of 1 per schedule.

encrypted boolean

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.

target string

The target Region or the Amazon Resource Name (ARN) of the target Outpost for the snapshot copies.

cmkArn string

The Amazon Resource Name (ARN) of the AWS KMS customer master key (CMK) to use for EBS encryption. If this argument is not specified, the default KMS key for the account is used.

copyTags boolean

Whether to copy all user-defined tags from the source snapshot to the cross-region snapshot copy.

deprecateRule LifecyclePolicyPolicyDetailsScheduleCrossRegionCopyRuleDeprecateRule

The AMI deprecation rule for cross-Region AMI copies created by the rule. See the deprecate_rule block.

retainRule LifecyclePolicyPolicyDetailsScheduleCrossRegionCopyRuleRetainRule

The retention rule that indicates how long snapshot copies are to be retained in the destination Region. See the retain_rule block. Max of 1 per schedule.

encrypted bool

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.

target str

The target Region or the Amazon Resource Name (ARN) of the target Outpost for the snapshot copies.

cmk_arn str

The Amazon Resource Name (ARN) of the AWS KMS customer master key (CMK) to use for EBS encryption. If this argument is not specified, the default KMS key for the account is used.

copy_tags bool

Whether to copy all user-defined tags from the source snapshot to the cross-region snapshot copy.

deprecate_rule LifecyclePolicyPolicyDetailsScheduleCrossRegionCopyRuleDeprecateRule

The AMI deprecation rule for cross-Region AMI copies created by the rule. See the deprecate_rule block.

retain_rule LifecyclePolicyPolicyDetailsScheduleCrossRegionCopyRuleRetainRule

The retention rule that indicates how long snapshot copies are to be retained in the destination Region. See the retain_rule block. Max of 1 per schedule.

encrypted Boolean

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.

target String

The target Region or the Amazon Resource Name (ARN) of the target Outpost for the snapshot copies.

cmkArn String

The Amazon Resource Name (ARN) of the AWS KMS customer master key (CMK) to use for EBS encryption. If this argument is not specified, the default KMS key for the account is used.

copyTags Boolean

Whether to copy all user-defined tags from the source snapshot to the cross-region snapshot copy.

deprecateRule Property Map

The AMI deprecation rule for cross-Region AMI copies created by the rule. See the deprecate_rule block.

retainRule Property Map

The retention rule that indicates how long snapshot copies are to be retained in the destination Region. See the retain_rule block. Max of 1 per schedule.

LifecyclePolicyPolicyDetailsScheduleCrossRegionCopyRuleDeprecateRule

Interval int

The amount of time to retain each snapshot. The maximum is 100 years. This is equivalent to 1200 months, 5200 weeks, or 36500 days.

IntervalUnit string

The unit of time for time-based retention. Valid values: DAYS, WEEKS, MONTHS, or YEARS.

Interval int

The amount of time to retain each snapshot. The maximum is 100 years. This is equivalent to 1200 months, 5200 weeks, or 36500 days.

IntervalUnit string

The unit of time for time-based retention. Valid values: DAYS, WEEKS, MONTHS, or YEARS.

interval Integer

The amount of time to retain each snapshot. The maximum is 100 years. This is equivalent to 1200 months, 5200 weeks, or 36500 days.

intervalUnit String

The unit of time for time-based retention. Valid values: DAYS, WEEKS, MONTHS, or YEARS.

interval number

The amount of time to retain each snapshot. The maximum is 100 years. This is equivalent to 1200 months, 5200 weeks, or 36500 days.

intervalUnit string

The unit of time for time-based retention. Valid values: DAYS, WEEKS, MONTHS, or YEARS.

interval int

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 str

The unit of time for time-based retention. Valid values: DAYS, WEEKS, MONTHS, or YEARS.

interval Number

The amount of time to retain each snapshot. The maximum is 100 years. This is equivalent to 1200 months, 5200 weeks, or 36500 days.

intervalUnit String

The unit of time for time-based retention. Valid values: DAYS, WEEKS, MONTHS, or YEARS.

LifecyclePolicyPolicyDetailsScheduleCrossRegionCopyRuleRetainRule

Interval int

The amount of time to retain each snapshot. The maximum is 100 years. This is equivalent to 1200 months, 5200 weeks, or 36500 days.

IntervalUnit string

The unit of time for time-based retention. Valid values: DAYS, WEEKS, MONTHS, or YEARS.

Interval int

The amount of time to retain each snapshot. The maximum is 100 years. This is equivalent to 1200 months, 5200 weeks, or 36500 days.

IntervalUnit string

The unit of time for time-based retention. Valid values: DAYS, WEEKS, MONTHS, or YEARS.

interval Integer

The amount of time to retain each snapshot. The maximum is 100 years. This is equivalent to 1200 months, 5200 weeks, or 36500 days.

intervalUnit String

The unit of time for time-based retention. Valid values: DAYS, WEEKS, MONTHS, or YEARS.

interval number

The amount of time to retain each snapshot. The maximum is 100 years. This is equivalent to 1200 months, 5200 weeks, or 36500 days.

intervalUnit string

The unit of time for time-based retention. Valid values: DAYS, WEEKS, MONTHS, or YEARS.

interval int

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 str

The unit of time for time-based retention. Valid values: DAYS, WEEKS, MONTHS, or YEARS.

interval Number

The amount of time to retain each snapshot. The maximum is 100 years. This is equivalent to 1200 months, 5200 weeks, or 36500 days.

intervalUnit String

The unit of time for time-based retention. Valid values: DAYS, WEEKS, MONTHS, or YEARS.

LifecyclePolicyPolicyDetailsScheduleDeprecateRule

Count int

How many snapshots to keep. Must be an integer between 1 and 1000.

Interval int

The amount of time to retain each snapshot. The maximum is 100 years. This is equivalent to 1200 months, 5200 weeks, or 36500 days.

IntervalUnit string

The unit of time for time-based retention. Valid values: DAYS, WEEKS, MONTHS, or YEARS.

Count int

How many snapshots to keep. Must be an integer between 1 and 1000.

Interval int

The amount of time to retain each snapshot. The maximum is 100 years. This is equivalent to 1200 months, 5200 weeks, or 36500 days.

IntervalUnit string

The unit of time for time-based retention. Valid values: DAYS, WEEKS, MONTHS, or YEARS.

count Integer

How many snapshots to keep. Must be an integer between 1 and 1000.

interval Integer

The amount of time to retain each snapshot. The maximum is 100 years. This is equivalent to 1200 months, 5200 weeks, or 36500 days.

intervalUnit String

The unit of time for time-based retention. Valid values: DAYS, WEEKS, MONTHS, or YEARS.

count number

How many snapshots to keep. Must be an integer between 1 and 1000.

interval number

The amount of time to retain each snapshot. The maximum is 100 years. This is equivalent to 1200 months, 5200 weeks, or 36500 days.

intervalUnit string

The unit of time for time-based retention. Valid values: DAYS, WEEKS, MONTHS, or YEARS.

count int

How many snapshots to keep. Must be an integer between 1 and 1000.

interval int

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 str

The unit of time for time-based retention. Valid values: DAYS, WEEKS, MONTHS, or YEARS.

count Number

How many snapshots to keep. Must be an integer between 1 and 1000.

interval Number

The amount of time to retain each snapshot. The maximum is 100 years. This is equivalent to 1200 months, 5200 weeks, or 36500 days.

intervalUnit String

The unit of time for time-based retention. Valid values: DAYS, WEEKS, MONTHS, or YEARS.

LifecyclePolicyPolicyDetailsScheduleFastRestoreRule

AvailabilityZones List<string>

The Availability Zones in which to enable fast snapshot restore.

Count int

How many snapshots to keep. Must be an integer between 1 and 1000.

Interval int

The amount of time to retain each snapshot. The maximum is 100 years. This is equivalent to 1200 months, 5200 weeks, or 36500 days.

IntervalUnit string

The unit of time for time-based retention. Valid values: DAYS, WEEKS, MONTHS, or YEARS.

AvailabilityZones []string

The Availability Zones in which to enable fast snapshot restore.

Count int

How many snapshots to keep. Must be an integer between 1 and 1000.

Interval int

The amount of time to retain each snapshot. The maximum is 100 years. This is equivalent to 1200 months, 5200 weeks, or 36500 days.

IntervalUnit string

The unit of time for time-based retention. Valid values: DAYS, WEEKS, MONTHS, or YEARS.

availabilityZones List<String>

The Availability Zones in which to enable fast snapshot restore.

count Integer

How many snapshots to keep. Must be an integer between 1 and 1000.

interval Integer

The amount of time to retain each snapshot. The maximum is 100 years. This is equivalent to 1200 months, 5200 weeks, or 36500 days.

intervalUnit String

The unit of time for time-based retention. Valid values: DAYS, WEEKS, MONTHS, or YEARS.

availabilityZones string[]

The Availability Zones in which to enable fast snapshot restore.

count number

How many snapshots to keep. Must be an integer between 1 and 1000.

interval number

The amount of time to retain each snapshot. The maximum is 100 years. This is equivalent to 1200 months, 5200 weeks, or 36500 days.

intervalUnit string

The unit of time for time-based retention. Valid values: DAYS, WEEKS, MONTHS, or YEARS.

availability_zones Sequence[str]

The Availability Zones in which to enable fast snapshot restore.

count int

How many snapshots to keep. Must be an integer between 1 and 1000.

interval int

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 str

The unit of time for time-based retention. Valid values: DAYS, WEEKS, MONTHS, or YEARS.

availabilityZones List<String>

The Availability Zones in which to enable fast snapshot restore.

count Number

How many snapshots to keep. Must be an integer between 1 and 1000.

interval Number

The amount of time to retain each snapshot. The maximum is 100 years. This is equivalent to 1200 months, 5200 weeks, or 36500 days.

intervalUnit String

The unit of time for time-based retention. Valid values: DAYS, WEEKS, MONTHS, or YEARS.

LifecyclePolicyPolicyDetailsScheduleRetainRule

Count int

How many snapshots to keep. Must be an integer between 1 and 1000.

Interval int

The amount of time to retain each snapshot. The maximum is 100 years. This is equivalent to 1200 months, 5200 weeks, or 36500 days.

IntervalUnit string

The unit of time for time-based retention. Valid values: DAYS, WEEKS, MONTHS, or YEARS.

Count int

How many snapshots to keep. Must be an integer between 1 and 1000.

Interval int

The amount of time to retain each snapshot. The maximum is 100 years. This is equivalent to 1200 months, 5200 weeks, or 36500 days.

IntervalUnit string

The unit of time for time-based retention. Valid values: DAYS, WEEKS, MONTHS, or YEARS.

count Integer

How many snapshots to keep. Must be an integer between 1 and 1000.

interval Integer

The amount of time to retain each snapshot. The maximum is 100 years. This is equivalent to 1200 months, 5200 weeks, or 36500 days.

intervalUnit String

The unit of time for time-based retention. Valid values: DAYS, WEEKS, MONTHS, or YEARS.

count number

How many snapshots to keep. Must be an integer between 1 and 1000.

interval number

The amount of time to retain each snapshot. The maximum is 100 years. This is equivalent to 1200 months, 5200 weeks, or 36500 days.

intervalUnit string

The unit of time for time-based retention. Valid values: DAYS, WEEKS, MONTHS, or YEARS.

count int

How many snapshots to keep. Must be an integer between 1 and 1000.

interval int

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 str

The unit of time for time-based retention. Valid values: DAYS, WEEKS, MONTHS, or YEARS.

count Number

How many snapshots to keep. Must be an integer between 1 and 1000.

interval Number

The amount of time to retain each snapshot. The maximum is 100 years. This is equivalent to 1200 months, 5200 weeks, or 36500 days.

intervalUnit String

The unit of time for time-based retention. Valid values: DAYS, WEEKS, MONTHS, or YEARS.

LifecyclePolicyPolicyDetailsScheduleShareRule

TargetAccounts List<string>

The IDs of the AWS accounts with which to share the snapshots.

UnshareInterval int
UnshareIntervalUnit string
TargetAccounts []string

The IDs of the AWS accounts with which to share the snapshots.

UnshareInterval int
UnshareIntervalUnit string
targetAccounts List<String>

The IDs of the AWS accounts with which to share the snapshots.

unshareInterval Integer
unshareIntervalUnit String
targetAccounts string[]

The IDs of the AWS accounts with which to share the snapshots.

unshareInterval number
unshareIntervalUnit string
target_accounts Sequence[str]

The IDs of the AWS accounts with which to share the snapshots.

unshare_interval int
unshare_interval_unit str
targetAccounts List<String>

The IDs of the AWS accounts with which to share the snapshots.

unshareInterval Number
unshareIntervalUnit String

Import

DLM lifecycle policies can be imported by their policy ID

 $ pulumi import aws:dlm/lifecyclePolicy:LifecyclePolicy example policy-abcdef12345678901

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes

This Pulumi package is based on the aws Terraform Provider.