How To Create S3 Bucket in AWS Using Terraform

monitor displaying computer application
Reading Time: 3 minutes

Hello Readers, In this blog we’ll see that how we can set-up OR Create S3 Bucket in AWS using Terraform. Before starting you must have Terraform, AWS CLI install on your machine and they both must be configure. 

SO LET’S GET START!

It is easy to set-up S3 Bucket using terraform. In order to do so you should follow certain steps. These are as follows:

STEP 1: Go the given URL and copy the content from the terraform docs of aws_s3_bucket.

STEP 2: Open your terminal and make one directory and and under that dir make file named as buckets.tf , and paste the content that you have copied from the url.

Run the following commands to do so :

cd Documents
mkdir Terraform
mkdir s3
nano buckets.tf

STEP 3: Check your file by :

cat buckets.tf

STEP 4: Remember you should have aws CLI in your local machine and then Configure your AWS by running the command:

aws configure

STEP 5: Make one more file named as provider.tf to give your credentials for AWS as:

provider "aws"{
region = "us-east-1"
access_key = "Your_Access_Key"
secret_key = "Your_Secret_Key"
}

STEP 6: Now run the Terraform command to Create the S3 Bucket as:

terraform init

STEP 7: Now let’s plan it . Plan is basically you are creating anything and what exactly you will get as the result.

terraform plan

STEP 8: finally run the command given below to apply it. You will see your s3 bucket is creating after providing it the value as ‘Yes’.

terraform apply

STEP 9: Login into your AWS Console and search for service as S3, you will see your S3 Bucket is up .

So , Yes we have successfully created our S3 Bucket using terraform in AWS.

Happy Learning!

Conclusion

So, In this blog we have seen in some simple steps how we can create a S3 Bucket in AWS using Terraform .Thanks for being with me till the end. If you find this blog helpful do share with your friends.

Reference

Click here

Written by 

Deeksha Tripathi is a Software Consultant at Knoldus Inc Software. She has a keen interest toward learning new technologies. Her practice area is DevOps. When not working, she will be busy in listening music , and spending time with her family .