Skip to content

How To Configure CORS in Amazon S3 Buckets

Covers
AWS

The default CORS policy doesn’t allow S3 content to other origins, even if the repository is public or hosting a static website. To allow the resources accessible to other domains, you need to update the S3 buckets CORS policy.

Set Up CORS in S3 Buckets

You can quickly enable cross-origin resource sharing (CORS) on your Amazon S3 buckets, with the following steps:

  1. Log into the AWS Management Console.
  2. Select S3 under the Services
  3. Select your S3 bucket.
  4. Go to the Permissions tab.
  5. Click Edit the Cross-origin resource sharing (CORS) section.
  6. Paste the below JSON content in editor:

  7. Click Save changes.

That’s it! Cross-origin resource sharing (CORS) is enabled for your S3 bucket. You can access the s3 files from other origins. You can also update AllowedOrigins in JSON content to limit access to specific domains only.

Rahul

Rahul Kumar is the founder and chief editor of TecAdmin.net. A Red Hat Certified Engineer (RHCE), he has worked in IT since 2009, with hands-on experience in Linux system administration, DevOps, web hosting, cloud platforms and automation. He started TecAdmin in 2013 to share practical, step-by-step guides, and leads its editorial work with one aim: making technical learning clear and useful for sysadmins, developers and beginners alike.

Leave a Reply

Your email address will not be published. Required fields are marked *


Back to top