Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting Lifecycle configuration for S3 Buckets in YAML file

I'm trying to set a Life cycle configuration for my S3 buckets to expire after 90 days. However, I'm getting an error saying "Property Status cannot be empty" when pushing my CFT stack.

I tried setting a lifestyle config, and putting the expiration in days onto that, but it seems to be failing.

AWSTemplateFormatVersion: '2010-09-09'
Description: Creates S3 Bucket

Resources:
 TestBucket:
 Type: AWS::S3::Bucket
 Properties:
   BucketName: !Sub "${AWS::StackName}-test"
   AccessControl: Private
   LifecycleConfiguration:
    Rules:
    - Id: DeleteContentAfter90Days
      Prefix: ''
      Status: Enabled
      ExpirationInDays: '90'

I'm getting "Property status cannot be empty" and an update rollback when I check my status in the console.

like image 786
Mohan Aravind Avatar asked Jan 25 '19 19:01

Mohan Aravind


2 Answers

Status: 'Enabled'

Status should be string value as stated in the documentation

Here is a working example of LifecycleConfiguration:

LifecycleConfiguration:
    Rules:
      - Id: DeleteContentAfter1Day
        Status: 'Enabled'
        ExpirationInDays: 1
like image 178
Efi gazarov Avatar answered Sep 28 '22 19:09

Efi gazarov


ExpirationInDays should be a number, not a string

like image 23
user3407348 Avatar answered Sep 28 '22 18:09

user3407348