Setting up the Bucket Policy from the json file:
aws s3api put-bucket-policy --profile test_user --endpoint-url https://s3.cl2.du.cesnet.cz --bucket BUCKET-NAME --policy file://C:/Users/User/Downloads/example_policy_tenant-ro.json
aws s3api put-bucket-policy --profile test_user --endpoint-url https://s3.cl2.du.cesnet.cz --bucket BUCKET-NAME --policy file:///home/user/Downloads/example_policy_tenant-ro.json
Listing of Bucket Policy on the desired bucket:
aws s3api get-bucket-policy --profile test_user --endpoint-url https://s3.cl2.du.cesnet.cz --bucket BUCKET-NAME
Removing Bucket Policy on the desired bucket:
aws s3api delete-bucket-policy --profile test_user --endpoint-url https://s3.cl2.du.cesnet.cz --bucket BUCKET-NAME
Setting up the Bucket Policy from the json file::
s3cmd -c ~/.s3cfg_test_user setpolicy /home/user/bucket_policy.json s3://BUCKET-NAME
Listing of Bucket Policy on the desired bucket:
s3cmd -c ~/.s3cfg_test_user info s3://BUCKET-NAME
Removing Bucket Policy on the desired bucket:
s3cmd -c ~/.s3cfg_test_user delpolicy s3://BUCKET-NAME
Below are listed 3 general examples of Bucket Policy. It goes about sharing within tenant/group with read-only and read-write and then public-sharing for everyone.
"keys": [ { "user": "354dasf3_db44_4dsa_a9b9_24ae65476$136aadsdas57d4asdrt5hzuuzc", "access_key": "hash_access_key_hash", "secret_key": "hash_secret_key_hash" } ]
{ "Statement":[ { "Sid":"* on bucket-tenant-ro policy", "Effect":"Allow", "Principal": {"AWS": ["354dasf3_db44_4dsa_a9b9_24ae65476"]}, "Action": ["s3:ListBucket","s3:GetObject"], "Resource":[ "arn:aws:s3:::BUCKET-NAME", "arn:aws:s3:::BUCKET-NAME/*" ] } ] }
{ "Statement":[ { "Sid":"* on bucket-tenant-rw policy", "Effect":"Allow", "Principal": {"AWS": ["354dasf3_db44_4dsa_a9b9_24ae65476"]}, "Action": ["s3:ListBucket","s3:GetObject","s3:PutObject","s3:DeleteObject"], "Resource":[ "arn:aws:s3:::BUCKET-NAME", "arn:aws:s3:::BUCKET-NAME/*" ] } ] }
{ "Statement":[ { "Sid":"* on bucket-tenant-public policy", "Effect":"Allow", "Principal": "*", "Action": ["s3:ListBucket","s3:GetObject"], "Resource":[ "arn:aws:s3:::BUCKET-NAME", "arn:aws:s3:::BUCKET-NAME/*" ] } ] }
https://s3.cl2.du.cesnet.cz/354dasf3_db44_4dsa_a9b9_24ae65476:BUCKET-NAME/
CESNET, z. s. p. o.
Generála Píky 26
16000 Prague 6
Tel: +420 234 680 222
Fax: +420 224 320 269
info@cesnet.cz
Tel: +420 234 680 222
GSM: +420 602 252 531
Fax: +420 224 313 211
support@cesnet.cz