published on Thursday, Sep 17, 2026 by Pulumi
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:
- Bucket
Name string - The name of the ENS bucket to which the lifecycle rule applies.
- Allow
Same boolAction Overlap - Whether prefix overlap is allowed. Valid values:
true,false. Default tofalse. - 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 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.Enabledmeans the rule is executed periodically;Disabledmeans the rule is ignored.
- Bucket
Name string - The name of the ENS bucket to which the lifecycle rule applies.
- Allow
Same boolAction Overlap - Whether prefix overlap is allowed. Valid values:
true,false. Default tofalse. - 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 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.Enabledmeans the rule is executed periodically;Disabledmeans the rule is ignored.
- bucket_
name string - The name of the ENS bucket to which the lifecycle rule applies.
- allow_
same_ boolaction_ overlap - Whether prefix overlap is allowed. Valid values:
true,false. Default tofalse. - 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.Enabledmeans the rule is executed periodically;Disabledmeans the rule is ignored.
- bucket
Name String - The name of the ENS bucket to which the lifecycle rule applies.
- allow
Same BooleanAction Overlap - Whether prefix overlap is allowed. Valid values:
true,false. Default tofalse. - expiration
Days 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.Enabledmeans the rule is executed periodically;Disabledmeans the rule is ignored.
- bucket
Name string - The name of the ENS bucket to which the lifecycle rule applies.
- allow
Same booleanAction Overlap - Whether prefix overlap is allowed. Valid values:
true,false. Default tofalse. - 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.Enabledmeans the rule is executed periodically;Disabledmeans the rule is ignored.
- bucket_
name str - The name of the ENS bucket to which the lifecycle rule applies.
- allow_
same_ boolaction_ overlap - Whether prefix overlap is allowed. Valid values:
true,false. Default tofalse. - 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.Enabledmeans the rule is executed periodically;Disabledmeans the rule is ignored.
- bucket
Name String - The name of the ENS bucket to which the lifecycle rule applies.
- allow
Same BooleanAction Overlap - Whether prefix overlap is allowed. Valid values:
true,false. Default tofalse. - 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.Enabledmeans the rule is executed periodically;Disabledmeans the rule is ignored.
Outputs
All input properties are implicitly available as output properties. Additionally, the BucketLifecycle resource produces the following output properties:
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) -> BucketLifecyclefunc 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.
- Allow
Same boolAction Overlap - Whether prefix overlap is allowed. Valid values:
true,false. Default tofalse. - Bucket
Name string - 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 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.Enabledmeans the rule is executed periodically;Disabledmeans the rule is ignored.
- Allow
Same boolAction Overlap - Whether prefix overlap is allowed. Valid values:
true,false. Default tofalse. - Bucket
Name string - 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 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.Enabledmeans the rule is executed periodically;Disabledmeans the rule is ignored.
- allow_
same_ boolaction_ overlap - Whether prefix overlap is allowed. Valid values:
true,false. Default tofalse. - 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.Enabledmeans the rule is executed periodically;Disabledmeans the rule is ignored.
- allow
Same BooleanAction Overlap - Whether prefix overlap is allowed. Valid values:
true,false. Default tofalse. - bucket
Name String - The name of the ENS bucket to which the lifecycle rule applies.
- expiration
Days 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.
- 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.Enabledmeans the rule is executed periodically;Disabledmeans the rule is ignored.
- allow
Same booleanAction Overlap - Whether prefix overlap is allowed. Valid values:
true,false. Default tofalse. - 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.Enabledmeans the rule is executed periodically;Disabledmeans the rule is ignored.
- allow_
same_ boolaction_ overlap - Whether prefix overlap is allowed. Valid values:
true,false. Default tofalse. - 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.Enabledmeans the rule is executed periodically;Disabledmeans the rule is ignored.
- allow
Same BooleanAction Overlap - Whether prefix overlap is allowed. Valid values:
true,false. Default tofalse. - 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.Enabledmeans the rule is executed periodically;Disabledmeans 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
alicloudTerraform Provider.
published on Thursday, Sep 17, 2026 by Pulumi