Skip to content

Commit 4aa117b

Browse files
authored
feat(s3): support transitionDefaultMinimumObjectSize for life cycle (#31778)
### Issue # (if applicable) Closes #31777. ### Reason for this change TransitionDefaultMinimumObjectSize for lifecycles has been supported. It can be possible to indicate which default minimum object size behavior is applied to the lifecycle configuration. what's new: https://aws.amazon.com/about-aws/whats-new/2024/09/amazon-s3-default-minimum-object-size-lifecycle-transition-rules UserGuide: https://docs.aws.amazon.com/AmazonS3/latest/userguide/lifecycle-transition-general-considerations.html#lifecycle-configuration-constraints Cfn doc: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-lifecycleconfiguration.html#cfn-s3-bucket-lifecycleconfiguration-transitiondefaultminimumobjectsize API: https://docs.aws.amazon.com/cli/latest/reference/s3api/put-bucket-lifecycle-configuration.html Still CFn documentation says “Property description not available”, so it is good to look at the API documentation for the description. ``` --transition-default-minimum-object-size (string) Indicates which default minimum object size behavior is applied to the lifecycle configuration. all_storage_classes_128K - Objects smaller than 128 KB will not transition to any storage class by default. varies_by_storage_class - Objects smaller than 128 KB will transition to Glacier Flexible Retrieval or Glacier Deep Archive storage classes. By default, all other storage classes will prevent transitions smaller than 128 KB. To customize the minimum object size for any transition you can add a filter that specifies a custom ObjectSizeGreaterThan or ObjectSizeLessThan in the body of your transition rule. Custom filters always take precedence over the default transition behavior. Possible values: varies_by_storage_class all_storage_classes_128K ``` ### Description of changes Add `TransitionDefaultMinimumObjectSize` to BucketProps. ### Description of how you validated changes Both unit and integ tests. ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 5dbe8f7 commit 4aa117b

12 files changed

+654
-1
lines changed

packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.lifecycle-transitions.js.snapshot/cdk.out

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.lifecycle-transitions.js.snapshot/cdkintegs3lifecycletransitionsDefaultTestDeployAssert9A611ED6.assets.json

+19
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.lifecycle-transitions.js.snapshot/cdkintegs3lifecycletransitionsDefaultTestDeployAssert9A611ED6.template.json

+36
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.lifecycle-transitions.js.snapshot/integ.json

+12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.lifecycle-transitions.js.snapshot/manifest.json

+121
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.lifecycle-transitions.js.snapshot/s3-lifecycle-transitions.assets.json

+19
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
{
2+
"Resources": {
3+
"AllStorageClasses128KB8241761": {
4+
"Type": "AWS::S3::Bucket",
5+
"Properties": {
6+
"LifecycleConfiguration": {
7+
"Rules": [
8+
{
9+
"Status": "Enabled",
10+
"Transitions": [
11+
{
12+
"StorageClass": "DEEP_ARCHIVE",
13+
"TransitionInDays": 30
14+
}
15+
]
16+
},
17+
{
18+
"ObjectSizeGreaterThan": 200000,
19+
"ObjectSizeLessThan": 300000,
20+
"Status": "Enabled",
21+
"Transitions": [
22+
{
23+
"StorageClass": "ONEZONE_IA",
24+
"TransitionInDays": 30
25+
}
26+
]
27+
}
28+
],
29+
"TransitionDefaultMinimumObjectSize": "all_storage_classes_128K"
30+
}
31+
},
32+
"UpdateReplacePolicy": "Delete",
33+
"DeletionPolicy": "Delete"
34+
},
35+
"VariesByStorageClassCD3C88D5": {
36+
"Type": "AWS::S3::Bucket",
37+
"Properties": {
38+
"LifecycleConfiguration": {
39+
"Rules": [
40+
{
41+
"Status": "Enabled",
42+
"Transitions": [
43+
{
44+
"StorageClass": "DEEP_ARCHIVE",
45+
"TransitionInDays": 30
46+
}
47+
]
48+
},
49+
{
50+
"ObjectSizeGreaterThan": 200000,
51+
"ObjectSizeLessThan": 300000,
52+
"Status": "Enabled",
53+
"Transitions": [
54+
{
55+
"StorageClass": "ONEZONE_IA",
56+
"TransitionInDays": 30
57+
}
58+
]
59+
}
60+
],
61+
"TransitionDefaultMinimumObjectSize": "varies_by_storage_class"
62+
}
63+
},
64+
"UpdateReplacePolicy": "Delete",
65+
"DeletionPolicy": "Delete"
66+
}
67+
},
68+
"Parameters": {
69+
"BootstrapVersion": {
70+
"Type": "AWS::SSM::Parameter::Value<String>",
71+
"Default": "/cdk-bootstrap/hnb659fds/version",
72+
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
73+
}
74+
},
75+
"Rules": {
76+
"CheckBootstrapVersion": {
77+
"Assertions": [
78+
{
79+
"Assert": {
80+
"Fn::Not": [
81+
{
82+
"Fn::Contains": [
83+
[
84+
"1",
85+
"2",
86+
"3",
87+
"4",
88+
"5"
89+
],
90+
{
91+
"Ref": "BootstrapVersion"
92+
}
93+
]
94+
}
95+
]
96+
},
97+
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
98+
}
99+
]
100+
}
101+
}
102+
}

0 commit comments

Comments
 (0)