Skip to content

S3 policies

dweinholz edited this page Sep 18, 2023 · 1 revision

Setting up an S3 bucket

In OpenStack, create a container and click the checkbox to make it public.
Create a file called policy and insert:

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

Set the policy with, for example s3cmd s3cmd setpolicy policy s3://BUCKET_NAME. Create a file called cors and insert:

<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration>
 <CORSRule>
   <AllowedOrigin>*</AllowedOrigin>
   <AllowedMethod>GET</AllowedMethod>
   <AllowedMethod>HEAD</AllowedMethod>
   <AllowedMethod>PUT</AllowedMethod>
   <AllowedMethod>POST</AllowedMethod>
   <AllowedMethod>DELETE</AllowedMethod>
   <MaxAgeSeconds>3000</MaxAgeSeconds>
   <AllowedHeader>*</AllowedHeader>
   <ExposeHeader>ETag</ExposeHeader>
 </CORSRule>
</CORSConfiguration>

Set the cors configuration with, for example s3cmd s3cmd setcors cors s3://BUCKET_NAME.

Clone this wiki locally