DEV Community

GargeeBhatnagar for AWS Community Builders

Posted on

Scrutinize S3 Lifecycle Configuration Rules through CloudFormation Import Resources

“ I have checked the documents of AWS to create the s3 lifecycle configuration rules automatically. So I found that it can be possible using cloudformation stack to automate purpose for existing s3 bucket. Pricing of S3 bucket as per storage size.”

An S3 Lifecycle configuration is an XML file that consists of a set of rules with predefined actions that you want Amazon S3 to perform on objects during their lifetime. You can also configure the lifecycle by using the Amazon S3 console, REST API, AWS SDKs and the AWS Command Line Interface (AWS CLI).

Amazon S3 Lifecycle configuration rules run once a day. Check and confirm whether the rule has transitioned the storage class. The total number of objects in the bucket affects the time it takes for you to see the change in storage class.

An S3 Lifecycle configuration can have up to 1,000 rules. This limit is not adjustable. The element uniquely identifies a rule. ID length is limited to 255 characters.

In this post, you will get to know how to scrutinize s3 lifecycle configuration rules through cloudformation import resources. Here I have created a s3 bucket and s3 lifecycle configuration rules through a cloudformation stack with import resources.

Prerequisites

You’ll need an Amazon Simple Storage Service for this post. Getting started with Amazon Simple Storage Service provides instructions on how to create a bucket in simple storage service.

Architecture Overview

Image description
The architecture diagram shows the overall deployment architecture with data flow, amazon s3 and cloudformation.

Solution overview

The blog post consist of the following phases:

  1. Create of S3 Lifecycle Configuration Rules through CloudFormation
  2. Output of Stack as S3 Lifecycle Configuration Rules

I have a s3 bucket as below →
Image description
Image description
Image description

Phase 1: Create of S3 Lifecycle Configuration Rules through CloudFormation

  1. Open the cloudformation console and create a stack to import resources as an existing bucket with identifier property and its identifier value. Also the template .yaml file is customized with required parameters for s3 lifecycle rules. Image description Image description Image description Image description Image description Image description Image description Image description Image description Image description Image description Image description Image description Image description Image description Image description Image description

Phase 2: Output of Stack as S3 Lifecycle Configuration Rules

  1. Open the s3 bucket console and check the created lifecycle configuration rules. Image description Image description Image description Image description Image description Image description Image description Image description Image description

Clean-up

Delete S3 Bucket and Cloudformation Stack.

Pricing

I review the pricing and estimated cost of this example.

Cost of Data Transfer = $0.0

Cost of S3 = $0.009

Total Cost = $0.009

Summary

In this post, I showed “scrutinize s3 lifecycle configuration rules through cloudformation import resources”.

For more details on Amazon S3, Checkout Get started Amazon S3, open the Amazon S3 console. To learn more, read the Amazon S3 documentation.

For more details on AWS CloudFormation, Checkout Get started AWS CloudFormation, open the AWS CloudFormation console. To learn more, read the AWS CloudFormation documentation.

Thanks for reading!

Connect with me: Linkedin
Image description

Oldest comments (0)