AWS Core Services: IAM, S3, EC2 & VPC Cheat Sheet
The four pillars of Amazon Web Services in one desk-side sheet: how IAM controls who gets in, VPC draws the network walls, EC2 runs your servers, and S3 stores your files.
1 IAM Users, Roles, Policies & ARN Anatomy
IAM (Identity and Access Management) is AWS's global bouncer. Every API call is denied by default unless an IAM Policy explicitly allows it.
๐ค IAM User
A permanent identity for a human or legacy app with a password or long-lived Access Keys. Group users into IAM Groups to manage permissions cleanly.
๐ญ IAM Role
A temporary hat assumed by EC2, Lambda, or another AWS account. Uses short-lived tokensโno hardcoded passwords or keys!
๐ IAM Policy
A JSON document defining Effect (Allow/Deny),
Action (e.g., s3:GetObject), and Resource (ARN).
ARN Anatomy (Amazon Resource Name)
Every AWS resource has a unique global address called an ARN. You will paste ARNs into IAM policies, Terraform configs, and CLI commands.
aws-gov)
ec2, iam)
Essential IAM CLI Commands
aws sts get-caller-identity
aws iam list-users --output table
aws iam list-attached-user-policies --user-name dev-alice
aws iam attach-role-policy --role-name ec2-s3-role --policy-arn arn:aws:iam::aws:policy/AmazonS3ReadOnlyAccess
In IAM evaluation: Explicit Deny > Explicit Allow > Implicit Deny. Even if
a user has AdministratorAccess, one single "Effect": "Deny" statement
on an action blocks it completely.
2 EC2 Instances, Security Groups vs NACLs & EBS
EC2 (Elastic Compute Cloud) gives you virtual servers. Every EC2 instance needs a firewall (Security Group) and virtual hard drives (EBS Volumes).
Security Groups (SG) vs Network ACLs (NACL)
| Feature | Security Group (SG) | Network ACL (NACL) |
|---|---|---|
| Scope | Instance / ENI level (wraps around EC2) | Subnet level (wraps around the entire subnet) |
| Statefulness | Stateful (return traffic is auto-allowed) | Stateless (must allow inbound AND outbound) |
| Rule Types | Allow rules only (default deny all) | Allow AND Deny rules (processed by rule #) |
| Evaluation | Evaluates all rules before deciding | Evaluates in numerical order (lowest # wins) |
| Best Used For | Everyday app ports (HTTP 80, HTTPS 443, SSH 22) | Blocking specific malicious IP ranges at subnet edge |
๐พ EBS (Elastic Block Store)
Persistent network-attached hard drives for EC2 (like gp3 SSD). Tied to a
single Availability Zone. Back up with EBS Snapshots (stored in S3).
๐ท๏ธ EC2 Instance Families
t3/t4g = General burstable ยท c6i = Compute heavy ยท
r6i = Memory/RAM heavy ยท g5 = GPU/AI.
Essential EC2 CLI Commands
aws ec2 describe-instances --query "Reservations[*].Instances[*].[InstanceId,State.Name,PublicIpAddress]" --output table
aws ec2 run-instances --image-id ami-0c55b159cbfafe1f0 --instance-type t3.micro --key-name my-key --security-group-ids sg-01234567
t3.micro server with SSH key & SG.aws ec2 authorize-security-group-ingress --group-id sg-01234567 --protocol tcp --port 443 --cidr 0.0.0.0/0
aws ec2 create-snapshot --volume-id vol-0123456789abcdef0 --description "Pre-upgrade backup"
3 S3 Storage Classes & CLI Commands
Amazon S3 (Simple Storage Service) stores unlimited objects (files) up to 5 TB each with 99.999999999% (11 nines) durability. Bucket names must be globally unique.
| Storage Class | Best Use Case | Min Storage | Retrieval Speed |
|---|---|---|---|
| S3 Standard | Frequently accessed data, websites, active apps | None | Milliseconds |
| S3 Intelligent-Tiering | Unknown or changing access patterns (auto-moves tiers) | None | Milliseconds |
| S3 Standard-IA | Infrequently accessed backups, disaster recovery | 30 days | Milliseconds (per-GB fee) |
| S3 One Zone-IA | Re-creatable secondary backups (single AZ only) | 30 days | Milliseconds (cheaper) |
| S3 Glacier Instant | Rarely accessed archives needing instant read (medical/media) | 90 days | Milliseconds |
| S3 Glacier Flexible | Yearly archives, compliance logs | 90 days | Minutes to Hours |
| S3 Glacier Deep Archive | 7โ10 year legal/regulatory retention (lowest cost) | 180 days | 12โ48 Hours |
Essential S3 Copy & Sync Commands
aws s3 mb s3://shekharit-demo-2026 --region us-east-1
mb = Make Bucket. Name must be globally unique & lowercase.aws s3 cp ./backup.tar.gz s3://shekharit-demo-2026/backups/ --storage-class STANDARD_IA
aws s3 sync ./dist s3://shekharit-demo-2026/site --dryrun
--dryrun first.aws s3 presign s3://shekharit-demo-2026/report.pdf --expires-in 900
4 VPC Essentials: Subnets, IGW, NAT & CIDR
A VPC (Virtual Private Cloud) is your isolated private network inside an AWS Region. You split its IP range (CIDR block) into Subnets across Availability Zones.
๐ช Internet Gateway (IGW)
Two-way door between your VPC and the public internet. Required for any Public Subnet.
๐ NAT Gateway
One-way door in a Public Subnet that lets Private Subnet servers download updates without exposing them to inbound internet traffic.
๐งญ Route Tables
The GPS for each subnet. 10.0.0.0/16 โ local stays inside the VPC;
0.0.0.0/0 โ igw-xxx goes to the internet.
๐ข CIDR Block Math
/16 = 65,536 IPs (typical VPC). /24 = 256 IPs (251 usable in AWS,
since AWS reserves 5 IPs per subnet).
A subnet is NOT public just because you named it "public-subnet"! A subnet is
only Public if its Route Table has a route
0.0.0.0/0 โ igw-xxxx (Internet Gateway). If it routes 0.0.0.0/0 โ nat-xxxx
(or has no internet route), it is a Private subnet.
aws ec2 describe-vpcs --output table
aws ec2 describe-subnets --query "Subnets[*].[SubnetId,VpcId,CidrBlock,AvailabilityZone]" --output table
5 Danger Zone: Critical AWS Mistakes
The Root account has unrestricted access to everything, including closing your account or deleting billing history. Enable MFA on Root, lock away its credentials, and use an IAM Admin user or IAM Identity Center instead.
0.0.0.0/0
Allowing 0.0.0.0/0 on port 22 or 3389 exposes your server to automated
brute-force bots within minutes. Restrict SSH/RDP to your specific office/home IP
(/32), or better yet, use AWS Systems Manager Session Manager
with zero open inbound ports.
Keep S3 Block Public Access enabled at the account level. Always verify default encryption (SSE-S3 or SSE-KMS) is active so sensitive backups, customer PII, or logs are never exposed to the public internet.
A NAT Gateway charges ~$32/month per AZ even with zero traffic, and unattached EBS volumes continue billing after EC2 termination. Clean up unused NAT Gateways and orphaned volumes in lab accounts.