1. Amazon Resource Name (ARN)
Generic format for identifying any resource in AWS (users, groups, roles, buckets, instances, etc.):
arn:partition:service:region:account-id:resource
| Field |
Meaning |
Notes |
arn |
Literal prefix |
Always the same |
partition |
aws (or aws-cn for China, etc.) |
Fixed per environment |
service |
e.g. iam, s3, ec2, dynamodb |
|
region |
AWS region |
Left empty (just ::) for global services like IAM |
account-id |
12-digit AWS account number |
Found under your account/profile |
resource |
Depends on service |
Format varies per service — check documentation |
Examples
| Resource |
ARN pattern |
| The account itself (root) |
arn:aws:iam::ACCOUNT_ID:root (note: "root" here means the account, not the root user) |
| All IAM users in an account |
arn:aws:iam::ACCOUNT_ID:user/* |
| A specific IAM user |
arn:aws:iam::ACCOUNT_ID:user/Ahmed |
| A specific IAM group |
arn:aws:iam::ACCOUNT_ID:group/administrators |
| A specific IAM role |
arn:aws:iam::ACCOUNT_ID:role/RoleName |
| A specific EC2 instance |
arn:aws:ec2:REGION:ACCOUNT_ID:instance/* (region is included for EC2, unlike IAM) |
| A specific DynamoDB table |
arn:aws:dynamodb:REGION:ACCOUNT_ID:table/Books (or table/* for all tables) |
- ARN format is documented per-service (like an API reference) — not meant to be memorized, becomes familiar with practice.
- Wildcards () can be used to represent "all" of a resource type.
2. IAM Policy Structure (JSON)
- A policy = one or more Statements.
- Each statement contains:
| Element |
Meaning |
Effect |
Allow or Deny |
Action |
service:ActionName (e.g. ec2:RunInstances, s3:* for all S3 actions) |
Resource |
ARN of the target resource, or * for all resources |
Condition (optional) |
Extra requirement that must be True for the statement to take effect |
Common Action service prefixes seen in exam
iam:, s3:, ec2:, dynamodb:, ds: (Directory Services — e.g. Microsoft Active Directory in AWS), kms:, logs: (CloudWatch Logs), etc.
3. Identity-Based vs Resource-Based Policies
|
Identity-Based Policy |
Resource-Based Policy |
| Attached to |
IAM User, Group, or Role |
A resource (e.g. S3 bucket, SNS topic, SQS queue, VPC endpoint) |
Contains a Principal element? |
No (principal is implicit — it's whoever the policy is attached to) |
Yes — must specify who is allowed |
| Reusable across multiple identities? |
Yes (Managed policies) |
No — always inline to that one resource |
| Which services support it? |
All |
Only some services (not EC2, not DynamoDB — mainly S3, SNS, SQS, VPC endpoints, etc.) |
Policy attachment types (Identity-based)