aws s3 bucket policy mistake

When configuring AWS policy, it can gets tricky, as i am using this policy on my bucket 

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Principal": {
                "AWS": "arn:aws:iam::(masked-not-actual):user/jeremydev"
            },
            "Effect": "Allow",
            "Action": [
                "s3:GetObject",
                "s3:PutObject",
                "s3:*"
            ],
            "Resource": "arn:aws:s3:::appjerwo-demo-test"
            ]
        }
    ]
}

And i quickly get an error. The reason, i missed out an asterisk while trying to configure permission on a bucket level. 

Important thing to note also, Resource is not an array. 

            "Resource": "arn:aws:s3:::appjerwo-demo-test/*"

Correctly policies:- 

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Principal": {
                "AWS": "arn:aws:iam::(masked-not-actual):user/jeremydev"
            },
            "Action": [
                "s3:GetObject",
                "s3:PutObject",
                "s3:*"
            ],
            "Resource": "arn:aws:s3:::appjerwo-demo-test/*"
        }
    ]
}

This is too error prone - gotta be a better way to do this.


 






Comments

Popular posts from this blog

vllm : Failed to infer device type

android studio kotlin source is null error

gemini cli getting file not defined error