Skip to content

How do I allow s3 bucket read only to all, insert and delete from particular IP only

0

How do I allow s3 bucket read-only to all, insert and delete from particular IP only

asked 2 years ago281 views

2 Answers
2

Hi,

The right way to go for such thing is to use IAM condition in the policies.

See https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_examples_aws_deny-ip.html

An example is

{
    "Version": "2012-10-17",
    "Statement": {
        "Effect": "Deny",
        "Action": "*",
        "Resource": "*",
        "Condition": {
            "NotIpAddress": {
                "aws:SourceIp": [
                    "192.0.2.0/24",
                    "203.0.113.0/24"
                ]
            }
        }
    }
}

You have to adapt it for the S3 actions and the buckets that you want to allow for read for some ip addresses and for write for others

Best,

Didier

EXPERT

answered 2 years ago

EXPERT

reviewed 2 years ago

0

By allowing access to all, without IP restrictions for reading and with restrictions for writing, do you mean completely unauthenticated users or only users and roles in your or someone else's AWS account or organisation?

Public access even for reading is hazardous, because it allows anyone to hit your bucket with as many requests as they'd like, for which AWS will charge you per- API call and data transfer fees. We can write the bucket policy statements to allow that, if that's really your intent, but usually this isn't what most mean to do.

EXPERT

answered 2 years ago

EXPERT

reviewed 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.