Facebook Twitter Instagram
    TecAdmin
    • Home
    • Ubuntu 20.04
      • Upgrade Ubuntu
      • Install Java
      • Install Node.js
      • Install Docker
      • Install LAMP Stack
    • Tutorials
      • AWS
      • Shell Scripting
      • Docker
      • Git
      • MongoDB
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    Home»General Articles»How To Configure CORS in Amazon S3 Buckets

    How To Configure CORS in Amazon S3 Buckets

    RahulBy RahulJuly 22, 20221 Min ReadUpdated:July 22, 2022

    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.

    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:

      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12
      13
      14
      15
      16
      17
      18
      19
      20
      21
      22
      23
      24
      [
          {
              "AllowedOrigins": [
                  "*"
              ],
              "AllowedMethods": [
                  "GET"
              ],
              "MaxAgeSeconds": 3000,
              "ExposeHeaders": [
                   "Content-Range",
                   "Content-Length",
                   "ETag"
              ],
              "AllowedHeaders": [
                  "Authorization",
                  "Content-Range",
                  "Accept",
                  "Content-Type",
                  "Origin",
                  "Range"
              ]
          }
      ]

    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.

    aws CORS s3
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp
    Previous ArticleHow To Install phpMyAdmin on Ubuntu 22.04
    Next Article (Resolved) Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead

    Related Posts

    How to Import GPG Keys on Ubuntu & Debian (without apt-key)

    2 Mins Read

    Running a Cron job every Sunday (Weekly)

    2 Mins Read

    Scheduling a Python Script with Crontab

    2 Mins Read

    Running cron job every 12 hours (twice a day)

    Updated:August 2, 20221 Min Read

    (Resolved) Key is stored in legacy trusted.gpg Keyring

    Updated:August 9, 20222 Mins Read

    How to list all collections in MongoDB database

    1 Min Read

    Leave A Reply Cancel Reply

    Recent Posts
    • How to Import GPG Keys on Ubuntu & Debian (without apt-key)
    • How To Install Google Chrome On macOS
    • How to Install Minecraft on Ubuntu 22.04 & 20.04
    • Running a Cron job every Sunday (Weekly)
    • Running Multiple Commands At Once in Linux
    Facebook Twitter Instagram Pinterest
    © 2022 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.