1. Registry
  2. Packages
  3. Alibaba Cloud Provider
  4. API Docs
  5. ens
  6. BucketLifecycle
Viewing docs for Alibaba Cloud v3.108.0
published on Thursday, Sep 17, 2026 by Pulumi
alicloud logo alicloud logo
Viewing docs for Alibaba Cloud v3.108.0
published on Thursday, Sep 17, 2026 by Pulumi

    Provides a ENS Bucket Lifecycle resource.

    For information about ENS Bucket Lifecycle and how to use it, see What is BucketLifecycle.

    NOTE: Available since v1.291.0.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const config = new pulumi.Config();
    const name = config.get("name") || "terraform-example";
    const _default = new alicloud.ens.BucketLifecycle("default", {
        bucketName: "your-bucket-name",
        status: "Enabled",
        prefix: "logs/",
        expirationDays: 7,
    });
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    config = pulumi.Config()
    name = config.get("name")
    if name is None:
        name = "terraform-example"
    default = alicloud.ens.BucketLifecycle("default",
        bucket_name="your-bucket-name",
        status="Enabled",
        prefix="logs/",
        expiration_days=7)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ens"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		cfg := config.New(ctx, "")
    		name := "terraform-example"
    		if param := cfg.Get("name"); param != "" {
    			name = param
    		}
    		_, err := ens.NewBucketLifecycle(ctx, "default", &ens.BucketLifecycleArgs{
    			BucketName:     pulumi.String("your-bucket-name"),
    			Status:         pulumi.String("Enabled"),
    			Prefix:         pulumi.String("logs/"),
    			ExpirationDays: pulumi.Int(7),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var config = new Config();
        var name = config.Get("name") ?? "terraform-example";
        var @default = new AliCloud.Ens.BucketLifecycle("default", new()
        {
            BucketName = "your-bucket-name",
            Status = "Enabled",
            Prefix = "logs/",
            ExpirationDays = 7,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.ens.BucketLifecycle;
    import com.pulumi.alicloud.ens.BucketLifecycleArgs;
    import java.util.ArrayList;
    import java.util.Arrays;
    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) {
            final var config = ctx.config();
            final var name = config.get("name").orElse("terraform-example");
            var default_ = new BucketLifecycle("default", BucketLifecycleArgs.builder()
                .bucketName("your-bucket-name")
                .status("Enabled")
                .prefix("logs/")
                .expirationDays(7)
                .build());
    
        }
    }
    
    configuration:
      name:
        type: string
        default: terraform-example
    resources:
      default:
        type: alicloud:ens:BucketLifecycle
        properties:
          bucketName: your-bucket-name
          status: Enabled
          prefix: logs/
          expirationDays: 7
    
    pulumi {
      required_providers {
        alicloud = {
          source = "pulumi/alicloud"
        }
      }
    }
    
    resource "alicloud_ens_bucketlifecycle" "default" {
      bucket_name     = "your-bucket-name"
      status          = "Enabled"
      prefix          = "logs/"
      expiration_days = 7
    }
    variable "name" {
      type    = string
      default = "terraform-example"
    }
    

    📚 Need more examples? VIEW MORE EXAMPLES

    Create BucketLifecycle Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new BucketLifecycle(name: string, args: BucketLifecycleArgs, opts?: CustomResourceOptions);
    @overload
    def BucketLifecycle(resource_name: str,
                        args: BucketLifecycleArgs,
                        opts: Optional[ResourceOptions] = None)
    
    @overload
    def BucketLifecycle(resource_name: str,
                        opts: Optional[ResourceOptions] = None,
                        bucket_name: Optional[str] = None,
                        allow_same_action_overlap: Optional[bool] = None,
                        expiration_days: Optional[int] = None,
                        prefix: Optional[str] = None,
                        status: Optional[str] = None)
    func NewBucketLifecycle(ctx *Context, name string, args BucketLifecycleArgs, opts ...ResourceOption) (*BucketLifecycle, error)
    public BucketLifecycle(string name, BucketLifecycleArgs args, CustomResourceOptions? opts = null)
    public BucketLifecycle(String name, BucketLifecycleArgs args)
    public BucketLifecycle(String name, BucketLifecycleArgs args, CustomResourceOptions options)
    
    type: alicloud:ens:BucketLifecycle
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    resource "alicloud_ens_bucket_lifecycle" "name" {
        # resource properties
    }

    Parameters

    name string
    The unique name of the resource.
    args BucketLifecycleArgs
    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 BucketLifecycleArgs
    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 BucketLifecycleArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args BucketLifecycleArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args BucketLifecycleArgs
    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 bucketLifecycleResource = new AliCloud.Ens.BucketLifecycle("bucketLifecycleResource", new()
    {
        BucketName = "string",
        AllowSameActionOverlap = false,
        ExpirationDays = 0,
        Prefix = "string",
        Status = "string",
    });
    
    example, err := ens.NewBucketLifecycle(ctx, "bucketLifecycleResource", &ens.BucketLifecycleArgs{
    	BucketName:             pulumi.String("string"),
    	AllowSameActionOverlap: pulumi.Bool(false),
    	ExpirationDays:         pulumi.Int(0),
    	Prefix:                 pulumi.String("string"),
    	Status:                 pulumi.String("string"),
    })
    
    resource "alicloud_ens_bucket_lifecycle" "bucketLifecycleResource" {
      lifecycle {
        create_before_destroy = true
      }
      bucket_name               = "string"
      allow_same_action_overlap = false
      expiration_days           = 0
      prefix                    = "string"
      status                    = "string"
    }
    
    var bucketLifecycleResource = new BucketLifecycle("bucketLifecycleResource", BucketLifecycleArgs.builder()
        .bucketName("string")
        .allowSameActionOverlap(false)
        .expirationDays(0)
        .prefix("string")
        .status("string")
        .build());
    
    bucket_lifecycle_resource = alicloud.ens.BucketLifecycle("bucketLifecycleResource",
        bucket_name="string",
        allow_same_action_overlap=False,
        expiration_days=0,
        prefix="string",
        status="string")
    
    const bucketLifecycleResource = new alicloud.ens.BucketLifecycle("bucketLifecycleResource", {
        bucketName: "string",
        allowSameActionOverlap: false,
        expirationDays: 0,
        prefix: "string",
        status: "string",
    });
    
    type: alicloud:ens:BucketLifecycle
    properties:
        allowSameActionOverlap: false
        bucketName: string
        expirationDays: 0
        prefix: string
        status: string
    

    BucketLifecycle Resource Properties

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

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The BucketLifecycle resource accepts the following input properties:

    BucketName string
    The name of the ENS bucket to which the lifecycle rule applies.
    AllowSameActionOverlap bool
    Whether prefix overlap is allowed. Valid values: true, false. Default to false.
    ExpirationDays int
    The number of days after the last update of the object before the lifecycle rule takes effect. The value must be greater than 0 and is a positive integer.
    Prefix string
    The prefix that the rule applies to. The same prefix cannot be set for multiple rules. If prefix is empty, the rule applies to all objects in the bucket.
    Status string
    The rule status. Valid values: Enabled, Disabled. Enabled means the rule is executed periodically; Disabled means the rule is ignored.
    BucketName string
    The name of the ENS bucket to which the lifecycle rule applies.
    AllowSameActionOverlap bool
    Whether prefix overlap is allowed. Valid values: true, false. Default to false.
    ExpirationDays int
    The number of days after the last update of the object before the lifecycle rule takes effect. The value must be greater than 0 and is a positive integer.
    Prefix string
    The prefix that the rule applies to. The same prefix cannot be set for multiple rules. If prefix is empty, the rule applies to all objects in the bucket.
    Status string
    The rule status. Valid values: Enabled, Disabled. Enabled means the rule is executed periodically; Disabled means the rule is ignored.
    bucket_name string
    The name of the ENS bucket to which the lifecycle rule applies.
    allow_same_action_overlap bool
    Whether prefix overlap is allowed. Valid values: true, false. Default to false.
    expiration_days number
    The number of days after the last update of the object before the lifecycle rule takes effect. The value must be greater than 0 and is a positive integer.
    prefix string
    The prefix that the rule applies to. The same prefix cannot be set for multiple rules. If prefix is empty, the rule applies to all objects in the bucket.
    status string
    The rule status. Valid values: Enabled, Disabled. Enabled means the rule is executed periodically; Disabled means the rule is ignored.
    bucketName String
    The name of the ENS bucket to which the lifecycle rule applies.
    allowSameActionOverlap Boolean
    Whether prefix overlap is allowed. Valid values: true, false. Default to false.
    expirationDays Integer
    The number of days after the last update of the object before the lifecycle rule takes effect. The value must be greater than 0 and is a positive integer.
    prefix String
    The prefix that the rule applies to. The same prefix cannot be set for multiple rules. If prefix is empty, the rule applies to all objects in the bucket.
    status String
    The rule status. Valid values: Enabled, Disabled. Enabled means the rule is executed periodically; Disabled means the rule is ignored.
    bucketName string
    The name of the ENS bucket to which the lifecycle rule applies.
    allowSameActionOverlap boolean
    Whether prefix overlap is allowed. Valid values: true, false. Default to false.
    expirationDays number
    The number of days after the last update of the object before the lifecycle rule takes effect. The value must be greater than 0 and is a positive integer.
    prefix string
    The prefix that the rule applies to. The same prefix cannot be set for multiple rules. If prefix is empty, the rule applies to all objects in the bucket.
    status string
    The rule status. Valid values: Enabled, Disabled. Enabled means the rule is executed periodically; Disabled means the rule is ignored.
    bucket_name str
    The name of the ENS bucket to which the lifecycle rule applies.
    allow_same_action_overlap bool
    Whether prefix overlap is allowed. Valid values: true, false. Default to false.
    expiration_days int
    The number of days after the last update of the object before the lifecycle rule takes effect. The value must be greater than 0 and is a positive integer.
    prefix str
    The prefix that the rule applies to. The same prefix cannot be set for multiple rules. If prefix is empty, the rule applies to all objects in the bucket.
    status str
    The rule status. Valid values: Enabled, Disabled. Enabled means the rule is executed periodically; Disabled means the rule is ignored.
    bucketName String
    The name of the ENS bucket to which the lifecycle rule applies.
    allowSameActionOverlap Boolean
    Whether prefix overlap is allowed. Valid values: true, false. Default to false.
    expirationDays Number
    The number of days after the last update of the object before the lifecycle rule takes effect. The value must be greater than 0 and is a positive integer.
    prefix String
    The prefix that the rule applies to. The same prefix cannot be set for multiple rules. If prefix is empty, the rule applies to all objects in the bucket.
    status String
    The rule status. Valid values: Enabled, Disabled. Enabled means the rule is executed periodically; Disabled means the rule is ignored.

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    RuleId string
    The unique ID of the rule, automatically generated by the system when a new rule is created. It cannot be specified by the user.
    Id string
    The provider-assigned unique ID for this managed resource.
    RuleId string
    The unique ID of the rule, automatically generated by the system when a new rule is created. It cannot be specified by the user.
    id string
    The provider-assigned unique ID for this managed resource.
    rule_id string
    The unique ID of the rule, automatically generated by the system when a new rule is created. It cannot be specified by the user.
    id String
    The provider-assigned unique ID for this managed resource.
    ruleId String
    The unique ID of the rule, automatically generated by the system when a new rule is created. It cannot be specified by the user.
    id string
    The provider-assigned unique ID for this managed resource.
    ruleId string
    The unique ID of the rule, automatically generated by the system when a new rule is created. It cannot be specified by the user.
    id str
    The provider-assigned unique ID for this managed resource.
    rule_id str
    The unique ID of the rule, automatically generated by the system when a new rule is created. It cannot be specified by the user.
    id String
    The provider-assigned unique ID for this managed resource.
    ruleId String
    The unique ID of the rule, automatically generated by the system when a new rule is created. It cannot be specified by the user.

    Look up Existing BucketLifecycle Resource

    Get an existing BucketLifecycle 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?: BucketLifecycleState, opts?: CustomResourceOptions): BucketLifecycle
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            allow_same_action_overlap: Optional[bool] = None,
            bucket_name: Optional[str] = None,
            expiration_days: Optional[int] = None,
            prefix: Optional[str] = None,
            rule_id: Optional[str] = None,
            status: Optional[str] = None) -> BucketLifecycle
    func GetBucketLifecycle(ctx *Context, name string, id IDInput, state *BucketLifecycleState, opts ...ResourceOption) (*BucketLifecycle, error)
    public static BucketLifecycle Get(string name, Input<string> id, BucketLifecycleState? state, CustomResourceOptions? opts = null)
    public static BucketLifecycle get(String name, Output<String> id, BucketLifecycleState state, CustomResourceOptions options)
    resources:  _:    type: alicloud:ens:BucketLifecycle    get:      id: ${id}
    import {
      to = alicloud_ens_bucket_lifecycle.example
      id = "${id}"
    }
    
    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:
    AllowSameActionOverlap bool
    Whether prefix overlap is allowed. Valid values: true, false. Default to false.
    BucketName string
    The name of the ENS bucket to which the lifecycle rule applies.
    ExpirationDays int
    The number of days after the last update of the object before the lifecycle rule takes effect. The value must be greater than 0 and is a positive integer.
    Prefix string
    The prefix that the rule applies to. The same prefix cannot be set for multiple rules. If prefix is empty, the rule applies to all objects in the bucket.
    RuleId string
    The unique ID of the rule, automatically generated by the system when a new rule is created. It cannot be specified by the user.
    Status string
    The rule status. Valid values: Enabled, Disabled. Enabled means the rule is executed periodically; Disabled means the rule is ignored.
    AllowSameActionOverlap bool
    Whether prefix overlap is allowed. Valid values: true, false. Default to false.
    BucketName string
    The name of the ENS bucket to which the lifecycle rule applies.
    ExpirationDays int
    The number of days after the last update of the object before the lifecycle rule takes effect. The value must be greater than 0 and is a positive integer.
    Prefix string
    The prefix that the rule applies to. The same prefix cannot be set for multiple rules. If prefix is empty, the rule applies to all objects in the bucket.
    RuleId string
    The unique ID of the rule, automatically generated by the system when a new rule is created. It cannot be specified by the user.
    Status string
    The rule status. Valid values: Enabled, Disabled. Enabled means the rule is executed periodically; Disabled means the rule is ignored.
    allow_same_action_overlap bool
    Whether prefix overlap is allowed. Valid values: true, false. Default to false.
    bucket_name string
    The name of the ENS bucket to which the lifecycle rule applies.
    expiration_days number
    The number of days after the last update of the object before the lifecycle rule takes effect. The value must be greater than 0 and is a positive integer.
    prefix string
    The prefix that the rule applies to. The same prefix cannot be set for multiple rules. If prefix is empty, the rule applies to all objects in the bucket.
    rule_id string
    The unique ID of the rule, automatically generated by the system when a new rule is created. It cannot be specified by the user.
    status string
    The rule status. Valid values: Enabled, Disabled. Enabled means the rule is executed periodically; Disabled means the rule is ignored.
    allowSameActionOverlap Boolean
    Whether prefix overlap is allowed. Valid values: true, false. Default to false.
    bucketName String
    The name of the ENS bucket to which the lifecycle rule applies.
    expirationDays Integer
    The number of days after the last update of the object before the lifecycle rule takes effect. The value must be greater than 0 and is a positive integer.
    prefix String
    The prefix that the rule applies to. The same prefix cannot be set for multiple rules. If prefix is empty, the rule applies to all objects in the bucket.
    ruleId String
    The unique ID of the rule, automatically generated by the system when a new rule is created. It cannot be specified by the user.
    status String
    The rule status. Valid values: Enabled, Disabled. Enabled means the rule is executed periodically; Disabled means the rule is ignored.
    allowSameActionOverlap boolean
    Whether prefix overlap is allowed. Valid values: true, false. Default to false.
    bucketName string
    The name of the ENS bucket to which the lifecycle rule applies.
    expirationDays number
    The number of days after the last update of the object before the lifecycle rule takes effect. The value must be greater than 0 and is a positive integer.
    prefix string
    The prefix that the rule applies to. The same prefix cannot be set for multiple rules. If prefix is empty, the rule applies to all objects in the bucket.
    ruleId string
    The unique ID of the rule, automatically generated by the system when a new rule is created. It cannot be specified by the user.
    status string
    The rule status. Valid values: Enabled, Disabled. Enabled means the rule is executed periodically; Disabled means the rule is ignored.
    allow_same_action_overlap bool
    Whether prefix overlap is allowed. Valid values: true, false. Default to false.
    bucket_name str
    The name of the ENS bucket to which the lifecycle rule applies.
    expiration_days int
    The number of days after the last update of the object before the lifecycle rule takes effect. The value must be greater than 0 and is a positive integer.
    prefix str
    The prefix that the rule applies to. The same prefix cannot be set for multiple rules. If prefix is empty, the rule applies to all objects in the bucket.
    rule_id str
    The unique ID of the rule, automatically generated by the system when a new rule is created. It cannot be specified by the user.
    status str
    The rule status. Valid values: Enabled, Disabled. Enabled means the rule is executed periodically; Disabled means the rule is ignored.
    allowSameActionOverlap Boolean
    Whether prefix overlap is allowed. Valid values: true, false. Default to false.
    bucketName String
    The name of the ENS bucket to which the lifecycle rule applies.
    expirationDays Number
    The number of days after the last update of the object before the lifecycle rule takes effect. The value must be greater than 0 and is a positive integer.
    prefix String
    The prefix that the rule applies to. The same prefix cannot be set for multiple rules. If prefix is empty, the rule applies to all objects in the bucket.
    ruleId String
    The unique ID of the rule, automatically generated by the system when a new rule is created. It cannot be specified by the user.
    status String
    The rule status. Valid values: Enabled, Disabled. Enabled means the rule is executed periodically; Disabled means the rule is ignored.

    Import

    ENS Bucket Lifecycle can be imported using the id, e.g.

    $ pulumi import alicloud:ens/bucketLifecycle:BucketLifecycle example <bucket_name>:<rule_id>
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    Alibaba Cloud pulumi/pulumi-alicloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the alicloud Terraform Provider.
    alicloud logo alicloud logo
    Viewing docs for Alibaba Cloud v3.108.0
    published on Thursday, Sep 17, 2026 by Pulumi

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial