Working on a website hosted in AWS S3, but don’t want to give public access yet? Easy fix.

First navigate to your console and go to S3 service.

Next, navigate to the bucket where your static site is hosted and go to Permissions tab, then click on bucket policy.


In a new browser tab, navigate to    to perform an IP address lookup.

After knowing the IP address, enter the following JSON policy into the policy editor. You will need to modify the two items in bold that correspond to your bucket name and IP address.

[cc lang=”json”]{
“Version”: “2012-10-17”,
“Id”: “S3PolicyId1”,
“Statement”: [
“Sid”: “IPAllow”,
“Effect”: “Allow”,
“Principal”: “*”,
“Action”: “s3:*”,
“Resource”: “arn:aws:s3:::YOUR_BUCKET/*”,
“Condition”: {
“IpAddress”: {
“aws:SourceIp”: [

Click save, and then your index.html document will be accessible form the machine you are on.

Recommended Posts

No comment yet, add your voice below!

Add a Comment

Your email address will not be published. Required fields are marked *