โšก โ˜๏ธ AWS Policy Generator
AWS CLOUD SUITE โ€ข 100% CLIENT-SIDE LEAST PRIVILEGE ENGINE

โ˜๏ธ AWS IAM & S3 Bucket Policy Generator

Visually generate secure, production-ready AWS IAM and S3 Bucket JSON policies. Configure least-privilege permissions, cross-account access, CloudFront OAC, and IP restrictions with zero syntax errors.

Quick Presets:
412 Bytes 2 Actions
For bucket-level permissions, include bucket name; for objects, append /*

        

๐Ÿ›ก๏ธ Architectural Overview: AWS IAM & S3 Security Architecture

AWS Identity and Access Management (IAM) and Amazon S3 Bucket Policies represent the foundation of public cloud infrastructure security. In modern cloud engineering, misconfigured IAM permissions are the single leading cause of accidental cloud data breaches. An S3 bucket policy is a resource-based policy written in JavaScript Object Notation (JSON) that grants or restricts access permissions to the bucket and objects stored within it. WebDevWorker's AWS IAM & S3 Policy Builder enforces strict syntax adherence to the official AWS 2012-10-17 policy grammar, preventing invalid actions, malformed wildcards, and unquoted ARNs. Client-side evaluation ensures your enterprise infrastructure credentials, account numbers, and bucket topologies remain isolated in your local browser sandbox.

๐Ÿ“ Formal Mathematical Grammar & IAM Evaluation Logic

AWS Policy Evaluation Algorithm: Decision = DefaultDeny โˆง (ExplicitDeny ? Deny : (ExplicitAllow ? Allow : Deny)) Grammar Specification: Policy := { "Version": "2012-10-17", "Statement": [ Statement+ ] } Statement := { "Sid"?: String, "Effect": "Allow" | "Deny", "Principal": "*" | { "AWS"|"Service"|"Federated": String | String[] }, "Action": String | String[], "Resource": ARN | ARN[], "Condition"?: { Operator: { ContextKey: Value } } }

๐Ÿ’ป Production Python (Boto3) & Terraform Policy Attachment

# 1. Terraform S3 Bucket Policy Resource
resource "aws_s3_bucket_policy" "production_policy" {
  bucket = aws_s3_bucket.main.id
  policy = jsonencode({
    Version = "2012-10-17"
    Statement = [
      {
        Sid       = "AllowCloudFrontServicePrincipalReadOnly"
        Effect    = "Allow"
        Principal = {
          Service = "cloudfront.amazonaws.com"
        }
        Action   = "s3:GetObject"
        Resource = "${aws_s3_bucket.main.arn}/*"
      }
    ]
  })
}

# 2. Python Boto3 Client Policy Deployment
import boto3, json

s3_client = boto3.client('s3')
policy_document = {
    "Version": "2012-10-17",
    "Statement": [{
        "Sid": "EnforceTLSRequestsOnly",
        "Effect": "Deny",
        "Principal": "*",
        "Action": "s3:*",
        "Resource": ["arn:aws:s3:::my-bucket", "arn:aws:s3:::my-bucket/*"],
        "Condition": {"Bool": {"aws:SecureTransport": "false"}}
    }]
}
s3_client.put_bucket_policy(Bucket='my-bucket', Policy=json.dumps(policy_document))

๐Ÿ“‹ Step-by-Step Enterprise AWS Deployment Guide

  1. Step 1: Select your required permission template (e.g. Read-Only Static Site, App Upload Worker, or CloudFront OAC).
  2. Step 2: Replace the placeholder bucket name with your verified AWS S3 bucket ARN (e.g., arn:aws:s3:::company-asset-production).
  3. Step 3: Toggle specific required actions (such as s3:GetObject or s3:PutObject) while avoiding hazardous wildcards like s3:*.
  4. Step 4: Configure optional CIDR IP whitelists to ensure admin operations originate strictly from your corporate VPN or office network.
  5. Step 5: Click Copy Policy and paste into the AWS Management Console (S3 -> Permissions -> Bucket Policy) or your Terraform configuration pipeline.

โ“ Frequently Asked Questions (FAQ)

What is the difference between an IAM Policy and an S3 Bucket Policy?

An IAM policy is an identity-based policy attached to an IAM user, group, or role defining what that identity can do. An S3 bucket policy is a resource-based policy attached directly to an S3 bucket controlling who (which accounts or users) can access that specific bucket.

Why does s3:ListBucket require the bucket ARN without /*?

s3:ListBucket is a bucket-level action that operates on the container itself (arn:aws:s3:::bucket-name). In contrast, s3:GetObject and s3:PutObject operate on individual objects within the bucket and require the wildcard suffix (arn:aws:s3:::bucket-name/*).

How does CloudFront Origin Access Control (OAC) replace OAI?

CloudFront OAC is the modern AWS standard replacing deprecated Origin Access Identity (OAI). It supports all S3 buckets in all regions, encrypted S3 transfers, and dynamic request signing using AWS SigV4.

Can an explicit Deny in an S3 Bucket Policy override an IAM Allow?

Yes. In the AWS policy evaluation logic, an explicit Deny always trumps any number of explicit Allows, regardless of whether the Allow was defined on an IAM identity or a resource policy.

How can I require all S3 traffic to be encrypted in transit?

Add a Statement with Effect Deny, Action s3:*, and a Condition block using Bool: { aws:SecureTransport: false }. This immediately blocks all unencrypted HTTP requests.

Does this generator transmit my AWS bucket ARNs to a remote server?

No. WebDevWorker runs completely inside your client browser memory sandbox. Zero network telemetry is generated, and your ARNs never leave your local machine.

โš ๏ธ Production Best Practices & Security Anti-Patterns

  • 1. Adhere strictly to the Principle of Least Privilege: Never assign s3:* or AdministratorAccess to public-facing roles.
  • 2. Always enforce HTTPS via aws:SecureTransport: false Deny statements to comply with SOC2, HIPAA, and PCI-DSS.
  • 3. Use specific Resource ARNs rather than wildcard * to prevent accidental exposure of neighboring production buckets.