amazon-s3aws-cloudformation

How to configure IntelligentTieringConfiguration for an AWS::S3::Bucket resouce?


I'm trying to write a CloudFormation template to configure an AWS S3 bucket with intelligent tiers configuration, and have read AWS::S3::Bucket IntelligentTieringConfiguration link. However it's not clear where to put in in the YAML file.

I have a template file, and run an AWS CLI command

$ aws cloudformation create-stack --stack-name test-s3 --template-body file://test-s3.yaml --region us-east-1

I've tried

Description: AWS Cloudformation template to create S3 buckets
Resources:
  S3Bucket0:
    Type: AWS::S3::Bucket
    DeletionPolicy: Retain
    IntelligentTieringConfiguration:
      Id: Tier1
      Status: Enabled
      Tiering:
        - ARCHIVE_ACCESS

...which gives this error from AWS CLI immediately.

An error occurred (ValidationError) when calling the CreateStack operation: Invalid template resource property 'IntelligentTieringConfiguration

...or...

Description: AWS Cloudformation template to create S3 buckets
Resources:
  S3Bucket0:
    Type: AWS::S3::Bucket
    DeletionPolicy: Retain
    Properties:
      IntelligentTieringConfiguration:
        Id: Tier1
        Status: Enabled
        Tiering:
          - ARCHIVE_ACCESS

...which gives this error in the AWS CloudFormation console.

Encountered unsupported property IntelligentTieringConfiguration

So what's the correct format?


Solution

  • CloudFormation Linter in VSCode shows errors inline while authoring templates along with autocompletion and documentation links:

    Visual Studio Code extension

    [cfn-lint] E3002: Invalid Property Resources/S3Bucket0/Properties/IntelligentTieringConfiguration
    

    Should look more like this:

    Resources:
      S3Bucket0:
        Type: AWS::S3::Bucket
        DeletionPolicy: Retain
        Properties:
          IntelligentTieringConfigurations:
            - Id: Tier1
              Status: Enabled
              Tierings:
                - AccessTier: ARCHIVE_ACCESS
                  Days: