Amazon S3 files access policy based on IP Address

前端 未结 2 1406
面向向阳花
面向向阳花 2021-01-30 10:53

Is there any way to limit the access of a file stored in Amazon S3 based on the client IP address?

I have a file stored there, which should be access only by specific IP

2条回答
  •  不要未来只要你来
    2021-01-30 11:44

    Yes there is, although I have not used this myself.

    S3 supports granular control over buckets and objects in them using "Access Policy Language". There is specific whitelist and blacklist IP statements available. You will have to write the APL statements and upload them, however.

    http://docs.amazonwebservices.com/AmazonS3/latest/dev/AccessPolicyLanguage.html

    Here are 2 condition section examples:

    Whitelist

    "Condition" :  {
           "IpAddress" : {
              "aws:SourceIp" : ["192.168.176.0/24","192.168.143.0/24"]
          }
    }
    

    Blacklist

    "Condition" :  {
           "NotIpAddress" : {
              "aws:SourceIp" : ["192.168.176.0/24","192.168.143.0/24"]
          }
    }
    

提交回复
热议问题