AWS CLF-C02 — Domain 2: Security & Compliance
IAM is a global service. Users, groups, roles, and policies you create are available across all AWS Regions.
"How do you grant an EC2 instance permission to access S3?" → Create an IAM Role and attach it to the EC2 instance. Never use access keys on an EC2 instance.
| Feature | Root User | IAM User |
|---|---|---|
| Created when | AWS account is first created | Created by root or IAM admin |
| Access | Full, unrestricted access to everything | Only what policies allow |
| Can be restricted | No — cannot be limited by IAM policies | Yes — controlled by policies |
| Best practice | Lock it away, enable MFA, don't use for daily tasks | Use for everyday tasks |
If a question asks what can ONLY be done by the root user, remember: closing the account, changing support plans, and configuring MFA Delete on S3 are root-only tasks.
An IAM policy is a JSON document with these key elements:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowS3ReadAccess",
"Effect": "Allow",
"Action": [
"s3:GetObject",
"s3:ListBucket"
],
"Resource": [
"arn:aws:s3:::my-bucket",
"arn:aws:s3:::my-bucket/*"
],
"Condition": {
"IpAddress": {
"aws:SourceIp": "203.0.113.0/24"
}
}
}
]
}
| Element | Description | Required? |
|---|---|---|
Version | Policy language version. Always use "2012-10-17" | Yes |
Statement | Array of individual statements (permissions) | Yes |
Sid | Statement ID — optional identifier for the statement | No |
Effect | "Allow" or "Deny" | Yes |
Action | List of API actions the policy allows or denies | Yes |
Resource | ARN of the resource(s) the actions apply to | Yes |
Condition | Conditions for when the policy is in effect | No |
An explicit Deny always overrides an Allow. If any policy denies an action, it is denied regardless of any Allow statements.
| Type | Description | Use Case |
|---|---|---|
| AWS Managed Policies | Pre-built policies created and maintained by AWS | Common use cases (e.g., AmazonS3ReadOnlyAccess) |
| Customer Managed Policies | Policies you create and manage yourself | Custom, fine-grained permissions specific to your needs |
| Inline Policies | Policies embedded directly in a single user, group, or role | Strict one-to-one relationship; deleted when the entity is deleted |
AWS recommends using Customer Managed Policies over inline policies because they are reusable and easier to manage. AWS Managed Policies are great starting points but may be overly permissive.
MFA adds an extra layer of security beyond just a password: something you know (password) + something you have (MFA device).
| MFA Type | Description |
|---|---|
| Virtual MFA Device | Apps like Google Authenticator, Authy, or Microsoft Authenticator. Supports multiple tokens on a single device. |
| Universal 2nd Factor (U2F) Security Key | Physical device like YubiKey. Supports multiple root and IAM users with a single key. |
| Hardware Key Fob MFA | Physical token device (e.g., Gemalto). Generates a 6-digit code. |
| Hardware Key Fob for GovCloud | Special key fob provided by SurePassID for AWS GovCloud (US). |
MFA should be enabled on the root account and all IAM users with console access. This is a critical best practice and frequently tested.
| Feature | Console Password | Access Keys |
|---|---|---|
| Used for | AWS Management Console (web browser) | AWS CLI & SDK (programmatic access) |
| Components | Username + password (+ optional MFA) | Access Key ID + Secret Access Key |
| Generated by | Set during user creation | Generated separately; can only be viewed once |
| Security | Can enforce password policy | Treat like passwords — never share or commit to code |
Access keys are not the same as a password. A user can have up to two active access keys. The Secret Access Key is shown only once at creation — if lost, you must create new keys.
| Tool | Scope | Description |
|---|---|---|
| IAM Credentials Report | Account-level | Lists all IAM users and the status of their credentials (passwords, access keys, MFA). Useful for auditing. |
| IAM Access Advisor | User-level | Shows the services a user has accessed and when they last accessed them. Helps you identify and remove unused permissions. |
"Which tool helps you identify unused permissions?" → IAM Access Advisor. "Which tool provides a credential audit for all users?" → IAM Credentials Report.
The Principle of Least Privilege means giving a user only the access they need to perform their job — nothing more. This is the single most important IAM best practice.