Last active
March 11, 2016 14:49
-
-
Save huyanhvn/e605d74c492560e9f940 to your computer and use it in GitHub Desktop.
aws-s3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### SIZE OF S3 BUCKET | |
aws s3api list-objects --bucket BUCKETNAME --output json --query "[sum(Contents[].Size), length(Contents[])]” | |
### BUCKET POLICY FOR ENCRYPTED BUCKET | |
{ | |
"Version": "2012-10-17", | |
"Id": "PutObjPolicy", | |
"Statement": [ | |
{ | |
"Sid": "DenyUnEncryptedObjectUploads", | |
"Effect": "Deny", | |
"Principal": "*", | |
"Action": "s3:PutObject", | |
"Resource": "arn:aws:s3:::<bucket>/*", | |
"Condition": { | |
"StringNotEquals": { | |
"s3:x-amz-server-side-encryption": "aws:kms" | |
} | |
} | |
}, | |
{ | |
"Sid": "Stmt1451939383926", | |
"Effect": "Allow", | |
"Principal": "*", | |
"Action": "s3:ListBucket", | |
"Resource": "arn:aws:s3:::<bucket>", | |
"Condition": { | |
"StringEquals": { | |
"aws:username": "<role-account>" | |
} | |
} | |
}, | |
{ | |
"Sid": "Stmt1451939438665", | |
"Effect": "Allow", | |
"Principal": "*", | |
"Action": [ | |
"s3:GetObject", | |
"s3:PutObject" | |
], | |
"Resource": "arn:aws:s3:::<bucket>/*", | |
"Condition": { | |
"StringEquals": { | |
"aws:username": "<role-account>" | |
} | |
} | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment