aws logo
AWS Classic v5.33.0, Mar 24 23

aws.s3.BucketLifecycleConfigurationV2

Provides an independent configuration resource for S3 bucket lifecycle configuration.

An S3 Lifecycle configuration consists of one or more Lifecycle rules. Each rule consists of the following:

  • Rule metadata (id and status)
  • Filter identifying objects to which the rule applies
  • One or more transition or expiration actions

For more information see the Amazon S3 User Guide on Lifecycle Configuration Elements.

NOTE: S3 Buckets only support a single lifecycle configuration. Declaring multiple aws.s3.BucketLifecycleConfigurationV2 resources to the same S3 Bucket will cause a perpetual difference in configuration.

Example Usage

With neither a filter nor prefix specified

using System.Collections.Generic;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var example = new Aws.S3.BucketLifecycleConfigurationV2("example", new()
    {
        Bucket = aws_s3_bucket.Bucket.Id,
        Rules = new[]
        {
            new Aws.S3.Inputs.BucketLifecycleConfigurationV2RuleArgs
            {
                Id = "rule-1",
                Status = "Enabled",
            },
        },
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/s3"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := s3.NewBucketLifecycleConfigurationV2(ctx, "example", &s3.BucketLifecycleConfigurationV2Args{
			Bucket: pulumi.Any(aws_s3_bucket.Bucket.Id),
			Rules: s3.BucketLifecycleConfigurationV2RuleArray{
				&s3.BucketLifecycleConfigurationV2RuleArgs{
					Id:     pulumi.String("rule-1"),
					Status: pulumi.String("Enabled"),
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.s3.BucketLifecycleConfigurationV2;
import com.pulumi.aws.s3.BucketLifecycleConfigurationV2Args;
import com.pulumi.aws.s3.inputs.BucketLifecycleConfigurationV2RuleArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

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

    public static void stack(Context ctx) {
        var example = new BucketLifecycleConfigurationV2("example", BucketLifecycleConfigurationV2Args.builder()        
            .bucket(aws_s3_bucket.bucket().id())
            .rules(BucketLifecycleConfigurationV2RuleArgs.builder()
                .id("rule-1")
                .status("Enabled")
                .build())
            .build());

    }
}
import pulumi
import pulumi_aws as aws

example = aws.s3.BucketLifecycleConfigurationV2("example",
    bucket=aws_s3_bucket["bucket"]["id"],
    rules=[aws.s3.BucketLifecycleConfigurationV2RuleArgs(
        id="rule-1",
        status="Enabled",
    )])
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = new aws.s3.BucketLifecycleConfigurationV2("example", {
    bucket: aws_s3_bucket.bucket.id,
    rules: [{
        id: "rule-1",
        status: "Enabled",
    }],
});
resources:
  example:
    type: aws:s3:BucketLifecycleConfigurationV2
    properties:
      bucket: ${aws_s3_bucket.bucket.id}
      rules:
        - id: rule-1
          status: Enabled

Specifying an empty filter

using System.Collections.Generic;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var example = new Aws.S3.BucketLifecycleConfigurationV2("example", new()
    {
        Bucket = aws_s3_bucket.Bucket.Id,
        Rules = new[]
        {
            new Aws.S3.Inputs.BucketLifecycleConfigurationV2RuleArgs
            {
                Id = "rule-1",
                Filter = null,
                Status = "Enabled",
            },
        },
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/s3"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := s3.NewBucketLifecycleConfigurationV2(ctx, "example", &s3.BucketLifecycleConfigurationV2Args{
			Bucket: pulumi.Any(aws_s3_bucket.Bucket.Id),
			Rules: s3.BucketLifecycleConfigurationV2RuleArray{
				&s3.BucketLifecycleConfigurationV2RuleArgs{
					Id:     pulumi.String("rule-1"),
					Filter: nil,
					Status: pulumi.String("Enabled"),
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.s3.BucketLifecycleConfigurationV2;
import com.pulumi.aws.s3.BucketLifecycleConfigurationV2Args;
import com.pulumi.aws.s3.inputs.BucketLifecycleConfigurationV2RuleArgs;
import com.pulumi.aws.s3.inputs.BucketLifecycleConfigurationV2RuleFilterArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

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

    public static void stack(Context ctx) {
        var example = new BucketLifecycleConfigurationV2("example", BucketLifecycleConfigurationV2Args.builder()        
            .bucket(aws_s3_bucket.bucket().id())
            .rules(BucketLifecycleConfigurationV2RuleArgs.builder()
                .id("rule-1")
                .filter()
                .status("Enabled")
                .build())
            .build());

    }
}
import pulumi
import pulumi_aws as aws

example = aws.s3.BucketLifecycleConfigurationV2("example",
    bucket=aws_s3_bucket["bucket"]["id"],
    rules=[aws.s3.BucketLifecycleConfigurationV2RuleArgs(
        id="rule-1",
        filter=aws.s3.BucketLifecycleConfigurationV2RuleFilterArgs(),
        status="Enabled",
    )])
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = new aws.s3.BucketLifecycleConfigurationV2("example", {
    bucket: aws_s3_bucket.bucket.id,
    rules: [{
        id: "rule-1",
        filter: {},
        status: "Enabled",
    }],
});
resources:
  example:
    type: aws:s3:BucketLifecycleConfigurationV2
    properties:
      bucket: ${aws_s3_bucket.bucket.id}
      rules:
        - id: rule-1
          filter: {}
          status: Enabled

Specifying a filter using key prefixes

using System.Collections.Generic;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var example = new Aws.S3.BucketLifecycleConfigurationV2("example", new()
    {
        Bucket = aws_s3_bucket.Bucket.Id,
        Rules = new[]
        {
            new Aws.S3.Inputs.BucketLifecycleConfigurationV2RuleArgs
            {
                Id = "rule-1",
                Filter = new Aws.S3.Inputs.BucketLifecycleConfigurationV2RuleFilterArgs
                {
                    Prefix = "logs/",
                },
                Status = "Enabled",
            },
        },
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/s3"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := s3.NewBucketLifecycleConfigurationV2(ctx, "example", &s3.BucketLifecycleConfigurationV2Args{
			Bucket: pulumi.Any(aws_s3_bucket.Bucket.Id),
			Rules: s3.BucketLifecycleConfigurationV2RuleArray{
				&s3.BucketLifecycleConfigurationV2RuleArgs{
					Id: pulumi.String("rule-1"),
					Filter: &s3.BucketLifecycleConfigurationV2RuleFilterArgs{
						Prefix: pulumi.String("logs/"),
					},
					Status: pulumi.String("Enabled"),
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.s3.BucketLifecycleConfigurationV2;
import com.pulumi.aws.s3.BucketLifecycleConfigurationV2Args;
import com.pulumi.aws.s3.inputs.BucketLifecycleConfigurationV2RuleArgs;
import com.pulumi.aws.s3.inputs.BucketLifecycleConfigurationV2RuleFilterArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

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

    public static void stack(Context ctx) {
        var example = new BucketLifecycleConfigurationV2("example", BucketLifecycleConfigurationV2Args.builder()        
            .bucket(aws_s3_bucket.bucket().id())
            .rules(BucketLifecycleConfigurationV2RuleArgs.builder()
                .id("rule-1")
                .filter(BucketLifecycleConfigurationV2RuleFilterArgs.builder()
                    .prefix("logs/")
                    .build())
                .status("Enabled")
                .build())
            .build());

    }
}
import pulumi
import pulumi_aws as aws

example = aws.s3.BucketLifecycleConfigurationV2("example",
    bucket=aws_s3_bucket["bucket"]["id"],
    rules=[aws.s3.BucketLifecycleConfigurationV2RuleArgs(
        id="rule-1",
        filter=aws.s3.BucketLifecycleConfigurationV2RuleFilterArgs(
            prefix="logs/",
        ),
        status="Enabled",
    )])
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = new aws.s3.BucketLifecycleConfigurationV2("example", {
    bucket: aws_s3_bucket.bucket.id,
    rules: [{
        id: "rule-1",
        filter: {
            prefix: "logs/",
        },
        status: "Enabled",
    }],
});
resources:
  example:
    type: aws:s3:BucketLifecycleConfigurationV2
    properties:
      bucket: ${aws_s3_bucket.bucket.id}
      rules:
        - id: rule-1
          filter:
            prefix: logs/
          status: Enabled

If you want to apply a Lifecycle action to a subset of objects based on different key name prefixes, specify separate rules.

using System.Collections.Generic;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var example = new Aws.S3.BucketLifecycleConfigurationV2("example", new()
    {
        Bucket = aws_s3_bucket.Bucket.Id,
        Rules = new[]
        {
            new Aws.S3.Inputs.BucketLifecycleConfigurationV2RuleArgs
            {
                Id = "rule-1",
                Filter = new Aws.S3.Inputs.BucketLifecycleConfigurationV2RuleFilterArgs
                {
                    Prefix = "logs/",
                },
                Status = "Enabled",
            },
            new Aws.S3.Inputs.BucketLifecycleConfigurationV2RuleArgs
            {
                Id = "rule-2",
                Filter = new Aws.S3.Inputs.BucketLifecycleConfigurationV2RuleFilterArgs
                {
                    Prefix = "tmp/",
                },
                Status = "Enabled",
            },
        },
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/s3"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := s3.NewBucketLifecycleConfigurationV2(ctx, "example", &s3.BucketLifecycleConfigurationV2Args{
			Bucket: pulumi.Any(aws_s3_bucket.Bucket.Id),
			Rules: s3.BucketLifecycleConfigurationV2RuleArray{
				&s3.BucketLifecycleConfigurationV2RuleArgs{
					Id: pulumi.String("rule-1"),
					Filter: &s3.BucketLifecycleConfigurationV2RuleFilterArgs{
						Prefix: pulumi.String("logs/"),
					},
					Status: pulumi.String("Enabled"),
				},
				&s3.BucketLifecycleConfigurationV2RuleArgs{
					Id: pulumi.String("rule-2"),
					Filter: &s3.BucketLifecycleConfigurationV2RuleFilterArgs{
						Prefix: pulumi.String("tmp/"),
					},
					Status: pulumi.String("Enabled"),
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.s3.BucketLifecycleConfigurationV2;
import com.pulumi.aws.s3.BucketLifecycleConfigurationV2Args;
import com.pulumi.aws.s3.inputs.BucketLifecycleConfigurationV2RuleArgs;
import com.pulumi.aws.s3.inputs.BucketLifecycleConfigurationV2RuleFilterArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

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

    public static void stack(Context ctx) {
        var example = new BucketLifecycleConfigurationV2("example", BucketLifecycleConfigurationV2Args.builder()        
            .bucket(aws_s3_bucket.bucket().id())
            .rules(            
                BucketLifecycleConfigurationV2RuleArgs.builder()
                    .id("rule-1")
                    .filter(BucketLifecycleConfigurationV2RuleFilterArgs.builder()
                        .prefix("logs/")
                        .build())
                    .status("Enabled")
                    .build(),
                BucketLifecycleConfigurationV2RuleArgs.builder()
                    .id("rule-2")
                    .filter(BucketLifecycleConfigurationV2RuleFilterArgs.builder()
                        .prefix("tmp/")
                        .build())
                    .status("Enabled")
                    .build())
            .build());

    }
}
import pulumi
import pulumi_aws as aws

example = aws.s3.BucketLifecycleConfigurationV2("example",
    bucket=aws_s3_bucket["bucket"]["id"],
    rules=[
        aws.s3.BucketLifecycleConfigurationV2RuleArgs(
            id="rule-1",
            filter=aws.s3.BucketLifecycleConfigurationV2RuleFilterArgs(
                prefix="logs/",
            ),
            status="Enabled",
        ),
        aws.s3.BucketLifecycleConfigurationV2RuleArgs(
            id="rule-2",
            filter=aws.s3.BucketLifecycleConfigurationV2RuleFilterArgs(
                prefix="tmp/",
            ),
            status="Enabled",
        ),
    ])
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = new aws.s3.BucketLifecycleConfigurationV2("example", {
    bucket: aws_s3_bucket.bucket.id,
    rules: [
        {
            id: "rule-1",
            filter: {
                prefix: "logs/",
            },
            status: "Enabled",
        },
        {
            id: "rule-2",
            filter: {
                prefix: "tmp/",
            },
            status: "Enabled",
        },
    ],
});
resources:
  example:
    type: aws:s3:BucketLifecycleConfigurationV2
    properties:
      bucket: ${aws_s3_bucket.bucket.id}
      rules:
        - id: rule-1
          filter:
            prefix: logs/
          status: Enabled
        - id: rule-2
          filter:
            prefix: tmp/
          status: Enabled

Specifying a filter based on an object tag

using System.Collections.Generic;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var example = new Aws.S3.BucketLifecycleConfigurationV2("example", new()
    {
        Bucket = aws_s3_bucket.Bucket.Id,
        Rules = new[]
        {
            new Aws.S3.Inputs.BucketLifecycleConfigurationV2RuleArgs
            {
                Id = "rule-1",
                Filter = new Aws.S3.Inputs.BucketLifecycleConfigurationV2RuleFilterArgs
                {
                    Tag = new Aws.S3.Inputs.BucketLifecycleConfigurationV2RuleFilterTagArgs
                    {
                        Key = "Name",
                        Value = "Staging",
                    },
                },
                Status = "Enabled",
            },
        },
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/s3"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := s3.NewBucketLifecycleConfigurationV2(ctx, "example", &s3.BucketLifecycleConfigurationV2Args{
			Bucket: pulumi.Any(aws_s3_bucket.Bucket.Id),
			Rules: s3.BucketLifecycleConfigurationV2RuleArray{
				&s3.BucketLifecycleConfigurationV2RuleArgs{
					Id: pulumi.String("rule-1"),
					Filter: &s3.BucketLifecycleConfigurationV2RuleFilterArgs{
						Tag: &s3.BucketLifecycleConfigurationV2RuleFilterTagArgs{
							Key:   pulumi.String("Name"),
							Value: pulumi.String("Staging"),
						},
					},
					Status: pulumi.String("Enabled"),
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.s3.BucketLifecycleConfigurationV2;
import com.pulumi.aws.s3.BucketLifecycleConfigurationV2Args;
import com.pulumi.aws.s3.inputs.BucketLifecycleConfigurationV2RuleArgs;
import com.pulumi.aws.s3.inputs.BucketLifecycleConfigurationV2RuleFilterArgs;
import com.pulumi.aws.s3.inputs.BucketLifecycleConfigurationV2RuleFilterTagArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

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

    public static void stack(Context ctx) {
        var example = new BucketLifecycleConfigurationV2("example", BucketLifecycleConfigurationV2Args.builder()        
            .bucket(aws_s3_bucket.bucket().id())
            .rules(BucketLifecycleConfigurationV2RuleArgs.builder()
                .id("rule-1")
                .filter(BucketLifecycleConfigurationV2RuleFilterArgs.builder()
                    .tag(BucketLifecycleConfigurationV2RuleFilterTagArgs.builder()
                        .key("Name")
                        .value("Staging")
                        .build())
                    .build())
                .status("Enabled")
                .build())
            .build());

    }
}
import pulumi
import pulumi_aws as aws

example = aws.s3.BucketLifecycleConfigurationV2("example",
    bucket=aws_s3_bucket["bucket"]["id"],
    rules=[aws.s3.BucketLifecycleConfigurationV2RuleArgs(
        id="rule-1",
        filter=aws.s3.BucketLifecycleConfigurationV2RuleFilterArgs(
            tag=aws.s3.BucketLifecycleConfigurationV2RuleFilterTagArgs(
                key="Name",
                value="Staging",
            ),
        ),
        status="Enabled",
    )])
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = new aws.s3.BucketLifecycleConfigurationV2("example", {
    bucket: aws_s3_bucket.bucket.id,
    rules: [{
        id: "rule-1",
        filter: {
            tag: {
                key: "Name",
                value: "Staging",
            },
        },
        status: "Enabled",
    }],
});
resources:
  example:
    type: aws:s3:BucketLifecycleConfigurationV2
    properties:
      bucket: ${aws_s3_bucket.bucket.id}
      rules:
        - id: rule-1
          filter:
            tag:
              key: Name
              value: Staging
          status: Enabled

Specifying a filter based on multiple tags

using System.Collections.Generic;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var example = new Aws.S3.BucketLifecycleConfigurationV2("example", new()
    {
        Bucket = aws_s3_bucket.Bucket.Id,
        Rules = new[]
        {
            new Aws.S3.Inputs.BucketLifecycleConfigurationV2RuleArgs
            {
                Id = "rule-1",
                Filter = new Aws.S3.Inputs.BucketLifecycleConfigurationV2RuleFilterArgs
                {
                    And = new Aws.S3.Inputs.BucketLifecycleConfigurationV2RuleFilterAndArgs
                    {
                        Tags = 
                        {
                            { "Key1", "Value1" },
                            { "Key2", "Value2" },
                        },
                    },
                },
                Status = "Enabled",
            },
        },
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/s3"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := s3.NewBucketLifecycleConfigurationV2(ctx, "example", &s3.BucketLifecycleConfigurationV2Args{
			Bucket: pulumi.Any(aws_s3_bucket.Bucket.Id),
			Rules: s3.BucketLifecycleConfigurationV2RuleArray{
				&s3.BucketLifecycleConfigurationV2RuleArgs{
					Id: pulumi.String("rule-1"),
					Filter: &s3.BucketLifecycleConfigurationV2RuleFilterArgs{
						And: &s3.BucketLifecycleConfigurationV2RuleFilterAndArgs{
							Tags: pulumi.StringMap{
								"Key1": pulumi.String("Value1"),
								"Key2": pulumi.String("Value2"),
							},
						},
					},
					Status: pulumi.String("Enabled"),
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.s3.BucketLifecycleConfigurationV2;
import com.pulumi.aws.s3.BucketLifecycleConfigurationV2Args;
import com.pulumi.aws.s3.inputs.BucketLifecycleConfigurationV2RuleArgs;
import com.pulumi.aws.s3.inputs.BucketLifecycleConfigurationV2RuleFilterArgs;
import com.pulumi.aws.s3.inputs.BucketLifecycleConfigurationV2RuleFilterAndArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

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

    public static void stack(Context ctx) {
        var example = new BucketLifecycleConfigurationV2("example", BucketLifecycleConfigurationV2Args.builder()        
            .bucket(aws_s3_bucket.bucket().id())
            .rules(BucketLifecycleConfigurationV2RuleArgs.builder()
                .id("rule-1")
                .filter(BucketLifecycleConfigurationV2RuleFilterArgs.builder()
                    .and(BucketLifecycleConfigurationV2RuleFilterAndArgs.builder()
                        .tags(Map.ofEntries(
                            Map.entry("Key1", "Value1"),
                            Map.entry("Key2", "Value2")
                        ))
                        .build())
                    .build())
                .status("Enabled")
                .build())
            .build());

    }
}
import pulumi
import pulumi_aws as aws

example = aws.s3.BucketLifecycleConfigurationV2("example",
    bucket=aws_s3_bucket["bucket"]["id"],
    rules=[aws.s3.BucketLifecycleConfigurationV2RuleArgs(
        id="rule-1",
        filter=aws.s3.BucketLifecycleConfigurationV2RuleFilterArgs(
            and_=aws.s3.BucketLifecycleConfigurationV2RuleFilterAndArgs(
                tags={
                    "Key1": "Value1",
                    "Key2": "Value2",
                },
            ),
        ),
        status="Enabled",
    )])
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = new aws.s3.BucketLifecycleConfigurationV2("example", {
    bucket: aws_s3_bucket.bucket.id,
    rules: [{
        id: "rule-1",
        filter: {
            and: {
                tags: {
                    Key1: "Value1",
                    Key2: "Value2",
                },
            },
        },
        status: "Enabled",
    }],
});
resources:
  example:
    type: aws:s3:BucketLifecycleConfigurationV2
    properties:
      bucket: ${aws_s3_bucket.bucket.id}
      rules:
        - id: rule-1
          filter:
            and:
              tags:
                Key1: Value1
                Key2: Value2
          status: Enabled

Specifying a filter based on both prefix and one or more tags

using System.Collections.Generic;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var example = new Aws.S3.BucketLifecycleConfigurationV2("example", new()
    {
        Bucket = aws_s3_bucket.Bucket.Id,
        Rules = new[]
        {
            new Aws.S3.Inputs.BucketLifecycleConfigurationV2RuleArgs
            {
                Id = "rule-1",
                Filter = new Aws.S3.Inputs.BucketLifecycleConfigurationV2RuleFilterArgs
                {
                    And = new Aws.S3.Inputs.BucketLifecycleConfigurationV2RuleFilterAndArgs
                    {
                        Prefix = "logs/",
                        Tags = 
                        {
                            { "Key1", "Value1" },
                            { "Key2", "Value2" },
                        },
                    },
                },
                Status = "Enabled",
            },
        },
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/s3"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := s3.NewBucketLifecycleConfigurationV2(ctx, "example", &s3.BucketLifecycleConfigurationV2Args{
			Bucket: pulumi.Any(aws_s3_bucket.Bucket.Id),
			Rules: s3.BucketLifecycleConfigurationV2RuleArray{
				&s3.BucketLifecycleConfigurationV2RuleArgs{
					Id: pulumi.String("rule-1"),
					Filter: &s3.BucketLifecycleConfigurationV2RuleFilterArgs{
						And: &s3.BucketLifecycleConfigurationV2RuleFilterAndArgs{
							Prefix: pulumi.String("logs/"),
							Tags: pulumi.StringMap{
								"Key1": pulumi.String("Value1"),
								"Key2": pulumi.String("Value2"),
							},
						},
					},
					Status: pulumi.String("Enabled"),
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.s3.BucketLifecycleConfigurationV2;
import com.pulumi.aws.s3.BucketLifecycleConfigurationV2Args;
import com.pulumi.aws.s3.inputs.BucketLifecycleConfigurationV2RuleArgs;
import com.pulumi.aws.s3.inputs.BucketLifecycleConfigurationV2RuleFilterArgs;
import com.pulumi.aws.s3.inputs.BucketLifecycleConfigurationV2RuleFilterAndArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

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

    public static void stack(Context ctx) {
        var example = new BucketLifecycleConfigurationV2("example", BucketLifecycleConfigurationV2Args.builder()        
            .bucket(aws_s3_bucket.bucket().id())
            .rules(BucketLifecycleConfigurationV2RuleArgs.builder()
                .id("rule-1")
                .filter(BucketLifecycleConfigurationV2RuleFilterArgs.builder()
                    .and(BucketLifecycleConfigurationV2RuleFilterAndArgs.builder()
                        .prefix("logs/")
                        .tags(Map.ofEntries(
                            Map.entry("Key1", "Value1"),
                            Map.entry("Key2", "Value2")
                        ))
                        .build())
                    .build())
                .status("Enabled")
                .build())
            .build());

    }
}
import pulumi
import pulumi_aws as aws

example = aws.s3.BucketLifecycleConfigurationV2("example",
    bucket=aws_s3_bucket["bucket"]["id"],
    rules=[aws.s3.BucketLifecycleConfigurationV2RuleArgs(
        id="rule-1",
        filter=aws.s3.BucketLifecycleConfigurationV2RuleFilterArgs(
            and_=aws.s3.BucketLifecycleConfigurationV2RuleFilterAndArgs(
                prefix="logs/",
                tags={
                    "Key1": "Value1",
                    "Key2": "Value2",
                },
            ),
        ),
        status="Enabled",
    )])
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = new aws.s3.BucketLifecycleConfigurationV2("example", {
    bucket: aws_s3_bucket.bucket.id,
    rules: [{
        id: "rule-1",
        filter: {
            and: {
                prefix: "logs/",
                tags: {
                    Key1: "Value1",
                    Key2: "Value2",
                },
            },
        },
        status: "Enabled",
    }],
});
resources:
  example:
    type: aws:s3:BucketLifecycleConfigurationV2
    properties:
      bucket: ${aws_s3_bucket.bucket.id}
      rules:
        - id: rule-1
          filter:
            and:
              prefix: logs/
              tags:
                Key1: Value1
                Key2: Value2
          status: Enabled

Specifying a filter based on object size

using System.Collections.Generic;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var example = new Aws.S3.BucketLifecycleConfigurationV2("example", new()
    {
        Bucket = aws_s3_bucket.Bucket.Id,
        Rules = new[]
        {
            new Aws.S3.Inputs.BucketLifecycleConfigurationV2RuleArgs
            {
                Id = "rule-1",
                Filter = new Aws.S3.Inputs.BucketLifecycleConfigurationV2RuleFilterArgs
                {
                    ObjectSizeGreaterThan = "500",
                },
                Status = "Enabled",
            },
        },
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/s3"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := s3.NewBucketLifecycleConfigurationV2(ctx, "example", &s3.BucketLifecycleConfigurationV2Args{
			Bucket: pulumi.Any(aws_s3_bucket.Bucket.Id),
			Rules: s3.BucketLifecycleConfigurationV2RuleArray{
				&s3.BucketLifecycleConfigurationV2RuleArgs{
					Id: pulumi.String("rule-1"),
					Filter: &s3.BucketLifecycleConfigurationV2RuleFilterArgs{
						ObjectSizeGreaterThan: pulumi.String("500"),
					},
					Status: pulumi.String("Enabled"),
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.s3.BucketLifecycleConfigurationV2;
import com.pulumi.aws.s3.BucketLifecycleConfigurationV2Args;
import com.pulumi.aws.s3.inputs.BucketLifecycleConfigurationV2RuleArgs;
import com.pulumi.aws.s3.inputs.BucketLifecycleConfigurationV2RuleFilterArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

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

    public static void stack(Context ctx) {
        var example = new BucketLifecycleConfigurationV2("example", BucketLifecycleConfigurationV2Args.builder()        
            .bucket(aws_s3_bucket.bucket().id())
            .rules(BucketLifecycleConfigurationV2RuleArgs.builder()
                .id("rule-1")
                .filter(BucketLifecycleConfigurationV2RuleFilterArgs.builder()
                    .objectSizeGreaterThan(500)
                    .build())
                .status("Enabled")
                .build())
            .build());

    }
}
import pulumi
import pulumi_aws as aws

example = aws.s3.BucketLifecycleConfigurationV2("example",
    bucket=aws_s3_bucket["bucket"]["id"],
    rules=[aws.s3.BucketLifecycleConfigurationV2RuleArgs(
        id="rule-1",
        filter=aws.s3.BucketLifecycleConfigurationV2RuleFilterArgs(
            object_size_greater_than="500",
        ),
        status="Enabled",
    )])
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = new aws.s3.BucketLifecycleConfigurationV2("example", {
    bucket: aws_s3_bucket.bucket.id,
    rules: [{
        id: "rule-1",
        filter: {
            objectSizeGreaterThan: "500",
        },
        status: "Enabled",
    }],
});
resources:
  example:
    type: aws:s3:BucketLifecycleConfigurationV2
    properties:
      bucket: ${aws_s3_bucket.bucket.id}
      rules:
        - id: rule-1
          filter:
            objectSizeGreaterThan: 500
          status: Enabled

Specifying a filter based on object size range and prefix

using System.Collections.Generic;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var example = new Aws.S3.BucketLifecycleConfigurationV2("example", new()
    {
        Bucket = aws_s3_bucket.Bucket.Id,
        Rules = new[]
        {
            new Aws.S3.Inputs.BucketLifecycleConfigurationV2RuleArgs
            {
                Id = "rule-1",
                Filter = new Aws.S3.Inputs.BucketLifecycleConfigurationV2RuleFilterArgs
                {
                    And = new Aws.S3.Inputs.BucketLifecycleConfigurationV2RuleFilterAndArgs
                    {
                        Prefix = "logs/",
                        ObjectSizeGreaterThan = 500,
                        ObjectSizeLessThan = 64000,
                    },
                },
                Status = "Enabled",
            },
        },
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/s3"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := s3.NewBucketLifecycleConfigurationV2(ctx, "example", &s3.BucketLifecycleConfigurationV2Args{
			Bucket: pulumi.Any(aws_s3_bucket.Bucket.Id),
			Rules: s3.BucketLifecycleConfigurationV2RuleArray{
				&s3.BucketLifecycleConfigurationV2RuleArgs{
					Id: pulumi.String("rule-1"),
					Filter: &s3.BucketLifecycleConfigurationV2RuleFilterArgs{
						And: &s3.BucketLifecycleConfigurationV2RuleFilterAndArgs{
							Prefix:                pulumi.String("logs/"),
							ObjectSizeGreaterThan: pulumi.Int(500),
							ObjectSizeLessThan:    pulumi.Int(64000),
						},
					},
					Status: pulumi.String("Enabled"),
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.s3.BucketLifecycleConfigurationV2;
import com.pulumi.aws.s3.BucketLifecycleConfigurationV2Args;
import com.pulumi.aws.s3.inputs.BucketLifecycleConfigurationV2RuleArgs;
import com.pulumi.aws.s3.inputs.BucketLifecycleConfigurationV2RuleFilterArgs;
import com.pulumi.aws.s3.inputs.BucketLifecycleConfigurationV2RuleFilterAndArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

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

    public static void stack(Context ctx) {
        var example = new BucketLifecycleConfigurationV2("example", BucketLifecycleConfigurationV2Args.builder()        
            .bucket(aws_s3_bucket.bucket().id())
            .rules(BucketLifecycleConfigurationV2RuleArgs.builder()
                .id("rule-1")
                .filter(BucketLifecycleConfigurationV2RuleFilterArgs.builder()
                    .and(BucketLifecycleConfigurationV2RuleFilterAndArgs.builder()
                        .prefix("logs/")
                        .objectSizeGreaterThan(500)
                        .objectSizeLessThan(64000)
                        .build())
                    .build())
                .status("Enabled")
                .build())
            .build());

    }
}
import pulumi
import pulumi_aws as aws

example = aws.s3.BucketLifecycleConfigurationV2("example",
    bucket=aws_s3_bucket["bucket"]["id"],
    rules=[aws.s3.BucketLifecycleConfigurationV2RuleArgs(
        id="rule-1",
        filter=aws.s3.BucketLifecycleConfigurationV2RuleFilterArgs(
            and_=aws.s3.BucketLifecycleConfigurationV2RuleFilterAndArgs(
                prefix="logs/",
                object_size_greater_than=500,
                object_size_less_than=64000,
            ),
        ),
        status="Enabled",
    )])
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = new aws.s3.BucketLifecycleConfigurationV2("example", {
    bucket: aws_s3_bucket.bucket.id,
    rules: [{
        id: "rule-1",
        filter: {
            and: {
                prefix: "logs/",
                objectSizeGreaterThan: 500,
                objectSizeLessThan: 64000,
            },
        },
        status: "Enabled",
    }],
});
resources:
  example:
    type: aws:s3:BucketLifecycleConfigurationV2
    properties:
      bucket: ${aws_s3_bucket.bucket.id}
      rules:
        - id: rule-1
          filter:
            and:
              prefix: logs/
              objectSizeGreaterThan: 500
              objectSizeLessThan: 64000
          status: Enabled

Creating a Lifecycle Configuration for a bucket with versioning

using System.Collections.Generic;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var bucket = new Aws.S3.BucketV2("bucket");

    var bucketAcl = new Aws.S3.BucketAclV2("bucketAcl", new()
    {
        Bucket = bucket.Id,
        Acl = "private",
    });

    var bucket_config = new Aws.S3.BucketLifecycleConfigurationV2("bucket-config", new()
    {
        Bucket = bucket.Id,
        Rules = new[]
        {
            new Aws.S3.Inputs.BucketLifecycleConfigurationV2RuleArgs
            {
                Id = "log",
                Expiration = new Aws.S3.Inputs.BucketLifecycleConfigurationV2RuleExpirationArgs
                {
                    Days = 90,
                },
                Filter = new Aws.S3.Inputs.BucketLifecycleConfigurationV2RuleFilterArgs
                {
                    And = new Aws.S3.Inputs.BucketLifecycleConfigurationV2RuleFilterAndArgs
                    {
                        Prefix = "log/",
                        Tags = 
                        {
                            { "rule", "log" },
                            { "autoclean", "true" },
                        },
                    },
                },
                Status = "Enabled",
                Transitions = new[]
                {
                    new Aws.S3.Inputs.BucketLifecycleConfigurationV2RuleTransitionArgs
                    {
                        Days = 30,
                        StorageClass = "STANDARD_IA",
                    },
                    new Aws.S3.Inputs.BucketLifecycleConfigurationV2RuleTransitionArgs
                    {
                        Days = 60,
                        StorageClass = "GLACIER",
                    },
                },
            },
            new Aws.S3.Inputs.BucketLifecycleConfigurationV2RuleArgs
            {
                Id = "tmp",
                Filter = new Aws.S3.Inputs.BucketLifecycleConfigurationV2RuleFilterArgs
                {
                    Prefix = "tmp/",
                },
                Expiration = new Aws.S3.Inputs.BucketLifecycleConfigurationV2RuleExpirationArgs
                {
                    Date = "2023-01-13T00:00:00Z",
                },
                Status = "Enabled",
            },
        },
    });

    var versioningBucket = new Aws.S3.BucketV2("versioningBucket");

    var versioningBucketAcl = new Aws.S3.BucketAclV2("versioningBucketAcl", new()
    {
        Bucket = versioningBucket.Id,
        Acl = "private",
    });

    var versioning = new Aws.S3.BucketVersioningV2("versioning", new()
    {
        Bucket = versioningBucket.Id,
        VersioningConfiguration = new Aws.S3.Inputs.BucketVersioningV2VersioningConfigurationArgs
        {
            Status = "Enabled",
        },
    });

    var versioning_bucket_config = new Aws.S3.BucketLifecycleConfigurationV2("versioning-bucket-config", new()
    {
        Bucket = versioningBucket.Id,
        Rules = new[]
        {
            new Aws.S3.Inputs.BucketLifecycleConfigurationV2RuleArgs
            {
                Id = "config",
                Filter = new Aws.S3.Inputs.BucketLifecycleConfigurationV2RuleFilterArgs
                {
                    Prefix = "config/",
                },
                NoncurrentVersionExpiration = new Aws.S3.Inputs.BucketLifecycleConfigurationV2RuleNoncurrentVersionExpirationArgs
                {
                    NoncurrentDays = 90,
                },
                NoncurrentVersionTransitions = new[]
                {
                    new Aws.S3.Inputs.BucketLifecycleConfigurationV2RuleNoncurrentVersionTransitionArgs
                    {
                        NoncurrentDays = 30,
                        StorageClass = "STANDARD_IA",
                    },
                    new Aws.S3.Inputs.BucketLifecycleConfigurationV2RuleNoncurrentVersionTransitionArgs
                    {
                        NoncurrentDays = 60,
                        StorageClass = "GLACIER",
                    },
                },
                Status = "Enabled",
            },
        },
    }, new CustomResourceOptions
    {
        DependsOn = new[]
        {
            versioning,
        },
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/s3"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		bucket, err := s3.NewBucketV2(ctx, "bucket", nil)
		if err != nil {
			return err
		}
		_, err = s3.NewBucketAclV2(ctx, "bucketAcl", &s3.BucketAclV2Args{
			Bucket: bucket.ID(),
			Acl:    pulumi.String("private"),
		})
		if err != nil {
			return err
		}
		_, err = s3.NewBucketLifecycleConfigurationV2(ctx, "bucket-config", &s3.BucketLifecycleConfigurationV2Args{
			Bucket: bucket.ID(),
			Rules: s3.BucketLifecycleConfigurationV2RuleArray{
				&s3.BucketLifecycleConfigurationV2RuleArgs{
					Id: pulumi.String("log"),
					Expiration: &s3.BucketLifecycleConfigurationV2RuleExpirationArgs{
						Days: pulumi.Int(90),
					},
					Filter: &s3.BucketLifecycleConfigurationV2RuleFilterArgs{
						And: &s3.BucketLifecycleConfigurationV2RuleFilterAndArgs{
							Prefix: pulumi.String("log/"),
							Tags: pulumi.StringMap{
								"rule":      pulumi.String("log"),
								"autoclean": pulumi.String("true"),
							},
						},
					},
					Status: pulumi.String("Enabled"),
					Transitions: s3.BucketLifecycleConfigurationV2RuleTransitionArray{
						&s3.BucketLifecycleConfigurationV2RuleTransitionArgs{
							Days:         pulumi.Int(30),
							StorageClass: pulumi.String("STANDARD_IA"),
						},
						&s3.BucketLifecycleConfigurationV2RuleTransitionArgs{
							Days:         pulumi.Int(60),
							StorageClass: pulumi.String("GLACIER"),
						},
					},
				},
				&s3.BucketLifecycleConfigurationV2RuleArgs{
					Id: pulumi.String("tmp"),
					Filter: &s3.BucketLifecycleConfigurationV2RuleFilterArgs{
						Prefix: pulumi.String("tmp/"),
					},
					Expiration: &s3.BucketLifecycleConfigurationV2RuleExpirationArgs{
						Date: pulumi.String("2023-01-13T00:00:00Z"),
					},
					Status: pulumi.String("Enabled"),
				},
			},
		})
		if err != nil {
			return err
		}
		versioningBucket, err := s3.NewBucketV2(ctx, "versioningBucket", nil)
		if err != nil {
			return err
		}
		_, err = s3.NewBucketAclV2(ctx, "versioningBucketAcl", &s3.BucketAclV2Args{
			Bucket: versioningBucket.ID(),
			Acl:    pulumi.String("private"),
		})
		if err != nil {
			return err
		}
		versioning, err := s3.NewBucketVersioningV2(ctx, "versioning", &s3.BucketVersioningV2Args{
			Bucket: versioningBucket.ID(),
			VersioningConfiguration: &s3.BucketVersioningV2VersioningConfigurationArgs{
				Status: pulumi.String("Enabled"),
			},
		})
		if err != nil {
			return err
		}
		_, err = s3.NewBucketLifecycleConfigurationV2(ctx, "versioning-bucket-config", &s3.BucketLifecycleConfigurationV2Args{
			Bucket: versioningBucket.ID(),
			Rules: s3.BucketLifecycleConfigurationV2RuleArray{
				&s3.BucketLifecycleConfigurationV2RuleArgs{
					Id: pulumi.String("config"),
					Filter: &s3.BucketLifecycleConfigurationV2RuleFilterArgs{
						Prefix: pulumi.String("config/"),
					},
					NoncurrentVersionExpiration: &s3.BucketLifecycleConfigurationV2RuleNoncurrentVersionExpirationArgs{
						NoncurrentDays: pulumi.Int(90),
					},
					NoncurrentVersionTransitions: s3.BucketLifecycleConfigurationV2RuleNoncurrentVersionTransitionArray{
						&s3.BucketLifecycleConfigurationV2RuleNoncurrentVersionTransitionArgs{
							NoncurrentDays: pulumi.Int(30),
							StorageClass:   pulumi.String("STANDARD_IA"),
						},
						&s3.BucketLifecycleConfigurationV2RuleNoncurrentVersionTransitionArgs{
							NoncurrentDays: pulumi.Int(60),
							StorageClass:   pulumi.String("GLACIER"),
						},
					},
					Status: pulumi.String("Enabled"),
				},
			},
		}, pulumi.DependsOn([]pulumi.Resource{
			versioning,
		}))
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.s3.BucketV2;
import com.pulumi.aws.s3.BucketAclV2;
import com.pulumi.aws.s3.BucketAclV2Args;
import com.pulumi.aws.s3.BucketLifecycleConfigurationV2;
import com.pulumi.aws.s3.BucketLifecycleConfigurationV2Args;
import com.pulumi.aws.s3.inputs.BucketLifecycleConfigurationV2RuleArgs;
import com.pulumi.aws.s3.inputs.BucketLifecycleConfigurationV2RuleExpirationArgs;
import com.pulumi.aws.s3.inputs.BucketLifecycleConfigurationV2RuleFilterArgs;
import com.pulumi.aws.s3.inputs.BucketLifecycleConfigurationV2RuleFilterAndArgs;
import com.pulumi.aws.s3.BucketVersioningV2;
import com.pulumi.aws.s3.BucketVersioningV2Args;
import com.pulumi.aws.s3.inputs.BucketVersioningV2VersioningConfigurationArgs;
import com.pulumi.aws.s3.inputs.BucketLifecycleConfigurationV2RuleNoncurrentVersionExpirationArgs;
import com.pulumi.resources.CustomResourceOptions;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

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

    public static void stack(Context ctx) {
        var bucket = new BucketV2("bucket");

        var bucketAcl = new BucketAclV2("bucketAcl", BucketAclV2Args.builder()        
            .bucket(bucket.id())
            .acl("private")
            .build());

        var bucket_config = new BucketLifecycleConfigurationV2("bucket-config", BucketLifecycleConfigurationV2Args.builder()        
            .bucket(bucket.id())
            .rules(            
                BucketLifecycleConfigurationV2RuleArgs.builder()
                    .id("log")
                    .expiration(BucketLifecycleConfigurationV2RuleExpirationArgs.builder()
                        .days(90)
                        .build())
                    .filter(BucketLifecycleConfigurationV2RuleFilterArgs.builder()
                        .and(BucketLifecycleConfigurationV2RuleFilterAndArgs.builder()
                            .prefix("log/")
                            .tags(Map.ofEntries(
                                Map.entry("rule", "log"),
                                Map.entry("autoclean", "true")
                            ))
                            .build())
                        .build())
                    .status("Enabled")
                    .transitions(                    
                        BucketLifecycleConfigurationV2RuleTransitionArgs.builder()
                            .days(30)
                            .storageClass("STANDARD_IA")
                            .build(),
                        BucketLifecycleConfigurationV2RuleTransitionArgs.builder()
                            .days(60)
                            .storageClass("GLACIER")
                            .build())
                    .build(),
                BucketLifecycleConfigurationV2RuleArgs.builder()
                    .id("tmp")
                    .filter(BucketLifecycleConfigurationV2RuleFilterArgs.builder()
                        .prefix("tmp/")
                        .build())
                    .expiration(BucketLifecycleConfigurationV2RuleExpirationArgs.builder()
                        .date("2023-01-13T00:00:00Z")
                        .build())
                    .status("Enabled")
                    .build())
            .build());

        var versioningBucket = new BucketV2("versioningBucket");

        var versioningBucketAcl = new BucketAclV2("versioningBucketAcl", BucketAclV2Args.builder()        
            .bucket(versioningBucket.id())
            .acl("private")
            .build());

        var versioning = new BucketVersioningV2("versioning", BucketVersioningV2Args.builder()        
            .bucket(versioningBucket.id())
            .versioningConfiguration(BucketVersioningV2VersioningConfigurationArgs.builder()
                .status("Enabled")
                .build())
            .build());

        var versioning_bucket_config = new BucketLifecycleConfigurationV2("versioning-bucket-config", BucketLifecycleConfigurationV2Args.builder()        
            .bucket(versioningBucket.id())
            .rules(BucketLifecycleConfigurationV2RuleArgs.builder()
                .id("config")
                .filter(BucketLifecycleConfigurationV2RuleFilterArgs.builder()
                    .prefix("config/")
                    .build())
                .noncurrentVersionExpiration(BucketLifecycleConfigurationV2RuleNoncurrentVersionExpirationArgs.builder()
                    .noncurrentDays(90)
                    .build())
                .noncurrentVersionTransitions(                
                    BucketLifecycleConfigurationV2RuleNoncurrentVersionTransitionArgs.builder()
                        .noncurrentDays(30)
                        .storageClass("STANDARD_IA")
                        .build(),
                    BucketLifecycleConfigurationV2RuleNoncurrentVersionTransitionArgs.builder()
                        .noncurrentDays(60)
                        .storageClass("GLACIER")
                        .build())
                .status("Enabled")
                .build())
            .build(), CustomResourceOptions.builder()
                .dependsOn(versioning)
                .build());

    }
}
import pulumi
import pulumi_aws as aws

bucket = aws.s3.BucketV2("bucket")
bucket_acl = aws.s3.BucketAclV2("bucketAcl",
    bucket=bucket.id,
    acl="private")
bucket_config = aws.s3.BucketLifecycleConfigurationV2("bucket-config",
    bucket=bucket.id,
    rules=[
        aws.s3.BucketLifecycleConfigurationV2RuleArgs(
            id="log",
            expiration=aws.s3.BucketLifecycleConfigurationV2RuleExpirationArgs(
                days=90,
            ),
            filter=aws.s3.BucketLifecycleConfigurationV2RuleFilterArgs(
                and_=aws.s3.BucketLifecycleConfigurationV2RuleFilterAndArgs(
                    prefix="log/",
                    tags={
                        "rule": "log",
                        "autoclean": "true",
                    },
                ),
            ),
            status="Enabled",
            transitions=[
                aws.s3.BucketLifecycleConfigurationV2RuleTransitionArgs(
                    days=30,
                    storage_class="STANDARD_IA",
                ),
                aws.s3.BucketLifecycleConfigurationV2RuleTransitionArgs(
                    days=60,
                    storage_class="GLACIER",
                ),
            ],
        ),
        aws.s3.BucketLifecycleConfigurationV2RuleArgs(
            id="tmp",
            filter=aws.s3.BucketLifecycleConfigurationV2RuleFilterArgs(
                prefix="tmp/",
            ),
            expiration=aws.s3.BucketLifecycleConfigurationV2RuleExpirationArgs(
                date="2023-01-13T00:00:00Z",
            ),
            status="Enabled",
        ),
    ])
versioning_bucket = aws.s3.BucketV2("versioningBucket")
versioning_bucket_acl = aws.s3.BucketAclV2("versioningBucketAcl",
    bucket=versioning_bucket.id,
    acl="private")
versioning = aws.s3.BucketVersioningV2("versioning",
    bucket=versioning_bucket.id,
    versioning_configuration=aws.s3.BucketVersioningV2VersioningConfigurationArgs(
        status="Enabled",
    ))
versioning_bucket_config = aws.s3.BucketLifecycleConfigurationV2("versioning-bucket-config",
    bucket=versioning_bucket.id,
    rules=[aws.s3.BucketLifecycleConfigurationV2RuleArgs(
        id="config",
        filter=aws.s3.BucketLifecycleConfigurationV2RuleFilterArgs(
            prefix="config/",
        ),
        noncurrent_version_expiration=aws.s3.BucketLifecycleConfigurationV2RuleNoncurrentVersionExpirationArgs(
            noncurrent_days=90,
        ),
        noncurrent_version_transitions=[
            aws.s3.BucketLifecycleConfigurationV2RuleNoncurrentVersionTransitionArgs(
                noncurrent_days=30,
                storage_class="STANDARD_IA",
            ),
            aws.s3.BucketLifecycleConfigurationV2RuleNoncurrentVersionTransitionArgs(
                noncurrent_days=60,
                storage_class="GLACIER",
            ),
        ],
        status="Enabled",
    )],
    opts=pulumi.ResourceOptions(depends_on=[versioning]))
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const bucket = new aws.s3.BucketV2("bucket", {});
const bucketAcl = new aws.s3.BucketAclV2("bucketAcl", {
    bucket: bucket.id,
    acl: "private",
});
const bucket_config = new aws.s3.BucketLifecycleConfigurationV2("bucket-config", {
    bucket: bucket.id,
    rules: [
        {
            id: "log",
            expiration: {
                days: 90,
            },
            filter: {
                and: {
                    prefix: "log/",
                    tags: {
                        rule: "log",
                        autoclean: "true",
                    },
                },
            },
            status: "Enabled",
            transitions: [
                {
                    days: 30,
                    storageClass: "STANDARD_IA",
                },
                {
                    days: 60,
                    storageClass: "GLACIER",
                },
            ],
        },
        {
            id: "tmp",
            filter: {
                prefix: "tmp/",
            },
            expiration: {
                date: "2023-01-13T00:00:00Z",
            },
            status: "Enabled",
        },
    ],
});
const versioningBucket = new aws.s3.BucketV2("versioningBucket", {});
const versioningBucketAcl = new aws.s3.BucketAclV2("versioningBucketAcl", {
    bucket: versioningBucket.id,
    acl: "private",
});
const versioning = new aws.s3.BucketVersioningV2("versioning", {
    bucket: versioningBucket.id,
    versioningConfiguration: {
        status: "Enabled",
    },
});
const versioning_bucket_config = new aws.s3.BucketLifecycleConfigurationV2("versioning-bucket-config", {
    bucket: versioningBucket.id,
    rules: [{
        id: "config",
        filter: {
            prefix: "config/",
        },
        noncurrentVersionExpiration: {
            noncurrentDays: 90,
        },
        noncurrentVersionTransitions: [
            {
                noncurrentDays: 30,
                storageClass: "STANDARD_IA",
            },
            {
                noncurrentDays: 60,
                storageClass: "GLACIER",
            },
        ],
        status: "Enabled",
    }],
}, {
    dependsOn: [versioning],
});
resources:
  bucket:
    type: aws:s3:BucketV2
  bucketAcl:
    type: aws:s3:BucketAclV2
    properties:
      bucket: ${bucket.id}
      acl: private
  bucket-config:
    type: aws:s3:BucketLifecycleConfigurationV2
    properties:
      bucket: ${bucket.id}
      rules:
        - id: log
          expiration:
            days: 90
          filter:
            and:
              prefix: log/
              tags:
                rule: log
                autoclean: 'true'
          status: Enabled
          transitions:
            - days: 30
              storageClass: STANDARD_IA
            - days: 60
              storageClass: GLACIER
        - id: tmp
          filter:
            prefix: tmp/
          expiration:
            date: 2023-01-13T00:00:00Z
          status: Enabled
  versioningBucket:
    type: aws:s3:BucketV2
  versioningBucketAcl:
    type: aws:s3:BucketAclV2
    properties:
      bucket: ${versioningBucket.id}
      acl: private
  versioning:
    type: aws:s3:BucketVersioningV2
    properties:
      bucket: ${versioningBucket.id}
      versioningConfiguration:
        status: Enabled
  versioning-bucket-config:
    type: aws:s3:BucketLifecycleConfigurationV2
    properties:
      bucket: ${versioningBucket.id}
      rules:
        - id: config
          filter:
            prefix: config/
          noncurrentVersionExpiration:
            noncurrentDays: 90
          noncurrentVersionTransitions:
            - noncurrentDays: 30
              storageClass: STANDARD_IA
            - noncurrentDays: 60
              storageClass: GLACIER
          status: Enabled
    options:
      dependson:
        - ${versioning}

Create BucketLifecycleConfigurationV2 Resource

new BucketLifecycleConfigurationV2(name: string, args: BucketLifecycleConfigurationV2Args, opts?: CustomResourceOptions);
@overload
def BucketLifecycleConfigurationV2(resource_name: str,
                                   opts: Optional[ResourceOptions] = None,
                                   bucket: Optional[str] = None,
                                   expected_bucket_owner: Optional[str] = None,
                                   rules: Optional[Sequence[BucketLifecycleConfigurationV2RuleArgs]] = None)
@overload
def BucketLifecycleConfigurationV2(resource_name: str,
                                   args: BucketLifecycleConfigurationV2Args,
                                   opts: Optional[ResourceOptions] = None)
func NewBucketLifecycleConfigurationV2(ctx *Context, name string, args BucketLifecycleConfigurationV2Args, opts ...ResourceOption) (*BucketLifecycleConfigurationV2, error)
public BucketLifecycleConfigurationV2(string name, BucketLifecycleConfigurationV2Args args, CustomResourceOptions? opts = null)
public BucketLifecycleConfigurationV2(String name, BucketLifecycleConfigurationV2Args args)
public BucketLifecycleConfigurationV2(String name, BucketLifecycleConfigurationV2Args args, CustomResourceOptions options)
type: aws:s3:BucketLifecycleConfigurationV2
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args BucketLifecycleConfigurationV2Args
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 BucketLifecycleConfigurationV2Args
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 BucketLifecycleConfigurationV2Args
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args BucketLifecycleConfigurationV2Args
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args BucketLifecycleConfigurationV2Args
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

BucketLifecycleConfigurationV2 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 BucketLifecycleConfigurationV2 resource accepts the following input properties:

Bucket string

Name of the source S3 bucket you want Amazon S3 to monitor.

Rules List<BucketLifecycleConfigurationV2RuleArgs>

List of configuration blocks describing the rules managing the replication. See below.

ExpectedBucketOwner string

Account ID of the expected bucket owner. If the bucket is owned by a different account, the request will fail with an HTTP 403 (Access Denied) error.

Bucket string

Name of the source S3 bucket you want Amazon S3 to monitor.

Rules []BucketLifecycleConfigurationV2RuleArgs

List of configuration blocks describing the rules managing the replication. See below.

ExpectedBucketOwner string

Account ID of the expected bucket owner. If the bucket is owned by a different account, the request will fail with an HTTP 403 (Access Denied) error.

bucket String

Name of the source S3 bucket you want Amazon S3 to monitor.

rules List<BucketLifecycleConfigurationV2RuleArgs>

List of configuration blocks describing the rules managing the replication. See below.

expectedBucketOwner String

Account ID of the expected bucket owner. If the bucket is owned by a different account, the request will fail with an HTTP 403 (Access Denied) error.

bucket string

Name of the source S3 bucket you want Amazon S3 to monitor.

rules BucketLifecycleConfigurationV2RuleArgs[]

List of configuration blocks describing the rules managing the replication. See below.

expectedBucketOwner string

Account ID of the expected bucket owner. If the bucket is owned by a different account, the request will fail with an HTTP 403 (Access Denied) error.

bucket str

Name of the source S3 bucket you want Amazon S3 to monitor.

rules Sequence[BucketLifecycleConfigurationV2RuleArgs]

List of configuration blocks describing the rules managing the replication. See below.

expected_bucket_owner str

Account ID of the expected bucket owner. If the bucket is owned by a different account, the request will fail with an HTTP 403 (Access Denied) error.

bucket String

Name of the source S3 bucket you want Amazon S3 to monitor.

rules List<Property Map>

List of configuration blocks describing the rules managing the replication. See below.

expectedBucketOwner String

Account ID of the expected bucket owner. If the bucket is owned by a different account, the request will fail with an HTTP 403 (Access Denied) error.

Outputs

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

Id string

The provider-assigned unique ID for this managed resource.

Id string

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

id string

The provider-assigned unique ID for this managed resource.

id str

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

Look up Existing BucketLifecycleConfigurationV2 Resource

Get an existing BucketLifecycleConfigurationV2 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?: BucketLifecycleConfigurationV2State, opts?: CustomResourceOptions): BucketLifecycleConfigurationV2
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        bucket: Optional[str] = None,
        expected_bucket_owner: Optional[str] = None,
        rules: Optional[Sequence[BucketLifecycleConfigurationV2RuleArgs]] = None) -> BucketLifecycleConfigurationV2
func GetBucketLifecycleConfigurationV2(ctx *Context, name string, id IDInput, state *BucketLifecycleConfigurationV2State, opts ...ResourceOption) (*BucketLifecycleConfigurationV2, error)
public static BucketLifecycleConfigurationV2 Get(string name, Input<string> id, BucketLifecycleConfigurationV2State? state, CustomResourceOptions? opts = null)
public static BucketLifecycleConfigurationV2 get(String name, Output<String> id, BucketLifecycleConfigurationV2State 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:
Bucket string

Name of the source S3 bucket you want Amazon S3 to monitor.

ExpectedBucketOwner string

Account ID of the expected bucket owner. If the bucket is owned by a different account, the request will fail with an HTTP 403 (Access Denied) error.

Rules List<BucketLifecycleConfigurationV2RuleArgs>

List of configuration blocks describing the rules managing the replication. See below.

Bucket string

Name of the source S3 bucket you want Amazon S3 to monitor.

ExpectedBucketOwner string

Account ID of the expected bucket owner. If the bucket is owned by a different account, the request will fail with an HTTP 403 (Access Denied) error.

Rules []BucketLifecycleConfigurationV2RuleArgs

List of configuration blocks describing the rules managing the replication. See below.

bucket String

Name of the source S3 bucket you want Amazon S3 to monitor.

expectedBucketOwner String

Account ID of the expected bucket owner. If the bucket is owned by a different account, the request will fail with an HTTP 403 (Access Denied) error.

rules List<BucketLifecycleConfigurationV2RuleArgs>

List of configuration blocks describing the rules managing the replication. See below.

bucket string

Name of the source S3 bucket you want Amazon S3 to monitor.

expectedBucketOwner string

Account ID of the expected bucket owner. If the bucket is owned by a different account, the request will fail with an HTTP 403 (Access Denied) error.

rules BucketLifecycleConfigurationV2RuleArgs[]

List of configuration blocks describing the rules managing the replication. See below.

bucket str

Name of the source S3 bucket you want Amazon S3 to monitor.

expected_bucket_owner str

Account ID of the expected bucket owner. If the bucket is owned by a different account, the request will fail with an HTTP 403 (Access Denied) error.

rules Sequence[BucketLifecycleConfigurationV2RuleArgs]

List of configuration blocks describing the rules managing the replication. See below.

bucket String

Name of the source S3 bucket you want Amazon S3 to monitor.

expectedBucketOwner String

Account ID of the expected bucket owner. If the bucket is owned by a different account, the request will fail with an HTTP 403 (Access Denied) error.

rules List<Property Map>

List of configuration blocks describing the rules managing the replication. See below.

Supporting Types

BucketLifecycleConfigurationV2Rule

Id string

Unique identifier for the rule. The value cannot be longer than 255 characters.

Status string

Whether the rule is currently being applied. Valid values: Enabled or Disabled.

AbortIncompleteMultipartUpload BucketLifecycleConfigurationV2RuleAbortIncompleteMultipartUpload

Configuration block that specifies the days since the initiation of an incomplete multipart upload that Amazon S3 will wait before permanently removing all parts of the upload. See below.

Expiration BucketLifecycleConfigurationV2RuleExpiration

Configuration block that specifies the expiration for the lifecycle of the object in the form of date, days and, whether the object has a delete marker. See below.

Filter BucketLifecycleConfigurationV2RuleFilter

Configuration block used to identify objects that a Lifecycle Rule applies to. See below. If not specified, the rule will default to using prefix.

NoncurrentVersionExpiration BucketLifecycleConfigurationV2RuleNoncurrentVersionExpiration

Configuration block that specifies when noncurrent object versions expire. See below.

NoncurrentVersionTransitions List<BucketLifecycleConfigurationV2RuleNoncurrentVersionTransition>

Set of configuration blocks that specify the transition rule for the lifecycle rule that describes when noncurrent objects transition to a specific storage class. See below.

Prefix string

DEPRECATED Use filter instead. This has been deprecated by Amazon S3. Prefix identifying one or more objects to which the rule applies. Defaults to an empty string ("") if filter is not specified.

Deprecated:

Use filter instead

Transitions List<BucketLifecycleConfigurationV2RuleTransition>

Set of configuration blocks that specify when an Amazon S3 object transitions to a specified storage class. See below.

Id string

Unique identifier for the rule. The value cannot be longer than 255 characters.

Status string

Whether the rule is currently being applied. Valid values: Enabled or Disabled.

AbortIncompleteMultipartUpload BucketLifecycleConfigurationV2RuleAbortIncompleteMultipartUpload

Configuration block that specifies the days since the initiation of an incomplete multipart upload that Amazon S3 will wait before permanently removing all parts of the upload. See below.

Expiration BucketLifecycleConfigurationV2RuleExpiration

Configuration block that specifies the expiration for the lifecycle of the object in the form of date, days and, whether the object has a delete marker. See below.

Filter BucketLifecycleConfigurationV2RuleFilter

Configuration block used to identify objects that a Lifecycle Rule applies to. See below. If not specified, the rule will default to using prefix.

NoncurrentVersionExpiration BucketLifecycleConfigurationV2RuleNoncurrentVersionExpiration

Configuration block that specifies when noncurrent object versions expire. See below.

NoncurrentVersionTransitions []BucketLifecycleConfigurationV2RuleNoncurrentVersionTransition

Set of configuration blocks that specify the transition rule for the lifecycle rule that describes when noncurrent objects transition to a specific storage class. See below.

Prefix string

DEPRECATED Use filter instead. This has been deprecated by Amazon S3. Prefix identifying one or more objects to which the rule applies. Defaults to an empty string ("") if filter is not specified.

Deprecated:

Use filter instead

Transitions []BucketLifecycleConfigurationV2RuleTransition

Set of configuration blocks that specify when an Amazon S3 object transitions to a specified storage class. See below.

id String

Unique identifier for the rule. The value cannot be longer than 255 characters.

status String

Whether the rule is currently being applied. Valid values: Enabled or Disabled.

abortIncompleteMultipartUpload BucketLifecycleConfigurationV2RuleAbortIncompleteMultipartUpload

Configuration block that specifies the days since the initiation of an incomplete multipart upload that Amazon S3 will wait before permanently removing all parts of the upload. See below.

expiration BucketLifecycleConfigurationV2RuleExpiration

Configuration block that specifies the expiration for the lifecycle of the object in the form of date, days and, whether the object has a delete marker. See below.

filter BucketLifecycleConfigurationV2RuleFilter

Configuration block used to identify objects that a Lifecycle Rule applies to. See below. If not specified, the rule will default to using prefix.

noncurrentVersionExpiration BucketLifecycleConfigurationV2RuleNoncurrentVersionExpiration

Configuration block that specifies when noncurrent object versions expire. See below.

noncurrentVersionTransitions List<BucketLifecycleConfigurationV2RuleNoncurrentVersionTransition>

Set of configuration blocks that specify the transition rule for the lifecycle rule that describes when noncurrent objects transition to a specific storage class. See below.

prefix String

DEPRECATED Use filter instead. This has been deprecated by Amazon S3. Prefix identifying one or more objects to which the rule applies. Defaults to an empty string ("") if filter is not specified.

Deprecated:

Use filter instead

transitions List<BucketLifecycleConfigurationV2RuleTransition>

Set of configuration blocks that specify when an Amazon S3 object transitions to a specified storage class. See below.

id string

Unique identifier for the rule. The value cannot be longer than 255 characters.

status string

Whether the rule is currently being applied. Valid values: Enabled or Disabled.

abortIncompleteMultipartUpload BucketLifecycleConfigurationV2RuleAbortIncompleteMultipartUpload

Configuration block that specifies the days since the initiation of an incomplete multipart upload that Amazon S3 will wait before permanently removing all parts of the upload. See below.

expiration BucketLifecycleConfigurationV2RuleExpiration

Configuration block that specifies the expiration for the lifecycle of the object in the form of date, days and, whether the object has a delete marker. See below.

filter BucketLifecycleConfigurationV2RuleFilter

Configuration block used to identify objects that a Lifecycle Rule applies to. See below. If not specified, the rule will default to using prefix.

noncurrentVersionExpiration BucketLifecycleConfigurationV2RuleNoncurrentVersionExpiration

Configuration block that specifies when noncurrent object versions expire. See below.

noncurrentVersionTransitions BucketLifecycleConfigurationV2RuleNoncurrentVersionTransition[]

Set of configuration blocks that specify the transition rule for the lifecycle rule that describes when noncurrent objects transition to a specific storage class. See below.

prefix string

DEPRECATED Use filter instead. This has been deprecated by Amazon S3. Prefix identifying one or more objects to which the rule applies. Defaults to an empty string ("") if filter is not specified.

Deprecated:

Use filter instead

transitions BucketLifecycleConfigurationV2RuleTransition[]

Set of configuration blocks that specify when an Amazon S3 object transitions to a specified storage class. See below.

id str

Unique identifier for the rule. The value cannot be longer than 255 characters.

status str

Whether the rule is currently being applied. Valid values: Enabled or Disabled.

abort_incomplete_multipart_upload BucketLifecycleConfigurationV2RuleAbortIncompleteMultipartUpload

Configuration block that specifies the days since the initiation of an incomplete multipart upload that Amazon S3 will wait before permanently removing all parts of the upload. See below.

expiration BucketLifecycleConfigurationV2RuleExpiration

Configuration block that specifies the expiration for the lifecycle of the object in the form of date, days and, whether the object has a delete marker. See below.

filter BucketLifecycleConfigurationV2RuleFilter

Configuration block used to identify objects that a Lifecycle Rule applies to. See below. If not specified, the rule will default to using prefix.

noncurrent_version_expiration BucketLifecycleConfigurationV2RuleNoncurrentVersionExpiration

Configuration block that specifies when noncurrent object versions expire. See below.

noncurrent_version_transitions Sequence[BucketLifecycleConfigurationV2RuleNoncurrentVersionTransition]

Set of configuration blocks that specify the transition rule for the lifecycle rule that describes when noncurrent objects transition to a specific storage class. See below.

prefix str

DEPRECATED Use filter instead. This has been deprecated by Amazon S3. Prefix identifying one or more objects to which the rule applies. Defaults to an empty string ("") if filter is not specified.

Deprecated:

Use filter instead

transitions Sequence[BucketLifecycleConfigurationV2RuleTransition]

Set of configuration blocks that specify when an Amazon S3 object transitions to a specified storage class. See below.

id String

Unique identifier for the rule. The value cannot be longer than 255 characters.

status String

Whether the rule is currently being applied. Valid values: Enabled or Disabled.

abortIncompleteMultipartUpload Property Map

Configuration block that specifies the days since the initiation of an incomplete multipart upload that Amazon S3 will wait before permanently removing all parts of the upload. See below.

expiration Property Map

Configuration block that specifies the expiration for the lifecycle of the object in the form of date, days and, whether the object has a delete marker. See below.

filter Property Map

Configuration block used to identify objects that a Lifecycle Rule applies to. See below. If not specified, the rule will default to using prefix.

noncurrentVersionExpiration Property Map

Configuration block that specifies when noncurrent object versions expire. See below.

noncurrentVersionTransitions List<Property Map>

Set of configuration blocks that specify the transition rule for the lifecycle rule that describes when noncurrent objects transition to a specific storage class. See below.

prefix String

DEPRECATED Use filter instead. This has been deprecated by Amazon S3. Prefix identifying one or more objects to which the rule applies. Defaults to an empty string ("") if filter is not specified.

Deprecated:

Use filter instead

transitions List<Property Map>

Set of configuration blocks that specify when an Amazon S3 object transitions to a specified storage class. See below.

BucketLifecycleConfigurationV2RuleAbortIncompleteMultipartUpload

DaysAfterInitiation int

Number of days after which Amazon S3 aborts an incomplete multipart upload.

DaysAfterInitiation int

Number of days after which Amazon S3 aborts an incomplete multipart upload.

daysAfterInitiation Integer

Number of days after which Amazon S3 aborts an incomplete multipart upload.

daysAfterInitiation number

Number of days after which Amazon S3 aborts an incomplete multipart upload.

days_after_initiation int

Number of days after which Amazon S3 aborts an incomplete multipart upload.

daysAfterInitiation Number

Number of days after which Amazon S3 aborts an incomplete multipart upload.

BucketLifecycleConfigurationV2RuleExpiration

Date string

Date the object is to be moved or deleted. Should be in RFC3339 format.

Days int

Lifetime, in days, of the objects that are subject to the rule. The value must be a non-zero positive integer.

ExpiredObjectDeleteMarker bool

Indicates whether Amazon S3 will remove a delete marker with no noncurrent versions. If set to true, the delete marker will be expired; if set to false the policy takes no action.

Date string

Date the object is to be moved or deleted. Should be in RFC3339 format.

Days int

Lifetime, in days, of the objects that are subject to the rule. The value must be a non-zero positive integer.

ExpiredObjectDeleteMarker bool

Indicates whether Amazon S3 will remove a delete marker with no noncurrent versions. If set to true, the delete marker will be expired; if set to false the policy takes no action.

date String

Date the object is to be moved or deleted. Should be in RFC3339 format.

days Integer

Lifetime, in days, of the objects that are subject to the rule. The value must be a non-zero positive integer.

expiredObjectDeleteMarker Boolean

Indicates whether Amazon S3 will remove a delete marker with no noncurrent versions. If set to true, the delete marker will be expired; if set to false the policy takes no action.

date string

Date the object is to be moved or deleted. Should be in RFC3339 format.

days number

Lifetime, in days, of the objects that are subject to the rule. The value must be a non-zero positive integer.

expiredObjectDeleteMarker boolean

Indicates whether Amazon S3 will remove a delete marker with no noncurrent versions. If set to true, the delete marker will be expired; if set to false the policy takes no action.

date str

Date the object is to be moved or deleted. Should be in RFC3339 format.

days int

Lifetime, in days, of the objects that are subject to the rule. The value must be a non-zero positive integer.

expired_object_delete_marker bool

Indicates whether Amazon S3 will remove a delete marker with no noncurrent versions. If set to true, the delete marker will be expired; if set to false the policy takes no action.

date String

Date the object is to be moved or deleted. Should be in RFC3339 format.

days Number

Lifetime, in days, of the objects that are subject to the rule. The value must be a non-zero positive integer.

expiredObjectDeleteMarker Boolean

Indicates whether Amazon S3 will remove a delete marker with no noncurrent versions. If set to true, the delete marker will be expired; if set to false the policy takes no action.

BucketLifecycleConfigurationV2RuleFilter

And BucketLifecycleConfigurationV2RuleFilterAnd

Configuration block used to apply a logical AND to two or more predicates. See below. The Lifecycle Rule will apply to any object matching all the predicates configured inside the and block.

ObjectSizeGreaterThan string

Minimum object size (in bytes) to which the rule applies.

ObjectSizeLessThan string

Maximum object size (in bytes) to which the rule applies.

Prefix string

Prefix identifying one or more objects to which the rule applies. Defaults to an empty string ("") if not specified.

Tag BucketLifecycleConfigurationV2RuleFilterTag

Configuration block for specifying a tag key and value. See below.

And BucketLifecycleConfigurationV2RuleFilterAnd

Configuration block used to apply a logical AND to two or more predicates. See below. The Lifecycle Rule will apply to any object matching all the predicates configured inside the and block.

ObjectSizeGreaterThan string

Minimum object size (in bytes) to which the rule applies.

ObjectSizeLessThan string

Maximum object size (in bytes) to which the rule applies.

Prefix string

Prefix identifying one or more objects to which the rule applies. Defaults to an empty string ("") if not specified.

Tag BucketLifecycleConfigurationV2RuleFilterTag

Configuration block for specifying a tag key and value. See below.

and BucketLifecycleConfigurationV2RuleFilterAnd

Configuration block used to apply a logical AND to two or more predicates. See below. The Lifecycle Rule will apply to any object matching all the predicates configured inside the and block.

objectSizeGreaterThan String

Minimum object size (in bytes) to which the rule applies.

objectSizeLessThan String

Maximum object size (in bytes) to which the rule applies.

prefix String

Prefix identifying one or more objects to which the rule applies. Defaults to an empty string ("") if not specified.

tag BucketLifecycleConfigurationV2RuleFilterTag

Configuration block for specifying a tag key and value. See below.

and BucketLifecycleConfigurationV2RuleFilterAnd

Configuration block used to apply a logical AND to two or more predicates. See below. The Lifecycle Rule will apply to any object matching all the predicates configured inside the and block.

objectSizeGreaterThan string

Minimum object size (in bytes) to which the rule applies.

objectSizeLessThan string

Maximum object size (in bytes) to which the rule applies.

prefix string

Prefix identifying one or more objects to which the rule applies. Defaults to an empty string ("") if not specified.

tag BucketLifecycleConfigurationV2RuleFilterTag

Configuration block for specifying a tag key and value. See below.

and_ BucketLifecycleConfigurationV2RuleFilterAnd

Configuration block used to apply a logical AND to two or more predicates. See below. The Lifecycle Rule will apply to any object matching all the predicates configured inside the and block.

object_size_greater_than str

Minimum object size (in bytes) to which the rule applies.

object_size_less_than str

Maximum object size (in bytes) to which the rule applies.

prefix str

Prefix identifying one or more objects to which the rule applies. Defaults to an empty string ("") if not specified.

tag BucketLifecycleConfigurationV2RuleFilterTag

Configuration block for specifying a tag key and value. See below.

and Property Map

Configuration block used to apply a logical AND to two or more predicates. See below. The Lifecycle Rule will apply to any object matching all the predicates configured inside the and block.

objectSizeGreaterThan String

Minimum object size (in bytes) to which the rule applies.

objectSizeLessThan String

Maximum object size (in bytes) to which the rule applies.

prefix String

Prefix identifying one or more objects to which the rule applies. Defaults to an empty string ("") if not specified.

tag Property Map

Configuration block for specifying a tag key and value. See below.

BucketLifecycleConfigurationV2RuleFilterAnd

ObjectSizeGreaterThan int

Minimum object size to which the rule applies. Value must be at least 0 if specified.

ObjectSizeLessThan int

Maximum object size to which the rule applies. Value must be at least 1 if specified.

Prefix string

Prefix identifying one or more objects to which the rule applies.

Tags Dictionary<string, string>

Key-value map of resource tags. All of these tags must exist in the object's tag set in order for the rule to apply.

ObjectSizeGreaterThan int

Minimum object size to which the rule applies. Value must be at least 0 if specified.

ObjectSizeLessThan int

Maximum object size to which the rule applies. Value must be at least 1 if specified.

Prefix string

Prefix identifying one or more objects to which the rule applies.

Tags map[string]string

Key-value map of resource tags. All of these tags must exist in the object's tag set in order for the rule to apply.

objectSizeGreaterThan Integer

Minimum object size to which the rule applies. Value must be at least 0 if specified.

objectSizeLessThan Integer

Maximum object size to which the rule applies. Value must be at least 1 if specified.

prefix String

Prefix identifying one or more objects to which the rule applies.

tags Map<String,String>

Key-value map of resource tags. All of these tags must exist in the object's tag set in order for the rule to apply.

objectSizeGreaterThan number

Minimum object size to which the rule applies. Value must be at least 0 if specified.

objectSizeLessThan number

Maximum object size to which the rule applies. Value must be at least 1 if specified.

prefix string

Prefix identifying one or more objects to which the rule applies.

tags {[key: string]: string}

Key-value map of resource tags. All of these tags must exist in the object's tag set in order for the rule to apply.

object_size_greater_than int

Minimum object size to which the rule applies. Value must be at least 0 if specified.

object_size_less_than int

Maximum object size to which the rule applies. Value must be at least 1 if specified.

prefix str

Prefix identifying one or more objects to which the rule applies.

tags Mapping[str, str]

Key-value map of resource tags. All of these tags must exist in the object's tag set in order for the rule to apply.

objectSizeGreaterThan Number

Minimum object size to which the rule applies. Value must be at least 0 if specified.

objectSizeLessThan Number

Maximum object size to which the rule applies. Value must be at least 1 if specified.

prefix String

Prefix identifying one or more objects to which the rule applies.

tags Map<String>

Key-value map of resource tags. All of these tags must exist in the object's tag set in order for the rule to apply.

BucketLifecycleConfigurationV2RuleFilterTag

Key string

Name of the object key.

Value string

Value of the tag.

Key string

Name of the object key.

Value string

Value of the tag.

key String

Name of the object key.

value String

Value of the tag.

key string

Name of the object key.

value string

Value of the tag.

key str

Name of the object key.

value str

Value of the tag.

key String

Name of the object key.

value String

Value of the tag.

BucketLifecycleConfigurationV2RuleNoncurrentVersionExpiration

NewerNoncurrentVersions string

Number of noncurrent versions Amazon S3 will retain. Must be a non-zero positive integer.

NoncurrentDays int

Number of days an object is noncurrent before Amazon S3 can perform the associated action. Must be a positive integer.

NewerNoncurrentVersions string

Number of noncurrent versions Amazon S3 will retain. Must be a non-zero positive integer.

NoncurrentDays int

Number of days an object is noncurrent before Amazon S3 can perform the associated action. Must be a positive integer.

newerNoncurrentVersions String

Number of noncurrent versions Amazon S3 will retain. Must be a non-zero positive integer.

noncurrentDays Integer

Number of days an object is noncurrent before Amazon S3 can perform the associated action. Must be a positive integer.

newerNoncurrentVersions string

Number of noncurrent versions Amazon S3 will retain. Must be a non-zero positive integer.

noncurrentDays number

Number of days an object is noncurrent before Amazon S3 can perform the associated action. Must be a positive integer.

newer_noncurrent_versions str

Number of noncurrent versions Amazon S3 will retain. Must be a non-zero positive integer.

noncurrent_days int

Number of days an object is noncurrent before Amazon S3 can perform the associated action. Must be a positive integer.

newerNoncurrentVersions String

Number of noncurrent versions Amazon S3 will retain. Must be a non-zero positive integer.

noncurrentDays Number

Number of days an object is noncurrent before Amazon S3 can perform the associated action. Must be a positive integer.

BucketLifecycleConfigurationV2RuleNoncurrentVersionTransition

StorageClass string

Class of storage used to store the object. Valid Values: GLACIER, STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, DEEP_ARCHIVE, GLACIER_IR.

NewerNoncurrentVersions string

Number of noncurrent versions Amazon S3 will retain. Must be a non-zero positive integer.

NoncurrentDays int

Number of days an object is noncurrent before Amazon S3 can perform the associated action.

StorageClass string

Class of storage used to store the object. Valid Values: GLACIER, STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, DEEP_ARCHIVE, GLACIER_IR.

NewerNoncurrentVersions string

Number of noncurrent versions Amazon S3 will retain. Must be a non-zero positive integer.

NoncurrentDays int

Number of days an object is noncurrent before Amazon S3 can perform the associated action.

storageClass String

Class of storage used to store the object. Valid Values: GLACIER, STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, DEEP_ARCHIVE, GLACIER_IR.

newerNoncurrentVersions String

Number of noncurrent versions Amazon S3 will retain. Must be a non-zero positive integer.

noncurrentDays Integer

Number of days an object is noncurrent before Amazon S3 can perform the associated action.

storageClass string

Class of storage used to store the object. Valid Values: GLACIER, STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, DEEP_ARCHIVE, GLACIER_IR.

newerNoncurrentVersions string

Number of noncurrent versions Amazon S3 will retain. Must be a non-zero positive integer.

noncurrentDays number

Number of days an object is noncurrent before Amazon S3 can perform the associated action.

storage_class str

Class of storage used to store the object. Valid Values: GLACIER, STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, DEEP_ARCHIVE, GLACIER_IR.

newer_noncurrent_versions str

Number of noncurrent versions Amazon S3 will retain. Must be a non-zero positive integer.

noncurrent_days int

Number of days an object is noncurrent before Amazon S3 can perform the associated action.

storageClass String

Class of storage used to store the object. Valid Values: GLACIER, STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, DEEP_ARCHIVE, GLACIER_IR.

newerNoncurrentVersions String

Number of noncurrent versions Amazon S3 will retain. Must be a non-zero positive integer.

noncurrentDays Number

Number of days an object is noncurrent before Amazon S3 can perform the associated action.

BucketLifecycleConfigurationV2RuleTransition

StorageClass string

Class of storage used to store the object. Valid Values: GLACIER, STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, DEEP_ARCHIVE, GLACIER_IR.

Date string

Date objects are transitioned to the specified storage class. The date value must be in RFC3339 format and set to midnight UTC e.g. 2023-01-13T00:00:00Z.

Days int

Number of days after creation when objects are transitioned to the specified storage class. The value must be a positive integer. If both days and date are not specified, defaults to 0. Valid values depend on storage_class, see Transition objects using Amazon S3 Lifecycle for more details.

StorageClass string

Class of storage used to store the object. Valid Values: GLACIER, STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, DEEP_ARCHIVE, GLACIER_IR.

Date string

Date objects are transitioned to the specified storage class. The date value must be in RFC3339 format and set to midnight UTC e.g. 2023-01-13T00:00:00Z.

Days int

Number of days after creation when objects are transitioned to the specified storage class. The value must be a positive integer. If both days and date are not specified, defaults to 0. Valid values depend on storage_class, see Transition objects using Amazon S3 Lifecycle for more details.

storageClass String

Class of storage used to store the object. Valid Values: GLACIER, STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, DEEP_ARCHIVE, GLACIER_IR.

date String

Date objects are transitioned to the specified storage class. The date value must be in RFC3339 format and set to midnight UTC e.g. 2023-01-13T00:00:00Z.

days Integer

Number of days after creation when objects are transitioned to the specified storage class. The value must be a positive integer. If both days and date are not specified, defaults to 0. Valid values depend on storage_class, see Transition objects using Amazon S3 Lifecycle for more details.

storageClass string

Class of storage used to store the object. Valid Values: GLACIER, STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, DEEP_ARCHIVE, GLACIER_IR.

date string

Date objects are transitioned to the specified storage class. The date value must be in RFC3339 format and set to midnight UTC e.g. 2023-01-13T00:00:00Z.

days number

Number of days after creation when objects are transitioned to the specified storage class. The value must be a positive integer. If both days and date are not specified, defaults to 0. Valid values depend on storage_class, see Transition objects using Amazon S3 Lifecycle for more details.

storage_class str

Class of storage used to store the object. Valid Values: GLACIER, STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, DEEP_ARCHIVE, GLACIER_IR.

date str

Date objects are transitioned to the specified storage class. The date value must be in RFC3339 format and set to midnight UTC e.g. 2023-01-13T00:00:00Z.

days int

Number of days after creation when objects are transitioned to the specified storage class. The value must be a positive integer. If both days and date are not specified, defaults to 0. Valid values depend on storage_class, see Transition objects using Amazon S3 Lifecycle for more details.

storageClass String

Class of storage used to store the object. Valid Values: GLACIER, STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, DEEP_ARCHIVE, GLACIER_IR.

date String

Date objects are transitioned to the specified storage class. The date value must be in RFC3339 format and set to midnight UTC e.g. 2023-01-13T00:00:00Z.

days Number

Number of days after creation when objects are transitioned to the specified storage class. The value must be a positive integer. If both days and date are not specified, defaults to 0. Valid values depend on storage_class, see Transition objects using Amazon S3 Lifecycle for more details.

Import

S3 bucket lifecycle configuration can be imported in one of two ways. If the owner (account ID) of the source bucket is the same account used to configure the AWS Provider, the S3 bucket lifecycle configuration resource should be imported using the bucket e.g.,

 $ pulumi import aws:s3/bucketLifecycleConfigurationV2:BucketLifecycleConfigurationV2 example bucket-name

If the owner (account ID) of the source bucket differs from the account used to configure the AWS Provider, the S3 bucket lifecycle configuration resource should be imported using the bucket and expected_bucket_owner separated by a comma (,) e.g.,

 $ pulumi import aws:s3/bucketLifecycleConfigurationV2:BucketLifecycleConfigurationV2 example bucket-name,123456789012

Package Details

Repository
AWS Classic pulumi/pulumi-aws
License
Apache-2.0
Notes

This Pulumi package is based on the aws Terraform Provider.