# IAM policy example: deny S3 requests without TLS, with a least privilege rewrite

Facts read 16 Nov 2026. Page reviewed 16 Nov 2026.

Denies every S3 action on one bucket when the request does not use TLS, which the aws:SecureTransport condition key reports as false. The deny sits beside normal allow statements and wins over them. The rewrite adds a second deny for TLS versions below 1.2, using the s3:TlsVersion key.

```json
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "DenyInsecureTransport",
      "Effect": "Deny",
      "Action": "s3:*",
      "Resource": [
        "arn:aws:s3:::amzn-s3-demo-bucket",
        "arn:aws:s3:::amzn-s3-demo-bucket/*"
      ],
      "Condition": {
        "Bool": {
          "aws:SecureTransport": "false"
        }
      }
    }
  ]
}
```

## What it allows

- Denies all S3 actions on the bucket and its objects whenever the request is not sent over TLS.

- Denies 180 actions (s3:*) on arn:aws:s3:::amzn-s3-demo-bucket, arn:aws:s3:::amzn-s3-demo-bucket/* when aws:SecureTransport Bool false.

Checks:
- No flags.

Already scoped to one bucket and one condition; it does not stop old TLS versions that the service still negotiates.

## Least privilege rewrite

```json
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "DenyInsecureTransport",
      "Effect": "Deny",
      "Action": "s3:*",
      "Resource": [
        "arn:aws:s3:::amzn-s3-demo-bucket",
        "arn:aws:s3:::amzn-s3-demo-bucket/*"
      ],
      "Condition": {
        "Bool": {
          "aws:SecureTransport": "false"
        }
      }
    },
    {
      "Sid": "DenyOldTls",
      "Effect": "Deny",
      "Action": "s3:*",
      "Resource": [
        "arn:aws:s3:::amzn-s3-demo-bucket",
        "arn:aws:s3:::amzn-s3-demo-bucket/*"
      ],
      "Condition": {
        "NumericLessThan": {
          "s3:TlsVersion": "1.2"
        }
      }
    }
  ]
}
```

The rewrite adds a second deny for requests that use a TLS version below 1.2. Plain HTTP stays blocked by the first statement.

- Denies 180 actions (s3:*) on arn:aws:s3:::amzn-s3-demo-bucket, arn:aws:s3:::amzn-s3-demo-bucket/* when aws:SecureTransport Bool false.
- Denies 180 actions (s3:*) on arn:aws:s3:::amzn-s3-demo-bucket, arn:aws:s3:::amzn-s3-demo-bucket/* when s3:TlsVersion NumericLessThan 1.2.

Checks:
- No flags.

- [Paste it into the workbench](/)
- [Every S3 action and its access level](/actions/s3/)

## Related pages

- [IAM policy example: require KMS encryption on S3 uploads](/examples/s3-put-with-kms-encryption/)
- [IAM policy example: list S3 buckets in the console](/examples/s3-list-buckets-console/)
- [IAM policy example: upload to one S3 prefix](/examples/s3-upload-only-prefix/)
- [All of them](/examples/)

## Sources

- Amazon S3 User Guide: security best practices: https://docs.aws.amazon.com/AmazonS3/latest/userguide/security-best-practices.html (read 16 Nov 2026)
- Amazon S3 User Guide: bucket policy examples: https://docs.aws.amazon.com/AmazonS3/latest/userguide/example-bucket-policies.html (read 16 Nov 2026)
- AWS Service Authorization Reference, programmatic access (fetched 16 Nov 2026): https://docs.aws.amazon.com/service-authorization/latest/reference/service-reference.html (read 16 Nov 2026)

Last reviewed 16 Nov 2026. Canonical: https://iampolicygenerator.com/examples/s3-deny-non-tls-requests/

This site is not affiliated with Amazon Web Services. AWS service and product names are used only to describe AWS services.
