Simplify Your Data Lifecycle & Optimize Storage Costs With Amazon S3 Lifecycle
Tags: s3, aws, lifecycle, optimize
Published: 2022-04-10 09:19:46

### This guide help you to understand all types of S3 Layer & How you can Optimize your storage costs by defining an S3 Lifecycle

## AWS S3 layers
S3 is a great way to fight the ever-growing data challenge by simply utilizing the power of modern object storage technology. But for the cost-effectiveness of using S3, you have to understand the S3 layers. There are 6 different S3 Layers. You have to understand all of those 6 layers to understand which layer is suitable for you. 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pdwczl0atctmhe7mkk44.png)

> Note: `S3 Glocier Instant Retrieval` & `S3 Glocier Instant Retrieval (formerly S3 Glocier)` are the different types of the same later (`S3 Glocier`).

However, all the six different S3 layers have various pricing, performance metrics, and SLAs.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a5z1w7e63umx1fytrkwk.jpg) 


Although, I believe the key here is to know data usage patterns and adjust their distribution among classes. 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p3v1t0cpconuaautfhjj.png)
 

So now, we have understood the layers of S3. Now we are going to enable the lifecycle for our logging S3 bucket to reduce cost.

## Enabling S3 Lifecycle Policies
Open AWS console and S3 bucket and select the S3 bucket which you want to enable the Lifecycle policy.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wylkghouugrzqwkzjdlr.png)
 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fih8hr68asl9z7b4vxe5.png)
 

- **Lifecycle rule name**: Give a Rule name. Ex: `S3FullLifecycle`
- **Choose a rule scope**: Apply to all objects in the bucket
- **Lifecycle rule actions**: Select
     - Move current versions of objects between storage classes
     - Expire current versions of objects

- **Transition current versions of objects between storage classes**

| storage class              | Days after object creation |
| -----------                | -----------                |
| Intelligent-Tiering        | 30                         |
| Glacier Instant Retrieval  | 60                         |
| Glacier Instant Retrieval (formerly Glacier)   | 180        |
| Glacier Deep Archive       | 360                        |

- **Expire current versions of objects**: 730

> Review transition and expiration actions

Then Click the `Create rule` button.

It will create your bucket lifecycle rule.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tx4b2kdulax3e12edjsa.png)

> Note: We can do whatever you wnat or your business requirements. And also you can change the lifecycle policies anytime as per your need.

By enabling S3 Bucket Lifecycle policies you can save upto 70% of your S3 Bucket Storage cost. 

So try to maintain the lifecycle policy for all of your bucket. If you don't know or understand your bucket data usage patterns by enabling S3 lifecycle policy by just Intelligent-Tiering after 30 days will save your storage cost upto 50%.


Summary
In this post, I showed “S3 Layers and by understand & utilizing those layers how you can create an S3 Lifecycle Policies to reduce the cost of an S3 bucket”.
To learn more, read the [AWS S3 lifecycle documentation](https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-lifecycle-mgmt.html).

Thanks for reading! Happy Cloud Computing!

Connect with me: [Linkedin](https://www.linkedin.com/in/noyonict/)