IAM is the core service for managing access to AWS resources. It enables you to control who (authentication) can do what (authorization) on which resources.
Key Components:
Policy Evaluation Logic:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::my-bucket/*"
}
]
}
MFA adds a second layer of authentication beyond username and password.
STS provides temporary, limited-privilege credentials for IAM users or federated users.
Key API Calls:
AssumeRole — Assume an IAM role (cross-account or same account)AssumeRoleWithSAML — Assume a role using SAML assertionAssumeRoleWithWebIdentity — Assume a role using web identity token (Cognito, Google, Facebook)GetSessionToken — Get temporary credentials for MFA-protected API accessTemporary credentials include: Access Key ID, Secret Access Key, and Session Token. Default duration: 1 hour (configurable 15 min to 12 hours).
Cross-account access allows users in one AWS account to access resources in another account using IAM roles.
How it works:
sts:AssumeRole to get temporary credentialsSCPs are a feature of AWS Organizations that set permission guardrails for member accounts.
Control Tower automates the setup and governance of a multi-account AWS environment.
Resource-based policies are attached directly to AWS resources (not to identities).
Services supporting resource policies:
Key difference from identity policies: Resource policies can grant cross-account access without requiring a role assumption.
Federation allows external identities to access AWS resources without creating IAM users.
Create an IAM policy, attach it to a role, and test cross-account role assumption using the AWS CLI.
20 minutes
Step 1: Create a custom IAM policy
aws iam create-policy \
--policy-name S3ReadOnlyCustom \
--policy-document '{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:GetObject",
"s3:ListBucket"
],
"Resource": [
"arn:aws:s3:::my-study-bucket",
"arn:aws:s3:::my-study-bucket/*"
]
}
]
}'
Step 2: Create an IAM role with a trust policy
aws iam create-role \
--role-name S3ReadOnlyRole \
--assume-role-policy-document '{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::ACCOUNT_ID:root"
},
"Action": "sts:AssumeRole"
}
]
}'
Step 3: Attach the policy to the role
aws iam attach-role-policy \
--role-name S3ReadOnlyRole \
--policy-arn arn:aws:iam::ACCOUNT_ID:policy/S3ReadOnlyCustom
Step 4: Assume the role
aws sts assume-role \
--role-arn arn:aws:iam::ACCOUNT_ID:role/S3ReadOnlyRole \
--role-session-name test-session
Step 5: Verify the assumed role credentials
# Export the temporary credentials from the assume-role output
export AWS_ACCESS_KEY_ID=<AccessKeyId>
export AWS_SECRET_ACCESS_KEY=<SecretAccessKey>
export AWS_SESSION_TOKEN=<SessionToken>
# Verify identity
aws sts get-caller-identity
aws iam detach-role-policy \
--role-name S3ReadOnlyRole \
--policy-arn arn:aws:iam::ACCOUNT_ID:policy/S3ReadOnlyCustom
aws iam delete-role --role-name S3ReadOnlyRole
aws iam delete-policy \
--policy-arn arn:aws:iam::ACCOUNT_ID:policy/S3ReadOnlyCustom
| # | Question | Answer |
|---|---|---|
| 1 | What is the default effect of IAM policies? | All requests are implicitly denied by default |
| 2 | What overrides an explicit allow in IAM? | An explicit deny always overrides an allow |
| 3 | What does STS AssumeRole return? | Temporary Access Key ID, Secret Access Key, and Session Token |
| 4 | What is the default duration of STS temporary credentials? | 1 hour (configurable 15 min to 12 hours) |
| 5 | Do SCPs grant permissions? | No, SCPs only restrict permissions. They set maximum permission boundaries. |
| 6 | What is the difference between identity-based and resource-based policies? | Identity-based attach to users/groups/roles. Resource-based attach to resources and can grant cross-account access without role assumption. |
| 7 | What MFA types does AWS support? | Virtual MFA, hardware MFA, U2F security keys |
| 8 | What does AWS Control Tower provide? | Automated multi-account setup with guardrails (preventive SCPs + detective Config rules) |
| 9 | What is a permission boundary? | A policy that sets the maximum permissions an IAM entity can have, regardless of identity-based policies |
| 10 | What is the recommended way to manage access for multiple AWS accounts? | AWS IAM Identity Center (SSO) with AWS Organizations |
A company has multiple AWS accounts managed through AWS Organizations. The security team wants to ensure that no IAM user in any member account can create IAM access keys for the root user. Which approach should a solutions architect recommend?
iam:CreateAccessKey action for the root userCorrect: B
SCPs are the correct mechanism for enforcing organization-wide restrictions. An SCP applied at the organization root affects all member accounts. SCPs can restrict actions even for the root user in member accounts (though not in the management account). Option A would require manual policy management in each account. Options C and D are detective controls, not preventive.
Domain: 1 — Design Secure Architectures Task: 1.1
A company wants to allow users from their corporate Active Directory to access AWS resources without creating individual IAM users. The company uses SAML 2.0. Which solution meets this requirement?
Correct: B
AWS IAM Identity Center (formerly AWS SSO) supports SAML 2.0 federation, allowing corporate AD users to access AWS accounts and applications using their existing credentials. This eliminates the need to create individual IAM users. Option A defeats the purpose of federation. Option C is for extending AD to AWS, not for federation. Option D is overly complex and creates IAM users unnecessarily.
Domain: 1 — Design Secure Architectures Task: 1.1
A solutions architect needs to grant a Lambda function in Account A access to an S3 bucket in Account B. What is the most secure approach?
Correct: C
Cross-account access via IAM roles and STS is the recommended approach. The Lambda function assumes a role in Account B that has the necessary S3 permissions. This uses temporary credentials and follows the principle of least privilege. Option A uses long-term credentials (insecure). Option B exposes data publicly. Option D creates data duplication and does not solve the access problem.
Domain: 1 — Design Secure Architectures Task: 1.1
A company is setting up a new multi-account AWS environment. They need automated account provisioning with built-in security guardrails. Which service should they use?
Correct: B
AWS Control Tower provides automated multi-account setup with a landing zone, built-in guardrails (preventive SCPs and detective AWS Config rules), and a compliance dashboard. While AWS Organizations is a component of Control Tower, it alone does not provide the automated setup and guardrails. CloudFormation StackSets can deploy resources across accounts but do not provide governance guardrails. Service Catalog is for managing approved products.
Domain: 1 — Design Secure Architectures Task: 1.1
An application running on an EC2 instance needs to access an S3 bucket. What is the most secure way to provide these credentials?
Correct: C
Attaching an IAM role to an EC2 instance is the most secure approach. The instance receives temporary credentials automatically via the instance metadata service, and these credentials are rotated automatically. Options A and B use long-term credentials that could be compromised. Option D adds unnecessary complexity when IAM roles provide the same functionality natively.
Domain: 1 — Design Secure Architectures Task: 1.1