# RuleProperty

Struct · External

Specifies lifecycle rules for an Amazon S3 bucket.

For more information, see [Put Bucket Lifecycle Configuration](https://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTlifecycle.html) in the *Amazon S3 API Reference* . For examples, see [Put Bucket Lifecycle Configuration Examples](https://docs.aws.amazon.com//AmazonS3/latest/API/API_PutBucketLifecycleConfiguration.html#API_PutBucketLifecycleConfiguration_Examples) .

You must specify at least one of the following properties: `AbortIncompleteMultipartUpload` , or `ExpirationInDays` .

- Source: Generated at build time
- Type last changed: v2.172.0 · 7 Dec 2024

## Example

TypeScript:

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_s3express as s3express } from 'aws-cdk-lib';
const ruleProperty: s3express.CfnDirectoryBucket.RuleProperty = {
  status: 'status',

  // the properties below are optional
  abortIncompleteMultipartUpload: {
    daysAfterInitiation: 123,
  },
  expirationInDays: 123,
  id: 'id',
  objectSizeGreaterThan: 'objectSizeGreaterThan',
  objectSizeLessThan: 'objectSizeLessThan',
  prefix: 'prefix',
};
```

Python:

```python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_s3express as s3express

rule_property = s3express.CfnDirectoryBucket.RuleProperty(
    status="status",

    # the properties below are optional
    abort_incomplete_multipart_upload=s3express.CfnDirectoryBucket.AbortIncompleteMultipartUploadProperty(
        days_after_initiation=123
    ),
    expiration_in_days=123,
    id="id",
    object_size_greater_than="objectSizeGreaterThan",
    object_size_less_than="objectSizeLessThan",
    prefix="prefix"
)
```

Java:

```java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.s3express.*;

RuleProperty ruleProperty = RuleProperty.builder()
        .status("status")

        // the properties below are optional
        .abortIncompleteMultipartUpload(AbortIncompleteMultipartUploadProperty.builder()
                .daysAfterInitiation(123)
                .build())
        .expirationInDays(123)
        .id("id")
        .objectSizeGreaterThan("objectSizeGreaterThan")
        .objectSizeLessThan("objectSizeLessThan")
        .prefix("prefix")
        .build();
```

C#:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.S3Express;

var ruleProperty = new RuleProperty {
    Status = "status",

    // the properties below are optional
    AbortIncompleteMultipartUpload = new AbortIncompleteMultipartUploadProperty {
        DaysAfterInitiation = 123
    },
    ExpirationInDays = 123,
    Id = "id",
    ObjectSizeGreaterThan = "objectSizeGreaterThan",
    ObjectSizeLessThan = "objectSizeLessThan",
    Prefix = "prefix"
};
```

Go:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

ruleProperty := &RuleProperty{
	Status: jsii.String("status"),

	// the properties below are optional
	AbortIncompleteMultipartUpload: &AbortIncompleteMultipartUploadProperty{
		DaysAfterInitiation: jsii.Number(123),
	},
	ExpirationInDays: jsii.Number(123),
	Id: jsii.String("id"),
	ObjectSizeGreaterThan: jsii.String("objectSizeGreaterThan"),
	ObjectSizeLessThan: jsii.String("objectSizeLessThan"),
	Prefix: jsii.String("prefix"),
}
```

## Properties

- `abortIncompleteMultipartUpload`: [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnDirectoryBucket.AbortIncompleteMultipartUploadProperty](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3express.CfnDirectoryBucket.AbortIncompleteMultipartUploadProperty.html) — Specifies the days since the initiation of an incomplete multipart upload that Amazon S3 will wait before permanently removing all parts of the upload.

- `expirationInDays`: number — Indicates the number of days after creation when objects are deleted from Amazon S3 and Amazon S3 Glacier.

  If you specify an expiration and transition time, you must use the same time unit for both properties (either in days or by date). The expiration time must also be later than the transition time.

- `id`: string — Unique identifier for the rule.

  The value can't be longer than 255 characters.

- `objectSizeGreaterThan`: string — Specifies the minimum object size in bytes for this rule to apply to.

  Objects must be larger than this value in bytes. For more information about size based rules, see [Lifecycle configuration using size-based rules](https://docs.aws.amazon.com/AmazonS3/latest/userguide/lifecycle-configuration-examples.html#lc-size-rules) in the *Amazon S3 User Guide* .

- `objectSizeLessThan`: string — Specifies the maximum object size in bytes for this rule to apply to.

  Objects must be smaller than this value in bytes. For more information about sized based rules, see [Lifecycle configuration using size-based rules](https://docs.aws.amazon.com/AmazonS3/latest/userguide/lifecycle-configuration-examples.html#lc-size-rules) in the *Amazon S3 User Guide* .

- `prefix`: string — Object key prefix that identifies one or more objects to which this rule applies.

  > Replacement must be made for object keys containing special characters (such as carriage returns) when using XML requests. For more information, see [XML related object key constraints](https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-keys.html#object-key-xml-related-constraints) .

- `status`: string (required) — If `Enabled` , the rule is currently being applied.

  If `Disabled` , the rule is not currently being applied.
