Skip to content

feat(rules): validate S3 lifecycle transition order (E9016, E9017) - #521

Merged
satyakigh merged 8 commits into
aws-cloudformation:mainfrom
badmintoncryer:feat/s3-lifecycle-transition-order
Dec 1, 2026
Merged

satyakigh merged 8 commits into
aws-cloudformation:mainfrom
badmintoncryer:feat/s3-lifecycle-transition-order

Conversation

@badmintoncryer

@badmintoncryer badmintoncryer commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Two engine rules (Rego and CEL) for AWS::S3::Bucket lifecycle Transitions and NoncurrentVersionTransitions:

  • E9016: a lower storage class (STANDARD_IA → INTELLIGENT_TIERING → ONEZONE_IA → GLACIER_IR → GLACIER → DEEP_ARCHIVE) must come later than every class above it, by days or by TransitionDate.
  • E9017: minimum stay before the next transition: 30 days from STANDARD_IA to any lower class and from ONEZONE_IA to GLACIER/DEEP_ARCHIVE, 90 days from GLACIER_IR to GLACIER/DEEP_ARCHIVE and from GLACIER to DEEP_ARCHIVE.

The legacy Glacier class is treated as GLACIER. Values from parameters or intrinsics are skipped. AWS::S3Express::DirectoryBucket has no transitions.

Related issue

#473

Validation behavior changes

Deployed in us-east-1:

Rule Template Result
E9016 STANDARD_IA 90, GLACIER 89 rejected: GLACIER days must be greater than STANDARD_IA days
E9017 STANDARD_IA 30, GLACIER 59 rejected: must be 30 days more
E9017 GLACIER_IR 4, DEEP_ARCHIVE 93 rejected: must be 90 days more
- STANDARD_IA 30 / GLACIER 60, GLACIER_IR 30 / DEEP_ARCHIVE 120 deployed

Rules with Status: Disabled are rejected the same way, so they are checked too. No existing diagnostics changed.

Checklist

  • For validation behavior changes, expected behavior is supported by CloudFormation evidence and all three engine
    selectors agree.
  • My code adheres to the CONTRIBUTING GUIDE and the repo code conventions and style in the
    code quality guide.

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

@satyakigh

satyakigh commented Dec 1, 2026 •

Copy link
Copy Markdown
Collaborator

Follow-up validation gaps outside this PR's E9016/E9017 scope

The validator does not currently report the cases below, but deployment rejects them.

Case Validation should fail when
Unsupported transition One lifecycle rule moves objects from ONEZONE_IA to GLACIER_IR. This applies to both Transitions and NoncurrentVersionTransitions, regardless of the number of days between them.
Duplicate destination The same rule transitions to one storage class more than once, even on different days. Treat GLACIER and the legacy Glacier spelling as the same destination.
Mixed scheduling units One rule mixes TransitionInDays with TransitionDate, uses ExpirationDate with day-based transitions, or uses ExpirationInDays with date-based transitions.
Expiration is too early ExpirationInDays is less than or equal to any TransitionInDays; ExpirationDate is not later than every TransitionDate; or noncurrent expiration days are less than or equal to any noncurrent transition days.
Singular and plural forms together One rule contains both Transition and Transitions, or both NoncurrentVersionTransition and NoncurrentVersionTransitions.

These checks should remain separate from E9016 ordering and E9017 minimum-stay validation because each case needs its own clear error message.

@satyakigh
satyakigh merged commit f052037 into aws-cloudformation:main Dec 1, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants