Try AWS Native preview for resources not in the classic version.
aws.s3control.BucketLifecycleConfiguration
Explore with Pulumi AI
Try AWS Native preview for resources not in the classic version.
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
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.s3control.BucketLifecycleConfiguration("example", {
bucket: exampleAwsS3controlBucket.arn,
rules: [
{
expiration: {
days: 365,
},
filter: {
prefix: "logs/",
},
id: "logs",
},
{
expiration: {
days: 7,
},
filter: {
prefix: "temp/",
},
id: "temp",
},
],
});
import pulumi
import pulumi_aws as aws
example = aws.s3control.BucketLifecycleConfiguration("example",
bucket=example_aws_s3control_bucket["arn"],
rules=[
{
"expiration": {
"days": 365,
},
"filter": {
"prefix": "logs/",
},
"id": "logs",
},
{
"expiration": {
"days": 7,
},
"filter": {
"prefix": "temp/",
},
"id": "temp",
},
])
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v6/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(exampleAwsS3controlBucket.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
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = new Aws.S3Control.BucketLifecycleConfiguration("example", new()
{
Bucket = exampleAwsS3controlBucket.Arn,
Rules = new[]
{
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 generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.s3control.BucketLifecycleConfiguration;
import com.pulumi.aws.s3control.BucketLifecycleConfigurationArgs;
import com.pulumi.aws.s3control.inputs.BucketLifecycleConfigurationRuleArgs;
import com.pulumi.aws.s3control.inputs.BucketLifecycleConfigurationRuleExpirationArgs;
import com.pulumi.aws.s3control.inputs.BucketLifecycleConfigurationRuleFilterArgs;
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 BucketLifecycleConfiguration("example", BucketLifecycleConfigurationArgs.builder()
.bucket(exampleAwsS3controlBucket.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());
}
}
resources:
example:
type: aws:s3control:BucketLifecycleConfiguration
properties:
bucket: ${exampleAwsS3controlBucket.arn}
rules:
- expiration:
days: 365
filter:
prefix: logs/
id: logs
- expiration:
days: 7
filter:
prefix: temp/
id: temp
Create BucketLifecycleConfiguration Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new BucketLifecycleConfiguration(name: string, args: BucketLifecycleConfigurationArgs, opts?: CustomResourceOptions);
@overload
def BucketLifecycleConfiguration(resource_name: str,
args: BucketLifecycleConfigurationArgs,
opts: Optional[ResourceOptions] = None)
@overload
def BucketLifecycleConfiguration(resource_name: str,
opts: Optional[ResourceOptions] = None,
bucket: Optional[str] = None,
rules: Optional[Sequence[BucketLifecycleConfigurationRuleArgs]] = 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.
Parameters
- 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.
Constructor example
The following reference example uses placeholder values for all input properties.
var bucketLifecycleConfigurationResource = new Aws.S3Control.BucketLifecycleConfiguration("bucketLifecycleConfigurationResource", new()
{
Bucket = "string",
Rules = new[]
{
new Aws.S3Control.Inputs.BucketLifecycleConfigurationRuleArgs
{
Id = "string",
AbortIncompleteMultipartUpload = new Aws.S3Control.Inputs.BucketLifecycleConfigurationRuleAbortIncompleteMultipartUploadArgs
{
DaysAfterInitiation = 0,
},
Expiration = new Aws.S3Control.Inputs.BucketLifecycleConfigurationRuleExpirationArgs
{
Date = "string",
Days = 0,
ExpiredObjectDeleteMarker = false,
},
Filter = new Aws.S3Control.Inputs.BucketLifecycleConfigurationRuleFilterArgs
{
Prefix = "string",
Tags =
{
{ "string", "string" },
},
},
Status = "string",
},
},
});
example, err := s3control.NewBucketLifecycleConfiguration(ctx, "bucketLifecycleConfigurationResource", &s3control.BucketLifecycleConfigurationArgs{
Bucket: pulumi.String("string"),
Rules: s3control.BucketLifecycleConfigurationRuleArray{
&s3control.BucketLifecycleConfigurationRuleArgs{
Id: pulumi.String("string"),
AbortIncompleteMultipartUpload: &s3control.BucketLifecycleConfigurationRuleAbortIncompleteMultipartUploadArgs{
DaysAfterInitiation: pulumi.Int(0),
},
Expiration: &s3control.BucketLifecycleConfigurationRuleExpirationArgs{
Date: pulumi.String("string"),
Days: pulumi.Int(0),
ExpiredObjectDeleteMarker: pulumi.Bool(false),
},
Filter: &s3control.BucketLifecycleConfigurationRuleFilterArgs{
Prefix: pulumi.String("string"),
Tags: pulumi.StringMap{
"string": pulumi.String("string"),
},
},
Status: pulumi.String("string"),
},
},
})
var bucketLifecycleConfigurationResource = new BucketLifecycleConfiguration("bucketLifecycleConfigurationResource", BucketLifecycleConfigurationArgs.builder()
.bucket("string")
.rules(BucketLifecycleConfigurationRuleArgs.builder()
.id("string")
.abortIncompleteMultipartUpload(BucketLifecycleConfigurationRuleAbortIncompleteMultipartUploadArgs.builder()
.daysAfterInitiation(0)
.build())
.expiration(BucketLifecycleConfigurationRuleExpirationArgs.builder()
.date("string")
.days(0)
.expiredObjectDeleteMarker(false)
.build())
.filter(BucketLifecycleConfigurationRuleFilterArgs.builder()
.prefix("string")
.tags(Map.of("string", "string"))
.build())
.status("string")
.build())
.build());
bucket_lifecycle_configuration_resource = aws.s3control.BucketLifecycleConfiguration("bucketLifecycleConfigurationResource",
bucket="string",
rules=[{
"id": "string",
"abortIncompleteMultipartUpload": {
"daysAfterInitiation": 0,
},
"expiration": {
"date": "string",
"days": 0,
"expiredObjectDeleteMarker": False,
},
"filter": {
"prefix": "string",
"tags": {
"string": "string",
},
},
"status": "string",
}])
const bucketLifecycleConfigurationResource = new aws.s3control.BucketLifecycleConfiguration("bucketLifecycleConfigurationResource", {
bucket: "string",
rules: [{
id: "string",
abortIncompleteMultipartUpload: {
daysAfterInitiation: 0,
},
expiration: {
date: "string",
days: 0,
expiredObjectDeleteMarker: false,
},
filter: {
prefix: "string",
tags: {
string: "string",
},
},
status: "string",
}],
});
type: aws:s3control:BucketLifecycleConfiguration
properties:
bucket: string
rules:
- abortIncompleteMultipartUpload:
daysAfterInitiation: 0
expiration:
date: string
days: 0
expiredObjectDeleteMarker: false
filter:
prefix: string
tags:
string: string
id: string
status: string
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<Bucket
Lifecycle Configuration Rule> - Configuration block(s) containing lifecycle rules for the bucket.
- Bucket string
- Amazon Resource Name (ARN) of the bucket.
- Rules
[]Bucket
Lifecycle Configuration Rule Args - Configuration block(s) containing lifecycle rules for the bucket.
- bucket String
- Amazon Resource Name (ARN) of the bucket.
- rules
List<Bucket
Lifecycle Configuration Rule> - Configuration block(s) containing lifecycle rules for the bucket.
- bucket string
- Amazon Resource Name (ARN) of the bucket.
- rules
Bucket
Lifecycle Configuration Rule[] - Configuration block(s) containing lifecycle rules for the bucket.
- bucket str
- Amazon Resource Name (ARN) of the bucket.
- rules
Sequence[Bucket
Lifecycle Configuration Rule Args] - 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 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.
- Bucket string
- Amazon Resource Name (ARN) of the bucket.
- Rules
List<Bucket
Lifecycle Configuration Rule> - Configuration block(s) containing lifecycle rules for the bucket.
- Bucket string
- Amazon Resource Name (ARN) of the bucket.
- Rules
[]Bucket
Lifecycle Configuration Rule Args - Configuration block(s) containing lifecycle rules for the bucket.
- bucket String
- Amazon Resource Name (ARN) of the bucket.
- rules
List<Bucket
Lifecycle Configuration Rule> - Configuration block(s) containing lifecycle rules for the bucket.
- bucket string
- Amazon Resource Name (ARN) of the bucket.
- rules
Bucket
Lifecycle Configuration Rule[] - Configuration block(s) containing lifecycle rules for the bucket.
- bucket str
- Amazon Resource Name (ARN) of the bucket.
- rules
Sequence[Bucket
Lifecycle Configuration Rule Args] - 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, BucketLifecycleConfigurationRuleArgs
- Id string
- Unique identifier for the rule.
- Abort
Incomplete BucketMultipart Upload Lifecycle Configuration Rule Abort Incomplete Multipart Upload - Configuration block containing settings for abort incomplete multipart upload.
- Expiration
Bucket
Lifecycle Configuration Rule Expiration - Configuration block containing settings for expiration of objects.
- Filter
Bucket
Lifecycle Configuration Rule Filter - Configuration block containing settings for filtering.
- Status string
- Status of the rule. Valid values:
Enabled
andDisabled
. Defaults toEnabled
.
- Id string
- Unique identifier for the rule.
- Abort
Incomplete BucketMultipart Upload Lifecycle Configuration Rule Abort Incomplete Multipart Upload - Configuration block containing settings for abort incomplete multipart upload.
- Expiration
Bucket
Lifecycle Configuration Rule Expiration - Configuration block containing settings for expiration of objects.
- Filter
Bucket
Lifecycle Configuration Rule Filter - Configuration block containing settings for filtering.
- Status string
- Status of the rule. Valid values:
Enabled
andDisabled
. Defaults toEnabled
.
- id String
- Unique identifier for the rule.
- abort
Incomplete BucketMultipart Upload Lifecycle Configuration Rule Abort Incomplete Multipart Upload - Configuration block containing settings for abort incomplete multipart upload.
- expiration
Bucket
Lifecycle Configuration Rule Expiration - Configuration block containing settings for expiration of objects.
- filter
Bucket
Lifecycle Configuration Rule Filter - Configuration block containing settings for filtering.
- status String
- Status of the rule. Valid values:
Enabled
andDisabled
. Defaults toEnabled
.
- id string
- Unique identifier for the rule.
- abort
Incomplete BucketMultipart Upload Lifecycle Configuration Rule Abort Incomplete Multipart Upload - Configuration block containing settings for abort incomplete multipart upload.
- expiration
Bucket
Lifecycle Configuration Rule Expiration - Configuration block containing settings for expiration of objects.
- filter
Bucket
Lifecycle Configuration Rule Filter - Configuration block containing settings for filtering.
- status string
- Status of the rule. Valid values:
Enabled
andDisabled
. Defaults toEnabled
.
- id str
- Unique identifier for the rule.
- abort_
incomplete_ Bucketmultipart_ upload Lifecycle Configuration Rule Abort Incomplete Multipart Upload - Configuration block containing settings for abort incomplete multipart upload.
- expiration
Bucket
Lifecycle Configuration Rule Expiration - Configuration block containing settings for expiration of objects.
- filter
Bucket
Lifecycle Configuration Rule Filter - Configuration block containing settings for filtering.
- status str
- Status of the rule. Valid values:
Enabled
andDisabled
. Defaults toEnabled
.
- id String
- Unique identifier for the rule.
- abort
Incomplete Property MapMultipart Upload - 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
andDisabled
. Defaults toEnabled
.
BucketLifecycleConfigurationRuleAbortIncompleteMultipartUpload, BucketLifecycleConfigurationRuleAbortIncompleteMultipartUploadArgs
- Days
After intInitiation - Number of days after which Amazon S3 aborts an incomplete multipart upload.
- Days
After intInitiation - Number of days after which Amazon S3 aborts an incomplete multipart upload.
- days
After IntegerInitiation - Number of days after which Amazon S3 aborts an incomplete multipart upload.
- days
After numberInitiation - Number of days after which Amazon S3 aborts an incomplete multipart upload.
- days_
after_ intinitiation - Number of days after which Amazon S3 aborts an incomplete multipart upload.
- days
After NumberInitiation - Number of days after which Amazon S3 aborts an incomplete multipart upload.
BucketLifecycleConfigurationRuleExpiration, BucketLifecycleConfigurationRuleExpirationArgs
- 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.
- Expired
Object boolDelete Marker - Enable to remove a delete marker with no noncurrent versions. Cannot be specified with
date
ordays
.
- 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.
- Expired
Object boolDelete Marker - Enable to remove a delete marker with no noncurrent versions. Cannot be specified with
date
ordays
.
- 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.
- expired
Object BooleanDelete Marker - Enable to remove a delete marker with no noncurrent versions. Cannot be specified with
date
ordays
.
- 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.
- expired
Object booleanDelete Marker - Enable to remove a delete marker with no noncurrent versions. Cannot be specified with
date
ordays
.
- 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_ booldelete_ marker - Enable to remove a delete marker with no noncurrent versions. Cannot be specified with
date
ordays
.
- 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.
- expired
Object BooleanDelete Marker - Enable to remove a delete marker with no noncurrent versions. Cannot be specified with
date
ordays
.
BucketLifecycleConfigurationRuleFilter, BucketLifecycleConfigurationRuleFilterArgs
- Prefix string
- Object prefix for rule filtering.
- Dictionary<string, string>
- Key-value map of object tags for rule filtering.
- Prefix string
- Object prefix for rule filtering.
- map[string]string
- Key-value map of object tags for rule filtering.
- prefix String
- Object prefix for rule filtering.
- Map<String,String>
- Key-value map of object tags for rule filtering.
- prefix string
- Object prefix for rule filtering.
- {[key: string]: string}
- Key-value map of object tags for rule filtering.
- prefix str
- Object prefix for rule filtering.
- Mapping[str, str]
- Key-value map of object tags for rule filtering.
- prefix String
- Object prefix for rule filtering.
- Map<String>
- Key-value map of object tags for rule filtering.
Import
Using pulumi import
, import S3 Control Bucket Lifecycle Configurations using the Amazon Resource Name (ARN). For example:
$ pulumi import aws:s3control/bucketLifecycleConfiguration:BucketLifecycleConfiguration example arn:aws:s3-outposts:us-east-1:123456789012:outpost/op-12345678/bucket/example
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
aws
Terraform Provider.
Try AWS Native preview for resources not in the classic version.