Tuesday, February 19, 2019

AWS S3 policy: allow access from the specific IP address

To allow IP from a specific address, you may think in different way.
Lets, enable selected actions in a policy. Then create a denied policy as bellow and attach it to a group.

Result: Access from these listed IPs are allowed!

Example:
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "VisualEditor0",
            "Effect": "Deny",
            "Action": "s3:ListAllMyBuckets",
            "Resource": "*",
            "Condition": {
                "ForAnyValue:NotIpAddress": {
                    "aws:SourceIp": [
                        "103.230.93.95/26",
                        "103.231.89.4/26"
                    ]
                }
            }
        }
    ]
}

4 comments:

  1. I’ve been surfing online more than 5 hours today, yet I never found any interesting article like yours without a doubt. It’s pretty worth enough for me. Thanks... 192.168

    ReplyDelete
  2. Your blog has chock-a-block of useful information. I liked your blog's content as well as its look. In my opinion, this is a perfect blog in all aspects. https://192-168-i-i.com

    ReplyDelete
  3. Thanks for taking the time to discuss this, I feel strongly about it and love learning more on this topic. If possible, as you gain expertise, would you mind updating your blog with extra information? It is extremely helpful for me Samsung Galaxy M01s Price

    ReplyDelete
  4. very nice and great article, thanks for sharing with us! Samsung A31 Price In Pakistan

    ReplyDelete