AWS S3 with Terraform: Cloud Storage Made Simple

AWS S3 with Terraform: Cloud Storage Made Simple

Short introduction on using s3 with Terraform

Hello there fellow coder's and web surfer's. One of the advantages of working in a startup as a software engineer is that, you don't only get to work only on development part, but also many other domains like testing, designing and yes devops too.

And Today i will be talking about one such tool that I got a chance to learn about. Although, I had previously worked with aws s3(which was not such as good experience) this was my first time making s3 buckets using a cloud infrastruture as a code tool (terraform).

What is S3?

AWS S3 or Amazon Simple Storage Service is a cloud storage service provided by amazon web services. We can storage any type of data in s3 in files and folder structure similar to our local machines. Although internally its stored as an object. I will explain about object storage in some other blog.

Some advantages of s3 may include

  • Scalable: Can automatically accomadate any amount of data

  • Backups: It regularly backups data

  • Security: The data is protected and can only be accessed through proper authorization

  • Low Cost: The data storage is pretty cheap

  • Low latency and all time availablity: The data can accessed fastly and is available everywhere anytime

And yes you can use it to store your cat pics.

Now, the question is why terraform? Lets look at some issues with s3 to understand.

Why Terraform?

Consider a situation where you have 100 s3 buckets for different services. Now you may have to make these through aws user interface. Which is a very tiresome task as you will be needing to manually click buttons after buttons in aws console. Which you know can be pretty boring and inefficent.

Soo whats the solution, (drum rolls in background)

Terraform

Terraform creates and manages resources on cloud platforms and other services through their application programming interfaces (APIs). Providers enable Terraform to work with virtually any platform or service with an accessible API.

Now you need to migrate to new aws account having the same access control and buckets as in above scenario. Here comes the problem you need to manually create all the 100 buckets and give the access control and permisions needed.

With terraform you can create buckets and give various options in code. Later just change the account you need and push the code which will repliacate all the buckets that you need. This makes things soo much easier and helps you save alot of time.

Features of terrafrom that i found awesome

  • Versioning: We can enable versioning easily which will allow to see all the changes made to a file in s3 bucket.

  • Iam policy: We can add a iam policy in code for access control.

  • Blazing fast: Creates all the needed buckets and instances instanly.

Yes, you can get your cat pics fast.

Conclusion

There are many good tools out there, that make our lifes as developers easy. One such tool is terraform which speeds up the process of making instances in aws or any cloud provider.

Stay tuned for more exciting tech blogs.

for more info visit https://www.terraform.io/.