AWS::S3Express::DirectoryBucket Rule
Specifies lifecycle rules for an Amazon S3 bucket. For more information, see Put Bucket Lifecycle Configuration in the Amazon S3 API Reference. For examples, see Put Bucket Lifecycle Configuration Examples.
You must specify at least one of the following properties:
AbortIncompleteMultipartUpload
, or ExpirationInDays
.
Syntax
To declare this entity in your AWS CloudFormation template, use the following syntax:
JSON
{ "AbortIncompleteMultipartUpload" :
AbortIncompleteMultipartUpload
, "ExpirationInDays" :Integer
, "Id" :String
, "ObjectSizeGreaterThan" :String
, "ObjectSizeLessThan" :String
, "Prefix" :String
, "Status" :String
}
YAML
AbortIncompleteMultipartUpload:
AbortIncompleteMultipartUpload
ExpirationInDays:Integer
Id:String
ObjectSizeGreaterThan:String
ObjectSizeLessThan:String
Prefix:String
Status:String
Properties
AbortIncompleteMultipartUpload
-
Specifies the days since the initiation of an incomplete multipart upload that Amazon S3 will wait before permanently removing all parts of the upload.
Required: No
Type: AbortIncompleteMultipartUpload
Update requires: No interruption
ExpirationInDays
-
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.
Required: No
Type: Integer
Update requires: No interruption
Id
-
Unique identifier for the rule. The value can't be longer than 255 characters.
Required: No
Type: String
Maximum:
255
Update requires: No interruption
ObjectSizeGreaterThan
-
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 in the Amazon S3 User Guide.
Required: No
Type: String
Pattern:
[0-9]+
Maximum:
20
Update requires: No interruption
ObjectSizeLessThan
-
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 in the Amazon S3 User Guide.
Required: No
Type: String
Pattern:
[0-9]+
Maximum:
20
Update requires: No interruption
Prefix
-
Object key prefix that identifies one or more objects to which this rule applies.
Important
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.
Required: No
Type: String
Update requires: No interruption
Status
-
If
Enabled
, the rule is currently being applied. IfDisabled
, the rule is not currently being applied.Required: Yes
Type: String
Allowed values:
Enabled | Disabled
Update requires: No interruption
Examples
Manage the lifecycle for S3 objects
The following example template shows an S3 directory bucket with a lifecycle
configuration rule. The rule applies to all objects with the foo/
key
prefix. The objects are expired after seven days, and incomplete multipart uploads
are deleted 3 days after initiation.
JSON
{ "AWSTemplateFormatVersion": "2010-09-09", "Resources": { "S3ExpressBucket": { "Type": "AWS::S3Express::DirectoryBucket", "Properties": { "LocationName": "usw2-az1", "DataRedundancy": "SingleAvailabilityZone", "LifecycleConfiguration": { "Rules": [ { "Id": "ExipiryRule", "Prefix": "foo/", "Status": "Enabled", "ExpirationInDays": 7, "AbortIncompleteMultipartUpload": { "DaysAfterInitiation": 3 }, } ] } } } }, "Outputs": { "BucketName": { "Value": { "Ref": "S3ExpressBucket" }, "Description": "Name of the sample Amazon S3 Directory Bucket with a lifecycle configuration." } } }
YAML
AWSTemplateFormatVersion: 2010-09-09 Resources: S3ExpressBucket: Type: 'AWS::S3Express::DirectoryBucket' Properties: LocationName: usw2-az1 DataRedundancy: SingleAvailabilityZone LifecycleConfiguration: Rules: - Id: ExipiryRule Prefix: foo/ Status: Enabled ExpirationInDays:7 AbortIncompleteMultipartUpload: DaysAfterInitiation:3 Outputs: BucketName: Value: !Ref S3ExpressBucket Description: Name of the sample Amazon S3 Directory Bucket with a lifecycle configuration.