How to Enable CORS on S3 Bucket?

Learn how to Enable CORS on S3 Bucket. Simple Snippet to Paste and Get Started. CORS in S3 Buckets JSON Array.

I was struggling to get a document to be accessible via my JS request. It was giving me a Cross Origin error so I found an article on how to enable it on AWS.

  1. Log into the AWS Management Console
  2. Click on Services and select S3
  3. Select the desired bucket
  4. In the right-hand panel, click Permissions.
  5. Click Edit CORS Configuration
  6. in the pop-up dialog, paste the following text:
[
    {
        "AllowedOrigins": [
            "*"
        ],
        "AllowedMethods": [
            "GET"
        ],
        "MaxAgeSeconds": 3000,
        "ExposeHeaders": [
             "Content-Range",
             "Content-Length",
             "ETag"
        ],
        "AllowedHeaders": [
            "Authorization",
            "Content-Range",
            "Accept",
            "Content-Type",
            "Origin",
            "Range"
        ]
    }
]