Limit IpAddress while uploading to aws s3 bucket using aws post policy

0

I want to restrict the upload to specific IP address while using the aws post policies, how can this be done, if not then what are the alternates ??

2개 답변
0

You can use a bucket policy to specify which IP can access an S3 bucket. Please see a detailed blog with some samples: https://aws.amazon.com/premiumsupport/knowledge-center/block-s3-traffic-vpc-ip/

AWS
dsp
답변함 일 년 전
0

When a user uses a S3 pre-signed URL, the credentials and permissions of the creator of the URL are used to access the object. So, if you want to restrict the PUT of the object to a specific IP address you use a policy like this, attached to the role/user that creates the presigned URL.

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "Stmt1670849877919",
      "Action": [
        "s3:PutObject"
      ],
      "Effect": "Allow",
      "Resource": "arn:aws:s3:::mybucket/*",
      "Condition": {
        "IpAddress": {
          "aws:SourceIp": "192.168.1.45/32"
        }
      }
    }
  ]
}

You can also attach a bucket policy to the bucket and denies all other requests to lock down the bucket to only this source IP.

{
  "Id": "Policy1670850160564",
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "Stmt1670850159333",
      "Action": "s3:*",
      "Effect": "Deny",
      "Resource": [
        "arn:aws:s3:::mybucket",
        "arn:aws:s3:::mybucket/*"
      ],
      "Condition": {
        "NotIpAddress": {
          "aws:SourceIp": "192.168.1.45/32"
        }
      },
      "Principal": "*"
    }
  ]
}
profile pictureAWS
전문가
kentrad
답변함 일 년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠