Skip to content
IAM Policy Generator

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

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.

Open the workbench ยท All examples

{
  "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.

What it allows

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

    Action or patternActionsAccess levels
    s3:*180List 18, Read 66, Write 57, Permissions management 27, Tagging 12

Checks

No flags from the six checks.

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

Least privilege rewrite

{
  "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.

What it allows

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

    Action or patternActionsAccess levels
    s3:*180List 18, Read 66, Write 57, Permissions management 27, Tagging 12
  2. Deny 180 actions (s3:*) on arn:aws:s3:::amzn-s3-demo-bucket, arn:aws:s3:::amzn-s3-demo-bucket/* when s3:TlsVersion NumericLessThan 1.2.

    Action or patternActionsAccess levels
    s3:*180List 18, Read 66, Write 57, Permissions management 27, Tagging 12

Checks

No flags from the six checks.

Sources

  1. Amazon S3 User Guide: security best practices, read 16 Nov 2026
  2. Amazon S3 User Guide: bucket policy examples, read 16 Nov 2026
  3. AWS Service Authorization Reference, programmatic access (fetched 16 Nov 2026), read 16 Nov 2026

Last reviewed 16 Nov 2026.