How to make both IP restriction and service restriction coexist

Viewed 24

I want to set both IP restriction and internal restriction to S3 bucket policy.

I want to restrict access only from this ip and from ECS Cluster (in vpc-0fb1bf67df9b206aa VPC).

However access from ecs is denied somehow.

Where am I wrong?

    {
        "Effect": "Deny",
        "Principal": "*",
        "Action": [
            "s3:PutObject",
            "s3:ListBucket",
            "s3:GetObject",
            "s3:DeleteObject"
        ],
        "Resource": [
            "arn:aws:s3:::wb-bucket-stag",
            "arn:aws:s3:::wb-bucket-stag/*"
        ],
        "Condition": {
            "NotIpAddress": {
                "aws:SourceIp": [
                    "133.32.11.11/32",
                    "59.106.11.1/32"
                ]
            },
            "StringNotEquals": {
                "aws:sourceVpc": "vpc-0fb1bf67df9b206aa"
            }
        }
    }
0 Answers
Related