Home > Software engineering >  AWS S3 Lifecycle Rules Not Transitioning into Glacier, not sure what the issue is?
AWS S3 Lifecycle Rules Not Transitioning into Glacier, not sure what the issue is?

Time:05-26

I have this CFT that creates a S3 bucket with lifecycle rule to transition into Glacier immediately but it's not working they are still in standard after a couple of days. Any help would be appreciated thanks.

AWSTemplateFormatVersion: 2010-09-09

Description: Template to setup lifecycle configuration

Parameters:

  BucketName:

    Type: String

    Description: Name of the bucket on which lifecycle configuration will apply

    Default: lifecycle-config-testing-bucket

Resources:

  DemoBucket:

    Type: 'AWS::S3::Bucket'

    Properties:

      BucketName: !Ref BucketName

      LifecycleConfiguration:

        Rules:

          - Id: Transition all objects in the bucket after immediately 

            # Prefix: "" 

            Status: Enabled

            Transitions:

              - TransitionInDays: 0

                StorageClass: GLACIER

            ExpirationInDays: 365

Outputs:

  BucketName:

    Value: !Ref DemoBucket

    Description: Name of the sample Amazon S3 bucket with a lifecycle configuration.

CodePudding user response:

S3 lifecycle transitions have minimum age rules which needs to be true for each object. You can't immediately move a file directly to glacier after uploading it in S3.

Generic lifecycle policy could be S3 (standard) -> 30days -> S3 (Infrequent Access) -> 60days -> Glacier

Check the details on the minimum number of days from the documentation.

https://docs.aws.amazon.com/AmazonS3/latest/userguide/lifecycle-transition-general-considerations.html

CodePudding user response:

Works! It's not an exact time but it works, the change runs once a day, so updating CFTs may delaying the change taking place for a day or so.

  • Related