Created
September 6, 2024 11:33
-
-
Save AlexMikhalev/43309ac4a8934a31db4fa4e2240bd25b to your computer and use it in GitHub Desktop.
Create AWS s3 bucket and make it publick
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
bucket_name="my-unique-name" | |
aws s3api create-bucket --bucket "${bucket_name}" > /dev/null # 1 | |
aws s3api put-public-access-block --bucket "${bucket_name}" --public-access-block-configuration "BlockPublicPolicy=false" # 2 | |
aws s3api put-bucket-policy --bucket "${bucket_name}" --policy '{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Sid": "PublicReadGetObject", | |
"Effect": "Allow", | |
"Principal": "*", | |
"Action": [ | |
"s3:GetObject" | |
], | |
"Resource": [ | |
"arn:aws:s3:::'"${bucket_name}"'/*" | |
] | |
} | |
] | |
}' # 3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment