Class LifecyclePolicy
Provides a Data Lifecycle Manager (DLM) lifecycle policy for managing snapshots.
Example Usage
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
{
Policy = @"{
""Version"": ""2012-10-17"",
""Statement"": [
{
""Effect"": ""Allow"",
""Action"": [
""ec2:CreateSnapshot"",
""ec2:DeleteSnapshot"",
""ec2:DescribeVolumes"",
""ec2:DescribeSnapshots""
],
""Resource"": ""*""
},
{
""Effect"": ""Allow"",
""Action"": [
""ec2:CreateTags""
],
""Resource"": ""arn:aws:ec2:*::snapshot/*""
}
]
}
",
Role = dlmLifecycleRole.Id,
});
var example = new Aws.Dlm.LifecyclePolicy("example", new Aws.Dlm.LifecyclePolicyArgs
{
Description = "example DLM lifecycle policy",
ExecutionRoleArn = dlmLifecycleRole.Arn,
PolicyDetails = new Aws.Dlm.Inputs.LifecyclePolicyPolicyDetailsArgs
{
ResourceTypes =
{
"VOLUME",
},
Schedule =
{
{
{ "copyTags", false },
{ "createRule",
{
{ "interval", 24 },
{ "intervalUnit", "HOURS" },
{ "times", "23:45" },
} },
{ "name", "2 weeks of daily snapshots" },
{ "retainRule",
{
{ "count", 14 },
} },
{ "tagsToAdd",
{
{ "SnapshotCreator", "DLM" },
} },
},
},
TargetTags =
{
{ "Snapshot", "true" },
},
},
State = "ENABLED",
});
}
}
Inherited Members
Namespace: Pulumi.Aws.Dlm
Assembly: Pulumi.Aws.dll
Syntax
public class LifecyclePolicy : CustomResource
Constructors
View SourceLifecyclePolicy(String, LifecyclePolicyArgs, CustomResourceOptions)
Create a LifecyclePolicy resource with the given unique name, arguments, and options.
Declaration
public LifecyclePolicy(string name, LifecyclePolicyArgs args, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resource |
| LifecyclePolicyArgs | args | The arguments used to populate this resource's properties |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Properties
View SourceArn
Amazon Resource Name (ARN) of the DLM Lifecycle Policy.
Declaration
public Output<string> Arn { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Description
A description for the DLM lifecycle policy.
Declaration
public Output<string> Description { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
ExecutionRoleArn
The ARN of an IAM role that is able to be assumed by the DLM service.
Declaration
public Output<string> ExecutionRoleArn { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
PolicyDetails
See the policy_details configuration block. Max of 1.
Declaration
public Output<LifecyclePolicyPolicyDetails> PolicyDetails { get; }
Property Value
| Type | Description |
|---|---|
| Output<LifecyclePolicyPolicyDetails> |
State
Whether the lifecycle policy should be enabled or disabled. ENABLED or DISABLED are valid values. Defaults to ENABLED.
Declaration
public Output<string> State { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Tags
Key-value map of resource tags.
Declaration
public Output<ImmutableDictionary<string, object>> Tags { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Collections.Immutable.ImmutableDictionary<System.String, System.Object>> |
Methods
View SourceGet(String, Input<String>, LifecyclePolicyState, CustomResourceOptions)
Get an existing LifecyclePolicy resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
Declaration
public static LifecyclePolicy Get(string name, Input<string> id, LifecyclePolicyState state = null, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resulting resource. |
| Input<System.String> | id | The unique provider ID of the resource to lookup. |
| LifecyclePolicyState | state | Any extra arguments used during the lookup. |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Returns
| Type | Description |
|---|---|
| LifecyclePolicy |