Skip to main content
Beginner Technical Guide 10 min read AWS IAM / STS (SAA-C03 Aligned)

AWS IAM Policies, Roles & Least Privilege Guide (SAA-C03)

Understand how AWS evaluates IAM policies step-by-step and replace static access keys with temporary STS IAM Roles.

Written by Ravi Shankar Mishra (Founder & Lead Systems Architect, MockAttempt Academy) Reviewed by MockAttempt Engineering Editorial Desk
Last updated: Verification Policy

Learning Objectives

  • Apply the golden AWS policy evaluation rule: Explicit Deny > Explicit Allow > Implicit Deny.
  • Explain why EC2, Lambda, and ECS tasks should always assume short-lived IAM Roles instead of storing `.env` Access Keys.

Prerequisites

  • Basic AWS account familiarity and JSON syntax

How AWS Evaluates Every API Call

Before any S3, EC2, or DynamoDB API action executes inside AWS, IAM checks every attached Identity Policy, Resource Policy, Permission Boundary, and Organization SCP using strict order: start at Implicit Deny → any Explicit Deny blocks immediately → require at least one Explicit Allow.

Put IAM security into CI/CD pipelines via GitHub Actions AWS OIDC Guide or explore our AWS SAA-C03 Career Program.

Practical Programming Examples

Scoped Least-Privilege S3 Read + Enforce TLS Condition IAM Policy

Allow reading objects solely inside one S3 prefix while explicitly denying insecure non-HTTPS transport.

AWS IAM Policy Validator (SAA-C03)
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "AllowReadScopedPrefix",
      "Effect": "Allow",
      "Action": ["s3:GetObject"],
      "Resource": "arn:aws:s3:::ma-artifacts-prod/syllabi/*"
    },
    {
      "Sid": "DenyInsecureTransport",
      "Effect": "Deny",
      "Action": "s3:*",
      "Resource": [
        "arn:aws:s3:::ma-artifacts-prod",
        "arn:aws:s3:::ma-artifacts-prod/*"
      ],
      "Condition": {
        "Bool": { "aws:SecureTransport": "false" }
      }
    }
  ]
}
Expected Output
HTTPS GetObject under /syllabi/* succeeds; any plain HTTP call triggers Explicit Deny.
Step-by-Step Execution
  1. First statement limits allowed S3 action purely to `s3:GetObject` within the `/syllabi/*` key prefix.
  2. Second statement enforces encryption in transit (`aws:SecureTransport`) via Explicit Deny.

Common Mistakes to Avoid

  • Granting `Action: "s3:*"` and `Resource: "*"` temporarily during setup and leaving it in production.
  • Using AWS Root User credentials for daily console tasks instead of locking Root with MFA and working via least-privilege IAM Roles.

Production Best Practices

  • Scope both `Action` and `Resource` ARNs narrowly and audit unused access with IAM Access Analyzer.
  • Prefer IAM Roles / STS temporary tokens over long-lived IAM Access Keys everywhere.

Technical Interview Relevance

Tested heavily in AWS Solutions Architect (SAA-C03) interviews and Cloud Security technical screens.

Practice & Self-Check Questions

If an Identity Policy allows `s3:PutObject` while an S3 Bucket Policy denies the same caller, what happens?

The request is denied because an Explicit Deny anywhere across applicable policies always overrides any Explicit Allow.

Optional Next Step

Have Questions About Learning AWS Cloud Structured Cohorts?

Request the AWS-SAA-C03 syllabus & weekend batch schedule from an Academic Counselor.

View AWS-SAA-C03 Details →
Learn. Practise. Prove. Get Career-Ready.

Ready to Build Your IT Career?

Explore industry-led programmes and develop practical skills through training, assessments and interview preparation.