RousselTMLEARNING

Cloud computing

IAM: identities, roles and policies on AWS

Secure access to AWS with IAM: users, groups, roles and JSON policies, permission evaluation, MFA, IAM Identity Center for humans, roles for applications, and the principle of least privilege.

1. IAM identities #

Users, groups, roles.

Vocabulary #

NotionUsageGood practice
IAM userPermanent identity with a password or keysTo avoid for humans: prefer Identity Center
GroupGrouping users to attach policies to themNever attach a policy directly to a user
RoleIdentity assumed temporarily (person, service, other account)The default solution for applications
PolicyJSON document that allows or denies actionsLeast privilege, conditions

Humans and applications #

Access for humans and applications
Temporary credentials expire automatically: nothing to rotate or store.

2. Policies #

The JSON document that grants rights.

Anatomy of a policy #

{
  "Version": "2012-10-17",
  "Statement": [{
    "Sid": "LectureRapports",
    "Effect": "Allow",
    "Action": ["s3:GetObject", "s3:ListBucket"],
    "Resource": ["arn:aws:s3:::rapports-prod", "arn:aws:s3:::rapports-prod/*"],
    "Condition": { "Bool": { "aws:SecureTransport": "true" } }
  }]
}

Each statement specifies an effect (Allow or Deny), actions, resources (ARNs) and optionally conditions (source IP, MFA, tags, encryption in transit).

Evaluation #

IAM evaluation logic
Everything is denied by default; a single allow is enough, unless an explicit deny applies.
aws iam simulate-principal-policy \
  --policy-source-arn arn:aws:iam::123456789012:role/app \
  --action-names s3:GetObject --resource-arns arn:aws:s3:::rapports-prod/janvier.pdf

3. Best practices #

Least privilege in practice.

Rules #

  • MFA for all humans, root user locked down.
  • Identity Center and roles: no long-lived access keys on workstations or in code.
  • Start from AWS managed policies to explore, then write fine-tuned policies; IAM Access Analyzer suggests policies based on actual activity.
  • Separate accounts per environment and set SCPs (forbid disabling CloudTrail, limit regions).
  • Regularly review unused access (last accessed in the IAM console).
aws iam generate-credential-report && aws iam get-credential-report --query Content --output text | base64 -d | head
aws accessanalyzer list-findings --analyzer-arn <arn>

Related articles

Observability on AWS: CloudWatch, X-Ray, Application Signals, ADOT, Managed Prometheus and Grafana

A complete overview of observability on AWS: CloudWatch components (metrics, logs, alarms, Application Signal…

Understanding AWS: global infrastructure, accounts, tools and pricing

The essential basics for getting started with Amazon Web Services: regions, availability zones and points of …

AWS networking: VPC, subnets, routing and security

Design an AWS network: VPCs and CIDR ranges, public and private subnets, route tables, Internet and NAT gatew…

Keep learning

Support us

♥ SUPPORT US

Support RousselTM Learning

Courses, articles, labs and certificates stay free with no intrusive ads. A voluntary contribution, of any amount you choose, pays for hosting, lab environments and new content.

Contribute with PayPal Any amount · card or PayPal accountLearn more
QR code PayPal
Or scan this QR code with your phone

Thank you, every contribution counts!