How to block public access to S3 bucket using Terraform

0 votes
Hi Guys,

I have created an S3 bucket. I want to remove the public access from this bucket. How can I do that?
Sep 9, 2020 in Terraform by akhtar
• 38,260 points
13,717 views

1 answer to this question.

0 votes

Hi@akhtar,

To control the access of the S3 bucket you need to use the aws_s3_bucket_public_access_block resource in your Terraform code as shown below.

resource "aws_s3_bucket_public_access_block" "s3Public" {
bucket = "${aws_s3_bucket.bucket.id}"
block_public_acls = true
block_public_policy = true
restrict_public_buckets = true
}
answered Sep 9, 2020 by MD
• 95,460 points

Related Questions In Terraform

0 votes
1 answer

How to create one S3 bucket in AWS using Terraform?

Hi@akhtar, You need to set aws provider name ...READ MORE

answered Jul 23, 2020 in Terraform by MD
• 95,460 points
1,405 views
0 votes
1 answer

How to create a folder inside S3 Bucket using Terraform code?

Hi@akhtar, You can create a folder at the ...READ MORE

answered Jul 23, 2020 in Terraform by MD
• 95,460 points
2,954 views
0 votes
1 answer

How to copy the content of an s3 bucket to another s3 bucket using Terraform?

Hi@akhtar, There is no resource that enables the ...READ MORE

answered Sep 11, 2020 in Terraform by MD
• 95,460 points
5,089 views
0 votes
1 answer

How to import manually created s3 bucket in Terraform?

Hi@akhtar, Terraform will not able to get the ...READ MORE

answered Sep 11, 2020 in Terraform by MD
• 95,460 points
12,671 views
0 votes
1 answer

AWS S3 uploading hidden files by default

versioning is enabled in your bucket. docs.aws.amazon.com/AmazonS3/latest/user-guide/….... the ...READ MORE

answered Oct 4, 2018 in AWS by Priyaj
• 58,020 points
5,958 views
–1 vote
1 answer

How to decrypt the encrypted S3 file using aws-encryption-cli --decrypt

Use command : aws s3 presign s3://mybucket/abc_count.png you get ...READ MORE

answered Oct 22, 2018 in AWS by Priyaj
• 58,020 points
5,204 views
0 votes
1 answer

Import my AWS credentials using python script

Using AWS Cli  Configure your IAM user then ...READ MORE

answered Nov 16, 2018 in AWS by Jino
• 5,820 points
2,868 views
0 votes
2 answers
0 votes
1 answer

How to create a folder in S3 bucket using terraform?

Hi@akhtar, You can use aws_s3_bucket_object resource to create one ...READ MORE

answered Jun 11, 2020 in Terraform by MD
• 95,460 points
10,965 views
0 votes
1 answer

How to create one s3 bucket using terraform?

Hi@akhtar, You can use aws_s3_bucket resources to create ...READ MORE

answered Jun 12, 2020 in Terraform by MD
• 95,460 points
3,907 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP