We can give public access to list the contents of a bucket as follows:
- Go to the S3 service in the console, click on your bucket's name, go to the Permissions tab, and then go to Bucket Policy.
- Click on Policy generator in the lower-left corner.
- Within Policy generator, select/enter data as follows:
- Select Type of Policy as Bucket Policy.
- Select Principal as *.
- Select AWS Service as Amazon S3.
- Select Actions as ListBucket.
- Select Amazon Resource Name (ARN) as arn:aws:s3:::awsseccookbook.
- Click on Add Conditions (Optional).
- Click Add Condition and enter the following:
- Condition as DateLessThan
- Key as aws:EpochTime
- Value as a future date in epoch format (for example, 1609415999 ...