I am testing S3 commands from EC2.
How to list all policies currently set for a specific bucket? (in AWS Web Console - I can see that json but want to do that trough AWS CLI)
Also - how to create S3 bucket trough CLI (from EC2) and attach all the policies via JSON (or by adding configuration commands)?
There is only one S3 policy per bucket. This command will display this policy:
aws s3api get-bucket-policy --bucket my-bucket
This command will create a bucket:
aws s3 mb s3://mybucket --region us-west-1
This command will create attach a policy to a bucket:
aws s3api put-bucket-policy --bucket mybucket --policy file://policy.json