8000 S3: implement TransitionDefaultMinimumObjectSize for Lifecycle Configuration by bentsku · Pull Request #12212 · localstack/localstack · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

S3: implement TransitionDefaultMinimumObjectSize for Lifecycle Configuration #12212

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

Merged
merged 2 commits into from
Feb 3, 2025

Conversation

bentsku
Copy link
Contributor
@bentsku bentsku commented Jan 30, 2025

Motivation

As a follow up from #12145, there was a new field introduced for operation related to S3 Buckets LifecycleConfiguration.

This fix allows us to now validate and return the field as well, even though we do not support Lifecycle transitions, some IaC providers might expect us to return it.

This is what the field is for:

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.

See:

Changes

  • write small test case to cover the CRUD functionality
  • implement the change in our model and provider
    • add additional safety when upgrading from an older model

@bentsku bentsku added aws:s3 Amazon Simple Storage Service semver: patch Non-breaking changes which can be included in patch releases labels Jan 30, 2025
@bentsku bentsku added this to the 4.2 milestone Jan 30, 2025
@bentsku bentsku self-assigned this Jan 30, 2025
@bentsku bentsku changed the title implement TransitionDefaultMinimumObjectSize for Lifecycle Configuration S3: implement TransitionDefaultMinimumObjectSize for Lifecycle Configuration Jan 30, 2025
Copy link
github-actions bot commented Jan 30, 2025

S3 Image Test Results (AMD64 / ARM64)

  2 files  ±0    2 suites  ±0   8m 22s ⏱️ +31s
476 tests +1  424 ✅ +1   52 💤 ±0  0 ❌ ±0 
952 runs  +2  848 ✅ +2  104 💤 ±0  0 ❌ ±0 

Results for commit 31ba4f5. ± Comparison against base commit 952eb3e.

♻️ This comment has been updated with latest results.

Copy link
github-actions bot commented Jan 30, 2025

LocalStack Community integration with Pro

    2 files  ±    0      2 suites  ±0   59m 0s ⏱️ - 55m 1s
1 708 tests  - 2 364  1 545 ✅  - 2 212  163 💤  - 152  0 ❌ ±0 
1 710 runs   - 2 364  1 545 ✅  - 2 212  165 💤  - 152  0 ❌ ±0 

Results for commit 31ba4f5. ± Comparison against base commit 952eb3e.

This pull request removes 2365 and adds 1 tests. Note that renamed tests count towards both.
tests.aws.scenario.bookstore.test_bookstore.TestBookstoreApplication ‑ test_lambda_dynamodb
tests.aws.scenario.bookstore.test_bookstore.TestBookstoreApplication ‑ test_opensearch_crud
tests.aws.scenario.bookstore.test_bookstore.TestBookstoreApplication ‑ test_search_books
tests.aws.scenario.bookstore.test_bookstore.TestBookstoreApplication ‑ test_setup
tests.aws.scenario.kinesis_firehose.test_kinesis_firehose.TestKinesisFirehoseScenario ‑ test_kinesis_firehose_s3
tests.aws.scenario.lambda_destination.test_lambda_destination_scenario.TestLambdaDestinationScenario ‑ test_destination_sns
tests.aws.scenario.lambda_destination.test_lambda_destination_scenario.TestLambdaDestinationScenario ‑ test_infra
tests.aws.scenario.loan_broker.test_loan_broker.TestLoanBrokerScenario ‑ test_prefill_dynamodb_table
tests.aws.scenario.loan_broker.test_loan_broker.TestLoanBrokerScenario ‑ test_stepfunctions_input_recipient_list[step_function_input0-SUCCEEDED]
tests.aws.scenario.loan_broker.test_loan_broker.TestLoanBrokerScenario ‑ test_stepfunctions_input_recipient_list[step_function_input1-SUCCEEDED]
…
tests.aws.services.s3.test_s3.TestS3BucketLifecycle ‑ test_s3_transition_default_minimum_object_size

♻️ This comment has been updated with latest results.

@bentsku bentsku requested a review from k-a-il January 31, 2025 11:57
Copy link
Contributor
@k-a-il k-a-il left a comment

Choose a reason for hiding this comment

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

LGTM :)

put_lifecycle_varies = aws_client.s3.put_bucket_lifecycle_configuration(
Bucket=s3_bucket,
LifecycleConfiguration=lfc,
TransitionDefaultMinimumObjectSize="varies_by_storage_class",
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: consider using TransitionDefaultMinimumObjectSize.varies_by_storage_class instead of string

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was a bit torn about this, because this variable is not exposed by boto3 itself but only generated from us, so people using boto3 do not have access to it and have to use hardcoded strings, so I figured that this is how a regular user would do it.

But I can also see the value in using the generated value from the specs, as I'm already doing it for StorageClass 😅 will update 👍

@bentsku bentsku force-pushed the fix-s3-lifecycle-transition branch from 4d19592 to 31ba4f5 Compare February 3, 2025 10:15
@bentsku bentsku merged commit d7ba30f into master Feb 3, 2025
38 checks passed
@bentsku bentsku deleted the fix-s3-lifecycle-transition branch February 3, 2025 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aws:s3 Amazon Simple Storage Service semver: patch Non-breaking changes which can be included in patch releases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0