Prerequisites
Creating AWS S3 bucket Policy for AWS S3 bucket
The below policy has two statements which performs the below actions:
- Version is a standard date used in S3 policy.
- The Statement below restricts all the requests except HTTPS on the AWS S3 bucket ( my-bucket )
- Deny Here means it denies any requests that are not secure.
{
"Version": "2012-10-17",
"Statement": [{
"Sid": "RestrictToTLSRequestsOnly",
"Action": "s3:*",
"Effect": "Deny",
"Resource": [
"arn:aws:s3:::my-bucket",
"arn:aws:s3:::my-bucket/*"
],
"Condition": {
"Bool": {
"aws:SecureTransport": "false"
}
},
"Principal": "*"
}]
}
Conclusion
This tutorial demonstrated how to allow only HTTPS requests on AWS S3 buckets using AWS S3 Policy.