Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brandongalbraith/d81aaa447e6440f3aa9a156f8abc7b9c to your computer and use it in GitHub Desktop.
Save brandongalbraith/d81aaa447e6440f3aa9a156f8abc7b9c to your computer and use it in GitHub Desktop.
AWS S3 Bucket Policy: Require TLS for data transport, enforce object encryption using any KMS key
{
"Version": "2012-10-17",
"Id": "PolicyIdentifierGUIDgoesHere",
"Statement": [{
"Action": "s3:*",
"Effect": "Deny",
"Principal": "*",
"Resource": "arn:aws:s3:::<bucketname>",
"Condition": {
"Bool": {
"aws:SecureTransport": false
}
}
}, {
"Action": "s3:*",
"Effect": "Deny",
"Principal": "*",
"Resource": "arn:aws:s3:::<bucketname>/*",
"Condition": {
"Bool": {
"aws:SecureTransport": false
}
}
}, {
"Sid": "DenyIncorrectEncryptionHeader",
"Effect": "Deny",
"Principal": "*",
"Action": "s3:PutObject",
"Resource": "arn:aws:s3:::<bucket_name>/*",
"Condition": {
"StringNotEquals": {
"s3:x-amz-server-side-encryption": "aws:kms"
}
}
}, {
"Sid": "DenyUnEncryptedObjectUploads",
"Effect": "Deny",
"Principal": "*",
"Action": "s3:PutObject",
"Resource": "arn:aws:s3:::<bucket_name>/*",
"Condition": {
"Null": {
"s3:x-amz-server-side-encryption": true
}
}
}]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment