In your ~/.s3cfg
[default]
access_key = ACCESS_KEY
host_base = ENDPOINT
host_bucket = YOUR_BUCKET_NAME.ENDPOINT
secret_key = SECRET_KEY
or you can configure with command s3cmd --configure for new or reconfig default s3cmd
- Set Policy create file policy.json
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "Statement1",
            "Effect": "Allow",
            "Principal": "*",
            "Action": [
                "s3:GetObject",
                "s3:PutObject",
                "s3:DeleteObject",
                "s3:GetObjectVersion"
            ],
            "Resource": "arn:aws:s3:::BUCKET_NAME/*"
        }
    ]
}
you can customize policy.json according to you needs.
open terminal
s3cmd setpolicy policy.json s3://BUCKET_NAME
- Set CORS create file cors.xml
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
    <CORSRule>
        <AllowedOrigin>*</AllowedOrigin>
        <AllowedMethod>GET</AllowedMethod>
        <AllowedMethod>POST</AllowedMethod>
        <AllowedMethod>DELETE</AllowedMethod>
        <AllowedMethod>PUT</AllowedMethod>
        <AllowedHeader>*</AllowedHeader>
    </CORSRule>
</CORSConfiguration>
Open terminal
s3cmd setcors cors.xml s3://BUCKET_NAME
 

 
    
Top comments (0)