Skip to content

Commit

Permalink
Create separate lifecycle rules for expired_object_delete_marker
Browse files Browse the repository at this point in the history
Fixes #305
  • Loading branch information
chuckwondo committed Jan 14, 2025
1 parent 51aaacb commit e28964f
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions stack/stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,15 @@ def __init__(self, scope: Construct, id: str, **kwargs) -> None:
bucket_name=SENTINEL_INPUT_BUCKET,
removal_policy=RemovalPolicy.DESTROY,
lifecycle_rules=[
# Setting expired_object_delete_marker cannot be done within a
# lifecycle rule that also specifies expiration, expiration_date, or
# tag_filters.
aws_s3.LifecycleRule(expired_object_delete_marker=True),
aws_s3.LifecycleRule(
abort_incomplete_multipart_upload_after=Duration.days(1),
expiration=Duration.days(sentinel_input_bucket_expiration_days),
expired_object_delete_marker=True,
noncurrent_version_expiration=Duration.days(1),
)
),
],
)

Expand All @@ -175,12 +178,15 @@ def __init__(self, scope: Construct, id: str, **kwargs) -> None:
bucket_name=SENTINEL_INPUT_BUCKET_HISTORIC,
removal_policy=RemovalPolicy.DESTROY,
lifecycle_rules=[
# Setting expired_object_delete_marker cannot be done within a
# lifecycle rule that also specifies expiration, expiration_date, or
# tag_filters.
aws_s3.LifecycleRule(expired_object_delete_marker=True),
aws_s3.LifecycleRule(
abort_incomplete_multipart_upload_after=Duration.days(1),
expiration=Duration.days(sentinel_input_bucket_expiration_days),
expired_object_delete_marker=True,
noncurrent_version_expiration=Duration.days(1),
)
),
],
)

Expand Down

0 comments on commit e28964f

Please sign in to comment.