How create a AWS S3 bucket policy to grant access to specific IPs?
June 6, 2020 / Eternal Team
Introduction
- In this, we are going to learn about how to grant access to the bucket to specific tips to secure our bucket
- So if the bucket is public no one can access the bucket if they are out of the allowed IP range
- Eg: if there are multiple projects in a single account and are storing their static data in individual buckets so it is not a good practice that the server can access all the S3 buckets. If for any reason the server gets compromised the person/hacker will get the access of all the bucket so to stop this we can implement a bucket policy by which the specific Public IP or the Private IP only can access the data of the bucket programmatically.
Pre-requirements
- Server public IP
- Server private IP
- Amazon S3 bucket
To create the policy and attach it to the bucket steps are as follow