How to restrict access to a bucket to specific IP address?

You can restrict access to objects in your bucket to specific IP address by attaching policy which contains allowed IP address range in the "Condition" statement.

Below is a sample example of a policy which restricts access to two IP addresses.

  • restricts all IP address within the /16 subnet &
  • restricts just that specific IP address
  "Id": "Policy1512590315712",
  "Version": "2012-10-17",
  "Statement": [
      "Sid": "Stmt1512590314407",
      "Effect": "Deny",
      "Principal": {
        "AWS": "*"
      "Action": "*",
      "Resource": [
      "Condition": {
        "NotIpAddress": {
          "aws:SourceIp": ["",""]
Have more questions? Submit a request