We can easily make an S3 bucket using the AWS CLI by running the command:
aws s3 mb s3://mybucket
where mb
means “make bucket”. What you must know is that the new bucket does not have blocked public access! In order to block public access you need to run the following command:
aws s3api put-public-access-block \ --bucket my-bucket \ --public-access-block-configuration "BlockPublicAcls=true,IgnorePublicAcls=true,BlockPublicPolicy=true,RestrictPublicBuckets=true"
Reference: put-public-access-block