Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(s3): support transitionDefaultMinimumObjectSize for life cycle #31778

Merged
merged 8 commits into from
Oct 18, 2024

Conversation

go-to-k
Copy link
Contributor

@go-to-k go-to-k commented Oct 16, 2024

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


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@aws-cdk-automation aws-cdk-automation requested a review from a team October 16, 2024 11:55
@github-actions github-actions bot added feature-request A feature should be added or improved. p2 distinguished-contributor [Pilot] contributed 50+ PRs to the CDK labels Oct 16, 2024
@go-to-k go-to-k marked this pull request as ready for review October 16, 2024 12:04
@go-to-k go-to-k marked this pull request as draft October 16, 2024 12:04
@go-to-k go-to-k marked this pull request as ready for review October 18, 2024 07:52
Comment on lines +1556 to +1557
* @default - TransitionDefaultMinimumObjectSize.VARIES_BY_STORAGE_CLASS before September 2024,
* otherwise TransitionDefaultMinimumObjectSize.ALL_STORAGE_CLASSES_128_K.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ref: https://docs.aws.amazon.com/ja_jp/AmazonS3/latest/userguide/lifecycle-transition-general-considerations.html#lifecycle-configuration-constraints


In September 2024 Amazon S3 updated the default transition behavior for small objects, as follows:

Updated default transition behavior — Starting September 2024, the default behavior prevents objects smaller than 128 KB from being transitioned to any storage class.

Previous default transition behavior — Before September 2024, the default behavior allowed objects smaller than 128 KB to be transitioned only to the S3 Glacier and S3 Glacier Deep Archive storage classes.

@aws-cdk-automation aws-cdk-automation added the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Oct 18, 2024
@@ -862,6 +862,33 @@ const bucket = new s3.Bucket(this, 'MyBucket', {
});
```

To indicate which default minimum object size behavior is applied to the lifecycle configuration, use the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @go-to-k - nit/small comment, I think it might be worth mentioning the new default in the README somewhere here as you mentioned in this comment

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your review!
I have modified the docs. Could you please take a look at it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks for updating

Copy link
Contributor

mergify bot commented Oct 18, 2024

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 34b7f9e
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify mergify bot merged commit 4aa117b into aws:main Oct 18, 2024
9 checks passed
Copy link
Contributor

mergify bot commented Oct 18, 2024

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

Copy link

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 18, 2024
@go-to-k go-to-k deleted the s3-transition-size branch October 19, 2024 02:18
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
distinguished-contributor [Pilot] contributed 50+ PRs to the CDK feature-request A feature should be added or improved. p2 pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

s3: support TransitionDefaultMinimumObjectSize for life cycle
3 participants