Step1: Login to the AWS account
Step2: Navigate to the S3 bucket and go to permissions

Step3: Click on edit bucket policy and add the below policy:

{
“Version”: “2008-10-17”,
“Id”: “S3PolicyId1”,
“Statement”: [
{
“Sid”: “IPAllow”,
“Effect”: “Deny”,
“Principal”: {
“AWS”: “” }, “Action”: “s3:“,
“Resource”: “arn:aws:s3:::bucket-name/*”,
“Condition”: {
“NotIpAddress”: {
“aws:SourceIp”: [
“ip1”,
“ip2”
]
}
}
}
]
}

Step 4: Click on save changes

Leave a Reply