Making the S3 Files Publicly Accessible
Introduction
All uploaded files are private by default and can only be viewed by the AWS account owner, but you can make them accessible to everyone using the AWS Console.
In this lab step, you will modify the permissions of the S3 bucket you created earlier so the bucket can be accessed publicly.
Instructions
1. In the S3 Console for your bucket, click the Permissions tab:
2. Scroll down to Block public access (bucket settings) and click Edit:
3. Uncheck Block all public access:
Also, ensure that all other checkboxes are unchecked.
Note: You should carefully consider anytime you allow public access to S3 buckets. AWS has implemented these security features to help prevent data breaches. For this lab, there is no sensitive data and you do want to allow public access.
To learn more about access control in Amazon S3, visit the AWS documentation.
4. To save your changes, scroll to the bottom, and click Save changes:
The Amazon S3 Console will ask you to confirm that you want to make this change.
5. Enter confirm in the text-box and click Confirm:
6. Navigate back to your bucket's objects by clicking the Objects tab.
7. Select the gallery object:
8. Click Actions, and then click Make public:
9. On the page that opens, click Make public:
You will see a blue notification that the operation is in progress, and then a green notification that the gallery folder has been made public.
10. To exit the Make public form, in the top-right, click Exit.
Next, you will access the URL of your gallery folder and visit it in your web browser.
11. To return to the objects list, click the Objects tab.
12. To see the contents of the gallery folder, in the objects list, click gallery/:
13. Click the index.html object:
You will see an overview of this object.
14. Under Object URL, click the link:
You will see the Demo Gallery webpage load:
Look at the URL in the address bar, it will be similar to:
- https://calabs-abc123.s3-us-west-2.amazonaws.com/gallery/index.html
The URL of any S3 object follows this template:
- https://<bucket-name>.s3-us-west-2.amazonaws.com/<object-prefix>/<object-name>
Note: You may encounter older S3 buckets using the following URL format:
- https://s3-<region>.amazonaws.com/<bucket-name>/<object-prefix>/<object-name>
In 2020 AWS changed new buckets to use the current format (bucket name as a part of the hostname).