- 
      
 - 
        
Save shoemoney/86bf14381cc8803df9dcf31d023a395b to your computer and use it in GitHub Desktop.  
    a valid aws bucket policy json format for S3 to handle access controll by IP addresses.
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | { | |
| "Version": "2008-10-17", | |
| "Id": "Policy<UNIQUE ID>", | |
| "Statement": [ | |
| { | |
| "Sid": "Stmt<UNIQUE ID>", | |
| "Effect": "Deny", | |
| "Principal": { | |
| "AWS": "*" | |
| }, | |
| "Action": "s3:*", | |
| "Resource": "arn:aws:s3:::<UNIQUE ID>/*", | |
| "Condition": { | |
| "NotIpAddress": { | |
| "aws:SourceIp": [ | |
| "<IP ADDRESS>", | |
| "..." | |
| ] | |
| } | |
| } | |
| }, | |
| { | |
| "Sid": "Stmt<UNIQUE ID>", | |
| "Effect": "Allow", | |
| "Principal": { | |
| "AWS": "*" | |
| }, | |
| "Action": "s3:GetObject", | |
| "Resource": "arn:aws:s3:::<BUCKET NAME>/*", | |
| "Condition": { | |
| "IpAddress": { | |
| "aws:SourceIp": [ | |
| "<IP ADDRESS>", | |
| "..." | |
| ] | |
| } | |
| } | |
| } | |
| ] | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment