AWS Classic

Pulumi Official
Package maintained by Pulumi
v5.10.0 published on Monday, Jul 11, 2022 by Pulumi

BucketLifecycleConfiguration

Provides a resource to manage an S3 Control Bucket Lifecycle Configuration.

NOTE: Each S3 Control Bucket can only have one Lifecycle Configuration. Using multiple of this resource against the same S3 Control Bucket will result in perpetual differences each provider run.

This functionality is for managing S3 on Outposts. To manage S3 Bucket Lifecycle Configurations in an AWS Partition, see the aws.s3.BucketV2 resource.

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var example = new Aws.S3Control.BucketLifecycleConfiguration("example", new Aws.S3Control.BucketLifecycleConfigurationArgs
        {
            Bucket = aws_s3control_bucket.Example.Arn,
            Rules = 
            {
                new Aws.S3Control.Inputs.BucketLifecycleConfigurationRuleArgs
                {
                    Expiration = new Aws.S3Control.Inputs.BucketLifecycleConfigurationRuleExpirationArgs
                    {
                        Days = 365,
                    },
                    Filter = new Aws.S3Control.Inputs.BucketLifecycleConfigurationRuleFilterArgs
                    {
                        Prefix = "logs/",
                    },
                    Id = "logs",
                },
                new Aws.S3Control.Inputs.BucketLifecycleConfigurationRuleArgs
                {
                    Expiration = new Aws.S3Control.Inputs.BucketLifecycleConfigurationRuleExpirationArgs
                    {
                        Days = 7,
                    },
                    Filter = new Aws.S3Control.Inputs.BucketLifecycleConfigurationRuleFilterArgs
                    {
                        Prefix = "temp/",
                    },
                    Id = "temp",
                },
            },
        });
    }

}
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := s3control.NewBucketLifecycleConfiguration(ctx, "example", &s3control.BucketLifecycleConfigurationArgs{
			Bucket: pulumi.Any(aws_s3control_bucket.Example.Arn),
			Rules: s3control.BucketLifecycleConfigurationRuleArray{
				&s3control.BucketLifecycleConfigurationRuleArgs{
					Expiration: &s3control.BucketLifecycleConfigurationRuleExpirationArgs{
						Days: pulumi.Int(365),
					},
					Filter: &s3control.BucketLifecycleConfigurationRuleFilterArgs{
						Prefix: pulumi.String("logs/"),
					},
					Id: pulumi.String("logs"),
				},
				&s3control.BucketLifecycleConfigurationRuleArgs{
					Expiration: &s3control.BucketLifecycleConfigurationRuleExpirationArgs{
						Days: pulumi.Int(7),
					},
					Filter: &s3control.BucketLifecycleConfigurationRuleFilterArgs{
						Prefix: pulumi.String("temp/"),
					},
					Id: pulumi.String("temp"),
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

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

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

    public static void stack(Context ctx) {
        var example = new BucketLifecycleConfiguration("example", BucketLifecycleConfigurationArgs.builder()        
            .bucket(aws_s3control_bucket.example().arn())
            .rules(            
                BucketLifecycleConfigurationRuleArgs.builder()
                    .expiration(BucketLifecycleConfigurationRuleExpirationArgs.builder()
                        .days(365)
                        .build())
                    .filter(BucketLifecycleConfigurationRuleFilterArgs.builder()
                        .prefix("logs/")
                        .build())
                    .id("logs")
                    .build(),
                BucketLifecycleConfigurationRuleArgs.builder()
                    .expiration(BucketLifecycleConfigurationRuleExpirationArgs.builder()
                        .days(7)
                        .build())
                    .filter(BucketLifecycleConfigurationRuleFilterArgs.builder()
                        .prefix("temp/")
                        .build())
                    .id("temp")
                    .build())
            .build());

    }
}
import pulumi
import pulumi_aws as aws

example = aws.s3control.BucketLifecycleConfiguration("example",
    bucket=aws_s3control_bucket["example"]["arn"],
    rules=[
        aws.s3control.BucketLifecycleConfigurationRuleArgs(
            expiration=aws.s3control.BucketLifecycleConfigurationRuleExpirationArgs(
                days=365,
            ),
            filter=aws.s3control.BucketLifecycleConfigurationRuleFilterArgs(
                prefix="logs/",
            ),
            id="logs",
        ),
        aws.s3control.BucketLifecycleConfigurationRuleArgs(
            expiration=aws.s3control.BucketLifecycleConfigurationRuleExpirationArgs(
                days=7,
            ),
            filter=aws.s3control.BucketLifecycleConfigurationRuleFilterArgs(
                prefix="temp/",
            ),
            id="temp",
        ),
    ])
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = new aws.s3control.BucketLifecycleConfiguration("example", {
    bucket: aws_s3control_bucket.example.arn,
    rules: [
        {
            expiration: {
                days: 365,
            },
            filter: {
                prefix: "logs/",
            },
            id: "logs",
        },
        {
            expiration: {
                days: 7,
            },
            filter: {
                prefix: "temp/",
            },
            id: "temp",
        },
    ],
});
resources:
  example:
    type: aws:s3control:BucketLifecycleConfiguration
    properties:
      bucket: ${aws_s3control_bucket.example.arn}
      rules:
        - expiration:
            days: 365
          filter:
            prefix: logs/
          id: logs
        - expiration:
            days: 7
          filter:
            prefix: temp/
          id: temp

Create a BucketLifecycleConfiguration Resource

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

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

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

Bucket string

Amazon Resource Name (ARN) of the bucket.

Rules List<BucketLifecycleConfigurationRuleArgs>

Configuration block(s) containing lifecycle rules for the bucket.

Bucket string

Amazon Resource Name (ARN) of the bucket.

Rules []BucketLifecycleConfigurationRuleArgs

Configuration block(s) containing lifecycle rules for the bucket.

bucket String

Amazon Resource Name (ARN) of the bucket.

rules List<BucketLifecycleConfigurationRuleArgs>

Configuration block(s) containing lifecycle rules for the bucket.

bucket string

Amazon Resource Name (ARN) of the bucket.

rules BucketLifecycleConfigurationRuleArgs[]

Configuration block(s) containing lifecycle rules for the bucket.

bucket str

Amazon Resource Name (ARN) of the bucket.

rules Sequence[BucketLifecycleConfigurationRuleArgs]

Configuration block(s) containing lifecycle rules for the bucket.

bucket String

Amazon Resource Name (ARN) of the bucket.

rules List<Property Map>

Configuration block(s) containing lifecycle rules for the bucket.

Outputs

All input properties are implicitly available as output properties. Additionally, the BucketLifecycleConfiguration 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 an Existing BucketLifecycleConfiguration Resource

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

Amazon Resource Name (ARN) of the bucket.

Rules List<BucketLifecycleConfigurationRuleArgs>

Configuration block(s) containing lifecycle rules for the bucket.

Bucket string

Amazon Resource Name (ARN) of the bucket.

Rules []BucketLifecycleConfigurationRuleArgs

Configuration block(s) containing lifecycle rules for the bucket.

bucket String

Amazon Resource Name (ARN) of the bucket.

rules List<BucketLifecycleConfigurationRuleArgs>

Configuration block(s) containing lifecycle rules for the bucket.

bucket string

Amazon Resource Name (ARN) of the bucket.

rules BucketLifecycleConfigurationRuleArgs[]

Configuration block(s) containing lifecycle rules for the bucket.

bucket str

Amazon Resource Name (ARN) of the bucket.

rules Sequence[BucketLifecycleConfigurationRuleArgs]

Configuration block(s) containing lifecycle rules for the bucket.

bucket String

Amazon Resource Name (ARN) of the bucket.

rules List<Property Map>

Configuration block(s) containing lifecycle rules for the bucket.

Supporting Types

BucketLifecycleConfigurationRule

Id string

Unique identifier for the rule.

AbortIncompleteMultipartUpload BucketLifecycleConfigurationRuleAbortIncompleteMultipartUpload

Configuration block containing settings for abort incomplete multipart upload.

Expiration BucketLifecycleConfigurationRuleExpiration

Configuration block containing settings for expiration of objects.

Filter BucketLifecycleConfigurationRuleFilter

Configuration block containing settings for filtering.

Status string

Status of the rule. Valid values: Enabled and Disabled. Defaults to Enabled.

Id string

Unique identifier for the rule.

AbortIncompleteMultipartUpload BucketLifecycleConfigurationRuleAbortIncompleteMultipartUpload

Configuration block containing settings for abort incomplete multipart upload.

Expiration BucketLifecycleConfigurationRuleExpiration

Configuration block containing settings for expiration of objects.

Filter BucketLifecycleConfigurationRuleFilter

Configuration block containing settings for filtering.

Status string

Status of the rule. Valid values: Enabled and Disabled. Defaults to Enabled.

id String

Unique identifier for the rule.

abortIncompleteMultipartUpload BucketLifecycleConfigurationRuleAbortIncompleteMultipartUpload

Configuration block containing settings for abort incomplete multipart upload.

expiration BucketLifecycleConfigurationRuleExpiration

Configuration block containing settings for expiration of objects.

filter BucketLifecycleConfigurationRuleFilter

Configuration block containing settings for filtering.

status String

Status of the rule. Valid values: Enabled and Disabled. Defaults to Enabled.

id string

Unique identifier for the rule.

abortIncompleteMultipartUpload BucketLifecycleConfigurationRuleAbortIncompleteMultipartUpload

Configuration block containing settings for abort incomplete multipart upload.

expiration BucketLifecycleConfigurationRuleExpiration

Configuration block containing settings for expiration of objects.

filter BucketLifecycleConfigurationRuleFilter

Configuration block containing settings for filtering.

status string

Status of the rule. Valid values: Enabled and Disabled. Defaults to Enabled.

id str

Unique identifier for the rule.

abort_incomplete_multipart_upload BucketLifecycleConfigurationRuleAbortIncompleteMultipartUpload

Configuration block containing settings for abort incomplete multipart upload.

expiration BucketLifecycleConfigurationRuleExpiration

Configuration block containing settings for expiration of objects.

filter BucketLifecycleConfigurationRuleFilter

Configuration block containing settings for filtering.

status str

Status of the rule. Valid values: Enabled and Disabled. Defaults to Enabled.

id String

Unique identifier for the rule.

abortIncompleteMultipartUpload Property Map

Configuration block containing settings for abort incomplete multipart upload.

expiration Property Map

Configuration block containing settings for expiration of objects.

filter Property Map

Configuration block containing settings for filtering.

status String

Status of the rule. Valid values: Enabled and Disabled. Defaults to Enabled.

BucketLifecycleConfigurationRuleAbortIncompleteMultipartUpload

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.

BucketLifecycleConfigurationRuleExpiration

Date string

Date the object is to be deleted. Should be in YYYY-MM-DD date format, e.g., 2020-09-30.

Days int

Number of days before the object is to be deleted.

ExpiredObjectDeleteMarker bool

Enable to remove a delete marker with no noncurrent versions. Cannot be specified with date or days.

Date string

Date the object is to be deleted. Should be in YYYY-MM-DD date format, e.g., 2020-09-30.

Days int

Number of days before the object is to be deleted.

ExpiredObjectDeleteMarker bool

Enable to remove a delete marker with no noncurrent versions. Cannot be specified with date or days.

date String

Date the object is to be deleted. Should be in YYYY-MM-DD date format, e.g., 2020-09-30.

days Integer

Number of days before the object is to be deleted.

expiredObjectDeleteMarker Boolean

Enable to remove a delete marker with no noncurrent versions. Cannot be specified with date or days.

date string

Date the object is to be deleted. Should be in YYYY-MM-DD date format, e.g., 2020-09-30.

days number

Number of days before the object is to be deleted.

expiredObjectDeleteMarker boolean

Enable to remove a delete marker with no noncurrent versions. Cannot be specified with date or days.

date str

Date the object is to be deleted. Should be in YYYY-MM-DD date format, e.g., 2020-09-30.

days int

Number of days before the object is to be deleted.

expired_object_delete_marker bool

Enable to remove a delete marker with no noncurrent versions. Cannot be specified with date or days.

date String

Date the object is to be deleted. Should be in YYYY-MM-DD date format, e.g., 2020-09-30.

days Number

Number of days before the object is to be deleted.

expiredObjectDeleteMarker Boolean

Enable to remove a delete marker with no noncurrent versions. Cannot be specified with date or days.

BucketLifecycleConfigurationRuleFilter

Prefix string

Object prefix for rule filtering.

Tags Dictionary<string, string>

Key-value map of object tags for rule filtering.

Prefix string

Object prefix for rule filtering.

Tags map[string]string

Key-value map of object tags for rule filtering.

prefix String

Object prefix for rule filtering.

tags Map<String,String>

Key-value map of object tags for rule filtering.

prefix string

Object prefix for rule filtering.

tags {[key: string]: string}

Key-value map of object tags for rule filtering.

prefix str

Object prefix for rule filtering.

tags Mapping[str, str]

Key-value map of object tags for rule filtering.

prefix String

Object prefix for rule filtering.

tags Map<String>

Key-value map of object tags for rule filtering.

Import

S3 Control Bucket Lifecycle Configurations can be imported using the Amazon Resource Name (ARN), e.g.,

 $ pulumi import aws:s3control/bucketLifecycleConfiguration:BucketLifecycleConfiguration example arn:aws:s3-outposts:us-east-1:123456789012:outpost/op-12345678/bucket/example

Package Details

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

This Pulumi package is based on the aws Terraform Provider.