Skip to main content

PutBucketCors

Example PutBucketCors request

Prepare a JSON file like this

{
  "CORSRules": [
    {
      "AllowedOrigins": ["http://www.example.com"],
      "AllowedMethods": ["PUT", "POST", "DELETE"],
      "AllowedHeaders": ["*"]
    },
    {
      "AllowedOrigins": ["*"],
      "AllowedMethods": ["GET"]
    }
  ]
}

Then apply it to the target bucket

user@host % aws s3api put-bucket-cors --bucket my_bucket --cors-configuration file://cors.json