How do you make an AWS S3 public folder private again?
I was testing out some staging data, so I made the entire folder public within a bucket. I\'d like to restrict it
For AWS CLI, it is fairly straight forward.
If the object is: s3://
For single object:
aws s3api put-object-acl --acl private --bucket --key file.txt
For all objects in the bucket (bash one-liner):
aws s3 ls --recursive s3:// | cut -d' ' -f5- | awk '{print $NF}' | while read line; do
echo "$line"
aws s3api put-object-acl --acl private --bucket --key "$line"
done