How does BlockPublicAcls and IgnorePublicAcls work differently?
For example, AWS S3 api has a call such as put-object have option --acl. With this you can not only upload object, but also make it publicly available.
When Block Public Access is off, call
aws s3api put-object --bucket some-bucket --acl public-read --key test.file
successes, and test.file will be not only uploaded, but also publicly available.
Now, if you enable:
BlockPublicAcls: the above API will fail. Any API which allows --acl public-read will be rejected. So test.file won't be uploaded.
IgnorePublicAcls: API call succeeds. The file is uploaded, but option --acl public-read is ignored and the file is private.
How does BlockPublicPolicy and RestrictPublicBuckets work differently?
Similarly, you can use put-bucket-policy to apply public bucket policies, e.g.:
{
"Statement": [
{
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::MyBucket/*"
}
]
}
with
aws s3api put-bucket-policy --bucket MyBucket --policy file://policy.json
Now, if you enable:
BlockPublicPolicy the above API will fail, because the policy allows for public API.
RestrictPublicBuckets the above API will succeed, and the bucket policy will be applied. However, the policy will be ignored, and objects will be private. Disabling RestrictPublicBuckets will make the policy to work, and the objects will be publicly available.
S3 Access points
There are new ways of controlling access to your objects. Instead of using AWS default S3 endpoint, like in the examples above, you can create your own endpoints and use that. For example:
aws s3api put-object --bucket some-bucket --acl public-read --key test.file --endpoint-url https://<endpoint-name>-<account-id>.s3-accesspoint.<region>.amazonaws.com
A single bucket can have many access points and its endpoints for different purposes. Also, each access point has its own Block Public Access settings and access point policy (similar to bucket policy). The options in Block Public Access for access points work similarly as for bucket, with the exceptions mentioned in the docs you cited.