Skip to content

Instantly share code, notes, and snippets.

@icarrr
Created October 19, 2021 08:52
Show Gist options
  • Save icarrr/a546fdb5d3d4b5d2aa88c4922600fa0a to your computer and use it in GitHub Desktop.
Save icarrr/a546fdb5d3d4b5d2aa88c4922600fa0a to your computer and use it in GitHub Desktop.
S3 Bucket Policy & Cors for Public Access

Policy

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "AllowPublicRead",
            "Effect": "Allow",
            "Principal": {
                "AWS": "*"
            },
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::BucketNate/*"
        }
    ]
}

CORS

[
    {
        "AllowedHeaders": [
            "*"
        ],
        "AllowedMethods": [
            "HEAD",
            "GET",
            "PUT",
            "POST",
            "DELETE"
        ],
        "AllowedOrigins": [
            "*"
        ],
        "ExposeHeaders": [
            "ETag",
            "x-amz-meta-custom-header"
        ]
    }
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment