Skip to content
Visual explainer 3h to learn 4 steps

Shared responsibility & cloud IAM

Say which security tasks belong to you vs the provider and lock down cloud identities.

By Invicly Tech, , in Cyber Security Fundamentals. About 10 minutes to read.

Topic 42 of 49

In short

In the cloud, security duties are split between the provider and you. The provider secures the underlying infrastructure; you secure your data, identities and configuration. The split shifts with the service model, and identity is the new perimeter.

Explained simply

When you use the cloud, you rent computers in someone else's data centre. The provider, such as AWS, Microsoft Azure or Google Cloud, protects the buildings, the hardware and the software that runs their platform. You protect what you put on it: your data, your accounts and your settings.

AWS sums it up like this: the provider is responsible for security of the cloud, and you are responsible for security in the cloud. Most cloud breaches happen on the customer side, through a weak password, a leaked key or a setting left open.

How much is yours depends on the service type. With IaaS (infrastructure as a service), such as a virtual machine, you patch the operating system. With PaaS (platform as a service), such as a managed database, the provider patches it. With SaaS (software as a service), such as Microsoft 365, you mostly manage users, data and sharing.

In every model, identity is yours. Whoever controls your cloud accounts controls everything you built. So protecting the top-level account, using MFA everywhere and replacing permanent keys with short-lived credentials are the first jobs in cloud security.

Press Play on a diagram to walk through it one step at a time.

CompareWho secures what
Provider
  • Physical data centres
  • Host and hypervisor
  • Managed service internals
  • Global network
You
  • Your data
  • Identity and access
  • Configuration
  • App-level security
CompareLong-lived keys vs roles
Access keys (AKIA...)
  • Valid until rotated or deleted
  • Stored in files, env vars, CI secrets
  • Leaks are found and abused fast
  • Rotation is manual work
Roles (ASIA... temporary)
  • Expire after 15 min to 12 h
  • Nothing permanent to steal
  • Every assume is logged in CloudTrail
  • Trust policy controls who can assume

In depth

IaaS, PaaS and SaaS: where the line moves

Picture a stack: data centre, hardware, virtualisation, operating system, runtime, application, data and identity. The provider always owns the bottom layers and you always own the top ones. The service model decides where the line falls in between.

With IaaS, such as an EC2 or Azure virtual machine, the provider stops at the hypervisor. You patch the guest operating system, configure its firewall, install agents and secure the app. With PaaS, such as Amazon RDS or Azure App Service, the provider also patches the operating system and the database or runtime, but you still choose network access, who can log in, whether encryption and backups are on, and you secure your code. With SaaS, nearly everything technical is the provider's, yet you still own user accounts, MFA, sharing settings and the data people upload. Misconfigured sharing in SaaS is a common source of leaks.

CompareWhat you still handle in each model
IaaS (VM)
  • Guest OS patches
  • Host firewall and agents
  • App and data
  • Identity and network rules
PaaS (managed DB)
  • Network access rules
  • Database users and roles
  • Encryption and backup settings
  • Your code and data
SaaS (Microsoft 365)
  • User accounts and MFA
  • Sharing and retention settings
  • Data people upload
  • Admin roles

Securing the root or owner account

Every cloud has one all-powerful identity. In AWS it is the root user, the email address that created the account. It can do anything, including close the account, and IAM policies in that account cannot limit it. In Microsoft Entra ID the top role is Global Administrator; in Google Cloud it is the super admin of the organisation.

Protect it carefully: a long unique password in a password manager, MFA with a hardware security key or passkey, no access keys ever, and current contact details so the provider can reach you. Use root only for the few tasks that require it, and alert on every root sign-in. In AWS Organizations, you can now remove root credentials from member accounts centrally. In Entra ID, keep two emergency (break-glass) accounts with strong credentials, store them safely and alert whenever they are used.

  • aws iam get-account-summary: AccountMFAEnabled should be 1
  • AccountAccessKeysPresent should be 0 (no root keys)
  • Alert on ConsoleLogin events where the user type is Root

Roles and short-lived credentials

An IAM user's access key (IDs starting with AKIA) works until someone rotates or deletes it. If it is pushed to a public Git repository, automated scanners can find and abuse it within minutes. A role is different: you assume it and AWS STS hands you temporary credentials (IDs starting with ASIA) that expire, by default after 1 hour and configurable from 15 minutes up to 12 hours.

Use roles everywhere. People sign in through single sign-on, such as IAM Identity Center with aws sso login. EC2 instances get an instance profile, Lambda functions an execution role, and Kubernetes pods use EKS Pod Identity or IRSA. CI pipelines use OIDC federation, so GitHub Actions or GitLab can get temporary credentials without any stored secret. Azure has managed identities, and Google Cloud has attached service accounts and Workload Identity Federation, which avoid downloadable service account keys.

SequenceGitHub Actions gets AWS credentials with OIDC
CI job
GitHub OIDC
AWS STS
  1. 1Request a signed ID token
    CI job to GitHub OIDC: Request a signed ID token
  2. 2Token: repo, branch, audience
    GitHub OIDC to CI job: Token: repo, branch, audience
  3. 3AssumeRoleWithWebIdentity with token
    CI job to AWS STS: AssumeRoleWithWebIdentity with token
  4. 4Check trust policy: aud and sub match
    AWS STS to AWS STS: Check trust policy: aud and sub match
  5. 5Temporary credentials, about 1 hour
    AWS STS to CI job: Temporary credentials, about 1 hour

Least privilege and how AWS evaluates a request

AWS starts from deny. A request is allowed only if some policy explicitly allows it, and an explicit deny anywhere always wins. Several layers can apply: service control policies (SCPs) from AWS Organizations set the maximum for a whole account, permission boundaries cap what a role can ever get, identity policies and resource policies grant access, and session policies can narrow it further.

Write policies for the job, not for convenience. Avoid Action "*" with Resource "*". Use conditions, such as requiring MFA with aws:MultiFactorAuthPresent or limiting to your network with aws:SourceIp. IAM Access Analyzer helps in two ways: it flags resources shared outside your account or organisation, and it can generate a policy from the actions a role actually used in CloudTrail. Review unused roles and permissions regularly; access that nobody uses is pure risk.

  • Explicit deny always beats allow
  • SCPs limit accounts; they never grant access
  • Grant to roles or groups, not to individual users

Learn it in 4 short steps

About 45m each. Track them with a timer in your plan.

  1. 1
    Explain the shared responsibility model~45m
  2. 2
    Compare IaaS, PaaS and SaaS duties~45m
  3. 3
    Secure the root or owner account~45m
  4. 4
    Use roles instead of long-lived keys~45m

Key points

  • Security is shared between provider and customer.
  • You always own your data, identities and configuration.
  • The split shifts across IaaS, PaaS and SaaS.
  • Prefer roles over long-lived access keys.

Key terms

Tap a card to flip it. 0/4 known

Examples

Checking root and key hygiene in an AWS account

You join a team and want a quick view of identity risk. Step 1: confirm which account and identity you are using. Step 2: check that the root user has MFA and no access keys. Step 3: generate the IAM credential report and print, for each user, whether they have a password, MFA, and an active first access key with its rotation date. Users with an active key but no recent use, or keys older than 90 days, go on the clean-up list. The <root_account> row in the report shows root's own status.

bash
aws sts get-caller-identity
aws iam get-account-summary \
  --query 'SummaryMap.{RootMFA:AccountMFAEnabled,RootKeys:AccountAccessKeysPresent}'
aws iam generate-credential-report
aws iam get-credential-report --query Content --output text | base64 -d \
  | cut -d, -f1,4,8,9,10 | column -t -s,
# columns: user, password_enabled, mfa_active,
#          access_key_1_active, access_key_1_last_rotated

Letting GitHub Actions deploy without stored keys

Step 1: add GitHub as an OIDC identity provider in IAM (token.actions.githubusercontent.com, audience sts.amazonaws.com). Step 2: create a deploy role whose trust policy accepts tokens only from your repository's main branch. Step 3: in the workflow, set permissions: id-token: write and use the aws-actions/configure-aws-credentials action with role-to-assume set to the role ARN. Now no secret key exists anywhere, and a token from another repository or branch is rejected by the sub condition.

json
{
  "Version": "2012-10-17",
  "Statement": [{
    "Effect": "Allow",
    "Principal": { "Federated": "arn:aws:iam::111122223333:oidc-provider/token.actions.githubusercontent.com" },
    "Action": "sts:AssumeRoleWithWebIdentity",
    "Condition": {
      "StringEquals": {
        "token.actions.githubusercontent.com:aud": "sts.amazonaws.com",
        "token.actions.githubusercontent.com:sub": "repo:acme/web:ref:refs/heads/main"
      }
    }
  }]
}

Quick reference

  • Provider: security OF the cloud. You: security IN the cloud (data, identity, configuration)
  • IaaS: you patch the OS. PaaS: provider patches the platform. SaaS: you manage users and sharing
  • Root or owner account: MFA with a security key, no access keys, used only when required
  • Root check: aws iam get-account-summary shows AccountMFAEnabled and AccountAccessKeysPresent
  • Access key IDs starting AKIA are long-lived; ASIA means temporary STS credentials
  • Role sessions last 15 minutes to 12 hours; the default is 1 hour
  • AWS policy logic: default deny, explicit allow needed, explicit deny always wins
  • CI to cloud: use OIDC federation instead of storing access keys as secrets

Quick quiz

Pick an answer to see if you're right and why.

Question 1

1You run your own database on an EC2 virtual machine (IaaS). Who patches the operating system?

Question 2

2Why are IAM roles safer than long-lived access keys?

Question 3

3An identity policy allows s3:GetObject, but an SCP on the account denies it. What happens?

Question 4

4Which root account practice is correct?

0/4 answered

Practice exercises

Try each one yourself first. Use the hint if you get stuck, then compare with the solution.

  1. Exercise 1easy

    In a personal or lab AWS account, confirm who you are and check whether the root user has MFA and access keys.

  2. Exercise 2medium

    Write an IAM policy that lets a reporting role list and read objects in the bucket acme-reports, and nothing else.

  3. Exercise 3hard

    Using the IAM credential report, list every user whose first access key is active and older than 90 days.

Check yourself

Answer in your head, reveal, then be honest with yourself.

Feel confident about this topic?

Frequently asked questions

Is the cloud less secure than my own data centre?
Not by nature. Big providers secure their infrastructure better than most companies can, but they give you powerful settings that are easy to get wrong. Most cloud incidents are customer misconfigurations, not provider failures.
Who is responsible if a public storage bucket leaks data?
The customer. The provider gives you the controls, such as Block Public Access, but choosing and checking the settings is your job.
What is a break-glass account?
An emergency admin account used only when normal sign-in fails, for example if single sign-on or MFA is broken. It has very strong, safely stored credentials and triggers an alert whenever it is used.
Should I ever use access keys?
Avoid them when a role or federation option exists, which is almost always. If you must use one, give it the narrowest permissions, store it in a secrets manager, rotate it and monitor its use.

Go deeper

ShareXLinkedInWhatsApp