DevOps(Day-94): AWS S3 Bucket Creation and Management through Terraform hands on

 

  • AWS S3 Bucket

  • Task: Hands-On

    • Create an S3 bucket using Terraform

    • Configure the bucket to allow public read access

    • Create an S3 bucket policy that allows read-only access to a specific IAM user or role

    • Enable versioning on the S3 bucket

Amazon S3 (Simple Storage Service) is an object storage service that offers industry-leading scalability, data availability, security, and performance. It can be used for a variety of use cases, such as storing and retrieving data, hosting static websites, and more.

In this task, you will learn how to create and manage S3 buckets in AWS.

  • Create an S3.tf with required bucket name.

  • Use terraform init and plan to get the providers and view the terraform changes.

  • Now, use terraform apply to make the changes using terraform files.

  • Navigate to the AWS management console and go to S3 to view the bucket created.

  • Enable the ACL in the S3 bucket and choose Bucket owner preferred and save the change.

  • Create a public_access.tf file and write proper configuration.

  • Use terraform apply to create public access for the S3 bucket.

  • Check the bucket in the console for the public access which is now enabled.

  • Create an IAM.tf file to write the configuration of IAM read access for the S3 bucket.

  • Now, use terraform apply to provide the access in the bucket.

  • Now, check the bucket to view the policy.

  • Insert the versioning configuration in the S3.tf file.
  resource "aws_s3_bucket" "devops_bucket" {
    bucket = "devopsbucketday67"
    versioning {
      enabled = true
    }
  }
  • Use the terraform apply to enable versioning in S3 bucket.

  • We can see the changes in the S3 bucket in the AWS management console.

Thanks for reading my article. Have a nice day.

Comments

Popular posts from this blog

DevOps(Day-97): Meta-Arguments in Terraform

DevOps(Day-95): Auto Scaling with Terraform

DevOps (Day-1) Introduction