Intermediate · Cloud security basics · topic 29 of 43 · 35 min
Cloud identity and access management
Explanation
Why cloud IAM is critical
In a data centre, an attacker needs to get onto your network first. In the cloud, the management console and APIs are on the internet. Anyone with a valid admin password or access key can create servers, read every database and delete backups from anywhere in the world. That is why identity and access management (IAM) is the most important cloud control.
Key words
| Word | Meaning |
|---|---|
| Root user / account owner | The first, all-powerful identity of a cloud account. Use only for a few special tasks |
| User | An identity for a person |
| Group | A set of users that share permissions |
| Role | A set of permissions that a person or program can take on temporarily |
| Policy | A document that says which actions are allowed or denied on which resources |
| Access key | A long-lived ID and secret that programs use to call cloud APIs |
| Service account / managed identity | An identity for a program, not a person |
Reading a policy
In AWS, permissions are JSON policy documents. Each statement has an Effect (Allow or Deny), Actions (what can be done) and Resources (on what). Here is a least-privilege policy that lets an app only read invoice files from one bucket:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": ["s3:GetObject"],
"Resource": "arn:aws:s3:::invoices-bucket/*"
}
]
}{
"Version": "2012-10-17",
"Statement": [
{ "Effect": "Allow", "Action": "*", "Resource": "*" }
]
}Azure uses role-based access control (Azure RBAC) with built-in roles like Owner, Contributor and Reader, assigned to Microsoft Entra ID users, groups or managed identities at a scope (subscription, resource group or resource). Google Cloud has IAM roles assigned to principals on projects and resources. The ideas are the same.
Good cloud IAM habits
- Lock away the root/owner account: strong password, MFA (ideally a hardware key), no access keys, used only for the few tasks that need it.
- MFA for every human user, especially admins.
- Use single sign-on from the company identity provider so leavers lose access everywhere at once.
- Least privilege: start with nothing and add only what is needed. Use built-in "Reader" style roles for people who only look.
- Prefer roles with temporary credentials for programs (for example an IAM role on a server, or a managed identity) instead of long-lived access keys.
- If access keys must exist: rotate them, never put them in code, and delete unused ones.
- Review permissions regularly; cloud tools can show permissions that have not been used for 90 days.
$ aws iam list-access-keys --user-name build-bot
{
"AccessKeyMetadata": [
{
"UserName": "build-bot",
"AccessKeyId": "AKIAIOSFODNN7EXAMPLE",
"Status": "Active",
"CreateDate": "2023-01-09T06:31:10+00:00"
}
]
}Common mistakes
- Using the root account for daily work.
- Giving developers full admin "to move fast".
- Access keys in source code, mobile apps or shared spreadsheets.
- Forgetting service accounts in access reviews; they often have the most power.
Need help?
Stuck on a word or an idea? Search this course, or every course, and jump straight to the explanation or a worked question.
Try:
Watch the lesson
Cloud identity and access management · 1/6
Cloud consoles and APIs are on the internet. Whoever holds an admin login controls the account.
Prefer a video by a teacher? Find free videos on “AWS IAM best practices roles policies least privilege explained” on YouTube ↗
In real life: A leaked key and a crypto-mining bill
A college student's project pushed an access key for a personal cloud account to a public repository. Within hours, bots found it and started dozens of powerful virtual machines in several regions to mine cryptocurrency. The student woke up to a huge bill. Cloud providers sometimes waive such charges for first incidents, but not always. The fixes: never put keys in code, use MFA on the account, set billing alerts, and give keys only the narrow permissions they need.
Practice (0/3 done)
What should the root or owner account of a cloud account be used for?
Write admin_statements(policy) where policy is a dict like an AWS policy. Return the number of statements with Effect "Allow" whose Action is "*" (or a list containing "*") AND whose Resource is "*" (or a list containing "*").
Write old_keys(keys, today, max_days) where keys is a list of dicts with "id", "status" ("Active" or "Inactive") and "created" (a datetime.date). Return a sorted list of ids of ACTIVE keys older than max_days days.
Quick quiz
Read more (free)
Related help
Before this, learn
This topic builds on these. If something here feels new, open them first.
Related topics
- Common cloud misconfigurationsCloud security basics · same module
- Logging and monitoring in the cloudCloud security basics · same module
- IAM: users, groups, roles and least privilegeCloud Computing (AWS, Azure, Google Cloud) · AWS account, IAM and billing
- Identity is the new perimeterCloud Computing (AWS, Azure, Google Cloud) · Cloud security and compliance
- Microsoft Entra ID and Azure RBACCloud Computing (AWS, Azure, Google Cloud) · Microsoft Azure essentials
- Google Cloud structure: projects, billing and IAMCloud Computing (AWS, Azure, Google Cloud) · Google Cloud and comparing the clouds
Questions people ask about this
Open a question to see the answer and why. The first ones are this topic's own quiz, so try the quiz above before you peek.
What does a cloud IAM policy define?
Answer: Which actions are allowed or denied on which resources
Policies are the permission rules.
Why are roles with temporary credentials better than access keys for apps?
Answer: Credentials expire automatically, so a leak is useful for a short time only
Short-lived credentials shrink the window of misuse.
Which Azure built-in role lets someone look but not change?
Answer: Reader
Reader gives view-only access.
An access key is found in a public GitHub repo. First step?
Answer: Deactivate or rotate the key immediately, then check what it was used for
Kill the key first, then investigate its activity in the cloud logs.
Which identity type is meant for programs, not people?
Answer: Service account or managed identity
Service accounts and managed identities are for workloads.
Which IAM identity gives temporary credentials and is the right choice for a Lambda function?Related
Answer: IAM role
Lambda runs with an execution role; AWS supplies temporary credentials.
Developers may create their own IAM roles, but never more powerful than a set limit. What enforces that limit?Related
Answer: A permissions boundary
A permissions boundary caps the permissions of the users or roles it is set on.
What is least privilege?Related
Answer: Each account gets only the access its job needs
Minimum access limits damage when an account is misused.
From Identity and access management, least privilege and RBAC
What is the difference between Entra roles and Azure roles?Related
Answer: Entra roles manage the directory (users, apps); Azure roles manage Azure resources
Global Administrator is an Entra role; Owner and Contributor are Azure roles. They are separate systems.
Pass the quiz (60% or more) or mark this topic as done when you are ready.
Your progress is saved on this device only.
Next steps
- 2 more topics in “Cloud security basics” before its exam: Common cloud misconfigurations, Logging and monitoring in the cloud.
- Module 7 exam: Cloud security basics · 12 questions · 20 min, without help. 4 topics of this module still to finish first.
- Then the next module, Governance, risk and compliance. 43 topics left in the course before the final exam.