Task 1.1 · 20 min read
Secure Access to AWS Resources
Services in this lesson
- IAMin scope
- AWS IAM Identity Centerin scope
- AWS Organizationsin scope
- AWS Control Towerin scope
- AWS Directory Servicein scope
What the exam tests
- Whether you pick temporary credentials (roles, IAM Identity Center, federation) over long-lived IAM user access keys, for people and for workloads.
- Whether you place a control at the right layer. An SCP covers every account in an OU. An identity policy covers one role. A resource policy covers one bucket or queue. A permissions boundary limits delegated administrators.
- Whether you can design cross-account access: a role with a trust policy, a resource-based policy, or an external ID for a third party, and what each side must allow.
- Whether you can choose the multi-account setup: AWS Organizations, AWS Control Tower, and IAM Identity Center connected to the company directory.
- Whether you know when to federate instead of creating IAM users. An existing Active Directory or SAML 2.0/OIDC identity provider stays the one user store, and people reach AWS through roles.
- Whether you protect the root user and know where AWS's job ends and yours begins under the shared responsibility model.
The core concept
Every request to AWS asks one question: may this principal do this action on this resource, right now? IAM (Identity and Access Management) answers it the same way every time, so once you know the steps, most access questions on the exam answer themselves.
A principal is whoever makes the request: the root user, an IAM user, a role session, or an AWS service acting for you.
An analogy: an office building
Picture an office building with three kinds of rules:
- Your badge lists the rooms you may enter. That's an identity policy, attached to a user or role.
- A room's door can carry its own guest list. That's a resource policy, attached to a resource such as an S3 bucket or an SQS queue.
- The landlord's house rules apply to every tenant, such as "nobody enters the east wing". Those are service control policies (SCPs), set on a whole group of accounts. They can stop you, but they never let you in anywhere.
Inside your own company, the badge or the guest list is enough. A visitor from another company needs both: their own company's badge and a place on your door's guest list.
Where the analogy breaks: in AWS, a single written "no" beats every "yes". Even a "no" on your own badge overrides a door that lists your name.
Walk one request through it
The diagram is the full checklist AWS runs. The walkthrough below follows one request through it.
Priya is signed in to the tooling account (111111111111) as the Operators role. She needs to stop an EC2 instance (a virtual server) in the production account (222222222222). The production account has a role named ProdOps that may manage EC2.
A role is an identity with permissions but no long-term password or access keys. Anyone allowed to "assume" it gets temporary credentials, called a role session.
- Priya asks AWS STS to assume
ProdOps. AWS STS (Security Token Service) hands out temporary credentials. This request crosses accounts, so the diagram's cross-account check applies: both sides must say yes. - Her side says yes. The
Operatorsrole's identity policy allowssts:AssumeRoleonProdOps. Actions are namedservice:Action. - The owner's side says yes. The
ProdOpstrust policy (the part of a role that lists who may assume it) allows theOperatorsrole. If either side were missing, the request would fail. - Priya, now acting as
ProdOps, callsec2:StopInstancesineu-west-1. A Region is a geographic area, here Ireland. This request stays inside the production account, and the role's permissions policy allows it, so one allow is enough. - The guardrail check passes. The SCP on production's organizational unit denies every Region except
eu-west-1andeu-central-1. This call is ineu-west-1, so no deny applies, and it succeeds. - The same call in
us-east-1fails. It matches the SCP's deny, and the role's own allow can't override a deny.
The rules the exam tests
- Everything starts denied (an implicit deny). Some policy has to allow the request.
- An explicit deny wins. A
Denystatement in any policy beats every allow. - Same account: either side is enough. AWS combines the identity policy and the resource policy, so one allow works.
- Across accounts: both sides must allow. The caller's identity policy and the resource or trust policy in the owner's account.
- Guardrails never grant; they only cap. SCPs and resource control policies (RCPs) cap every member account of an organization, never the management account. A permissions boundary caps one user or role. A session policy caps one role session.
Deep diveEdge cases: what a same-account resource policy can and can't do
Inside one account, a resource policy can name a specific IAM user ARN or a role session ARN. An ARN (Amazon Resource Name) is the unique ID of a user, role or resource. When it does, the resource policy grants access directly, so an implicit deny from that identity's permissions boundary or session policy doesn't cap it.
A resource policy that names a role ARN is different. Access through it is still capped by the role's permissions boundary and session policy. An explicit deny anywhere still wins in both cases.
A role trust policy that names a whole account (arn:aws:iam::111111111111:root) hands the decision to that account. The caller then also needs an identity policy that allows sts:AssumeRole, even in the same account.
That's how AWS decides. Two more choices decide who the principal is and where the guardrails sit.
Who should the principal be?
- People sign in once through IAM Identity Center, the sign-in portal for your workforce. It can use your company's identity provider (IdP), the system that already holds your employees' sign-ins.
- A permission set is a template of policies. Identity Center turns it into a role in each account the person is assigned to, and the person signs in to a role session.
- Workloads use roles: an EC2 instance profile (a role attached to a server), a Lambda execution role, or a role assumed through AWS STS.
- IAM users with access keys (a long-lived key ID and secret pair) remain for the rare case where nothing else works.
Accounts are a security boundary too
AWS Organizations groups accounts into organizational units (OUs), folders of accounts. The management account creates the organization; every other account is a member account. An SCP on an OU caps every member account inside it.
AWS Control Tower builds that structure for you. Its controls either prevent an action (preventive) or flag it after the fact (detective).
IAM and AWS Organizations are global, but IAM Identity Center is Regional: you choose one primary Region and can't change it. To keep work inside approved Regions, you deny by the aws:RequestedRegion condition key; IAM itself has no per-Region setting.
Deep diveWhere IAM, AWS Organizations and IAM Identity Center live
- IAM is a global service. Users, roles and policies apply in every Region.
- IAM changes are eventually consistent. A new or changed policy can take a few moments to work everywhere.
- AWS Organizations is global too.
- IAM Identity Center is Regional. You enable it in one primary Region, and you can't change that Region later. You can add Regions to replicate it.
- With AWS Managed Microsoft AD as the identity source, you must enable IAM Identity Center in the same Region as the directory.
Shared responsibility
AWS secures the infrastructure that runs IAM. Who can do what in your accounts is your side of the line: every policy, every credential, and the root user's MFA (multi-factor authentication).
Decision guide
| If the question says… | Reach for… | Because… |
|---|---|---|
| "workforce users", "many accounts", "single sign-on", "existing corporate identities" | IAM Identity Center with the company IdP (SAML 2.0 + SCIM) or Active Directory as the identity source | One sign-in and central permission-set assignment; Identity Center creates and updates the role in every account |
| "existing on-premises Active Directory", "users keep their AD credentials", "no second user store" | IAM Identity Center with AD as the identity source: AD Connector (to on-premises AD), or AWS Managed Microsoft AD with a trust | Users authenticate against AD through AWS Directory Service; no user copy to maintain; assign sets to AD groups |
| "one account" or "one application" already trusts a SAML 2.0 or OIDC identity provider | An IAM identity provider in that account and a role the federated users assume | Temporary role credentials without an IAM user per person, when you don't need multi-account assignments |
| "no one in member accounts, including administrators, may…", "approved Regions only" | An SCP on the OU (or root) with a Deny statement | SCPs cap every user and role in member accounts, even the member root user and AdministratorAccess |
| "set up a new multi-account environment", "best-practice guardrails", "LEAST effort" | AWS Control Tower landing zone | Builds on Organizations and Identity Center, with preventive (SCP, RCP) and detective (AWS Config) controls |
| "application on EC2" or "Lambda function" must call another AWS service | An IAM role: an instance profile or an execution role | The service supplies rotating temporary credentials: no access keys to store, leak or rotate |
| "users in account A need to manage resources in account B" | A role in B whose trust policy names A, plus an identity policy in A allowing sts:AssumeRole on that role | Cross-account needs an allow on both sides; permissions stay defined in B, where the resources live |
| "a third-party vendor" or "SaaS provider" needs access to your account | A cross-account role whose trust policy requires an sts:ExternalId condition | Stops the confused deputy problem: the vendor can't be tricked into using your role for another customer |
| "share one bucket, queue or key with every account in the organization" | A resource-based policy with the aws:PrincipalOrgID condition | One condition covers current and future member accounts; no account ID list to maintain |
| "let developers create roles but never exceed a set of permissions" | A permissions boundary, required by a condition on iam:CreateRole | The boundary caps every role they create, so they can't escalate their own privileges |
| "protect the root user" | MFA on the root user, no root access keys, and centralized root access for member accounts in Organizations | Root can do everything in its account; few tasks need it; member root credentials can be removed entirely |
Correct pattern
REFERENCE PATTERN: an operations team in a tooling account (111111111111) manages EC2 in a production account (222222222222). Both accounts sit in one organization, and an SCP on the workloads OU keeps everyone inside two Regions.
1. Trust policy on the role ProdOps in the production account: who may assume it.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": { "AWS": "arn:aws:iam::111111111111:root" },
"Action": "sts:AssumeRole",
"Condition": {
"ArnEquals": {
"aws:PrincipalArn": "arn:aws:iam::111111111111:role/Operators"
}
}
}
]
}
2. Identity policy on the Operators role in the tooling account: what they may assume.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "sts:AssumeRole",
"Resource": "arn:aws:iam::222222222222:role/ProdOps"
}
]
}
3. SCP on the workloads OU: the guardrail no account administrator can lift.
Read the SCP as: deny every action except these global services, whenever the Region isn't one of these two.
Global services are listed in NotAction because their requests go to a single endpoint in us-east-1. Without the exception, the SCP would deny them.
The list is abridged, but it keeps sts:* so the sts:AssumeRole call from step 2 still works through the global STS endpoint. As the AWS example says, add any other global services you use, such as budgets or waf.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "DenyOutsideApprovedRegions",
"Effect": "Deny",
"NotAction": [
"cloudfront:*",
"iam:*",
"organizations:*",
"route53:*",
"sts:*",
"support:*"
],
"Resource": "*",
"Condition": {
"StringNotEquals": {
"aws:RequestedRegion": ["eu-west-1", "eu-central-1"]
}
}
}
]
}
Read it as a chain:
- The trust policy names the tooling account's root (
:root). Here:rootmeans the whole account, not the root user. Only principals there whose identity policy allowssts:AssumeRoleonProdOpscan use the role. - The
aws:PrincipalArncondition narrows it to theOperatorsrole. No other role in the tooling account can assumeProdOps, even if someone grants itsts:AssumeRole. - The role's own permissions policy (not shown) grants the EC2 actions.
- The SCP still caps the session. Even an
ec2:*permission can't launch anything inus-east-1.
Deep diveWhy not require MFA in the trust policy?
Don't rely on aws:MultiFactorAuthPresent for this. AWS omits the key when a request is signed with long-term credentials, so a plain Bool condition fails for those requests. Require MFA at IAM Identity Center sign-in instead.
Traps
| The trap | Why it fails | Correct pattern |
|---|---|---|
| Attaching an SCP to "give" a team access to a service | SCPs never grant: with no identity policy, a user has no access even if SCPs allow *. SCPs just look like IAM policies | Grant with identity or resource policies; use SCPs only to set the ceiling |
| Expecting an SCP to restrict the management account | SCPs and RCPs don't affect the management account at all, so a guardrail tested there seems to do nothing | Keep workloads out of the management account and test SCPs on a test OU first |
| Creating an IAM user with access keys for an EC2 or Lambda workload | Long-lived keys end up in code, AMIs or environment variables and never rotate. Tempting because the SDK reads keys straight away | Attach a role (instance profile or execution role); the SDK picks up its temporary credentials automatically |
| Adding only a trust policy (or only a bucket policy) for cross-account access | The caller's identity policy must allow it too. A one-sided setup passes a single-account test, which is why it fools people | Allow on both sides: identity policy in the caller's account, trust or resource policy in the owner's account |
Adding an Allow to override a Deny | An explicit deny in any policy type ends the evaluation. More allows change nothing | Remove or narrow the deny statement, or add a condition to it |
Naming an IAM group as the Principal in a bucket policy or trust policy | Groups only hold permissions; they can't sign in, so they can't be principals. Groups also can't be nested | Name a role or account as the principal, or move the permission into the group's identity policy |
| Creating an IAM user for every employee, copied from Active Directory | Two user stores drift: leavers stay active, credentials are long-lived, and every account needs a copy. It only looks easy on day one | Connect AD to IAM Identity Center (AD Connector or AWS Managed Microsoft AD) and assign permission sets to AD groups |
| Expecting a 12-hour session from a role assumed with credentials of another role | Role chaining caps the session at one hour, whatever the role's maximum session duration (1–12 hours, default 1) | Assume the target role directly from a user or federated sign-in, and raise its maximum session duration |
Compare
| Control | Attaches to | Can it grant access? | Who it affects | Typical exam cue |
|---|---|---|---|---|
| Identity-based policy | IAM user, group or role | Yes | That identity | "grant this role access to…" |
| Resource-based policy | Resource (bucket, queue, key, role) | Yes, including to other accounts | Principals named in it | "share with another account", "every account in the organization" |
| Permissions boundary | IAM user or role | No, sets a ceiling | That user or role | "delegate role creation without privilege escalation" |
| Service control policy (SCP) | Root, OU or account | No, sets a ceiling | Users and roles in member accounts, member root included; not service-linked roles | "no one in these accounts may…", "approved Regions" |
| Resource control policy (RCP) | Root, OU or account | No, sets a ceiling | Resources of supported services in member accounts | "no principal outside the organization may reach our resources" |
| Session policy | One role session | No, sets a ceiling | That session only | "narrow a session below the role's permissions" |
Who holds the identity is a separate choice from which policy controls it:
| Need | IAM user and group | IAM role | IAM Identity Center |
|---|---|---|---|
| Credentials | Long-lived password and up to 2 access keys | Temporary, from AWS STS | Temporary role sessions created from permission sets |
| Best fit | Legacy tools that can't use roles | Workloads, cross-account access, federation | Workforce access to many accounts |
| Scales across accounts | No, one copy per account | One role per account | Yes, one assignment reaches many accounts |
| Uses the corporate directory | No | Through SAML 2.0 or OIDC federation | Yes: external IdP, AD through AWS Directory Service, or its own directory |
| Flexible authorization | Attach managed policies to groups, not to each user; keep inline policies for a strict one-to-one grant | ABAC: one policy that compares aws:PrincipalTag with resource tags instead of one policy per team | Permission sets hold managed or inline policies; attributes for access control pass directory attributes for ABAC |
Worked exam scenario
Exam scenario
A company runs 30 AWS accounts in AWS Organizations with all features enabled. A new data-residency rule says that nobody in any member account, including account administrators, may create resources outside eu-west-1 and eu-central-1. Some teams already have the AdministratorAccess policy. The security team wants the solution that requires the LEAST ongoing operational effort as accounts are added. What should a solutions architect do?
- A.Attach an IAM policy that denies actions outside the two Regions to every IAM role and user in each member account.
- B.Attach an SCP that denies actions outside the two Regions, with exceptions for global services, to the organization root or the OU that holds the member accounts.
- C.Deploy an AWS Config rule in each account that flags resources in other Regions, and an automatic remediation that deletes them.
- D.Set a permissions boundary that allows only the two Regions on every administrator role in the member accounts.
Show the walkthrough
- Underline the requirement. "Nobody … including account administrators" means a control that the account's own administrators can't remove. "LEAST ongoing operational effort … as accounts are added" means it must apply to new accounts automatically.
- Eliminate A. Each account's administrators can detach their own IAM policies, and every new user or role needs the policy again. It meets the rule on day one and drifts after that.
- Eliminate C. AWS Config detects the resource after it exists, so the rule is already broken for a while. It's detective, and the question asks for prevention.
- Eliminate D. A boundary only caps the roles it's attached to, and an administrator can change or remove it. You'd also have to attach it to every new role.
- Land on B. An SCP on the root or OU caps every user and role in every member account, including administrators and the member account root user. New accounts inherit it when they join the OU. The
NotActionexceptions keep global services such as IAM working.
Answer: B
Check your understanding
Build it
Do the secure access lab. You create a least-privilege role, assume it with AWS STS, and watch a call outside its policy fail. Then you see an explicit deny in a bucket policy beat the role's own allow.
Network-level access (security groups, network ACLs, VPC endpoints) and application credentials in Secrets Manager belong to 1.2 Secure workloads. Key policies in AWS KMS and data protection controls belong to 1.3 Data security.
Key takeaways
- An explicit deny in any policy wins; everything else starts denied until something allows it.
- SCPs, RCPs and permissions boundaries only cap permissions; identity and resource policies grant them. SCPs never touch the management account or service-linked roles.
- Same account: identity policy or resource policy. Cross-account: identity policy and resource or trust policy.
- People sign in through IAM Identity Center, workloads use roles, and vendors get a role with an external ID. The root user gets MFA and no access keys.
- For many accounts, start with AWS Organizations and an OU structure, or let AWS Control Tower build the landing zone and its controls.
- Give people and workloads temporary credentials through roles, grant the least they need where the access happens, and fence every account with SCPs: an explicit deny anywhere always wins.
Hands-on lab: Least-Privilege Role and the Explicit Deny
Sources
- https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_evaluation-logic.html
- https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_evaluation-logic-cross-account.html
- https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_scps.html
- https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_rcps.html
- https://docs.aws.amazon.com/organizations/latest/userguide/orgs_reference_limits.html
- https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use_switch-role-console.html
- https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_update-role-settings.html
- https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_common-scenarios_third-party.html
- https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use_switch-role-ec2.html
- https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_saml.html
- https://docs.aws.amazon.com/IAM/latest/UserGuide/root-user-best-practices.html
- https://docs.aws.amazon.com/IAM/latest/UserGuide/id_root-user.html
- https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_boundaries.html
- https://docs.aws.amazon.com/IAM/latest/UserGuide/id_groups.html
- https://docs.aws.amazon.com/IAM/latest/UserGuide/security.html
- https://docs.aws.amazon.com/IAM/latest/UserGuide/troubleshoot.html
- https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_examples_aws_deny-requested-region.html
- https://docs.aws.amazon.com/general/latest/gr/iam-service.html
- https://docs.aws.amazon.com/singlesignon/latest/userguide/manage-your-identity-source.html
- https://docs.aws.amazon.com/singlesignon/latest/userguide/manage-your-identity-source-ad.html
- https://docs.aws.amazon.com/singlesignon/latest/userguide/replicate-to-additional-region.html
- https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_iam-quotas.html
- https://docs.aws.amazon.com/directoryservice/latest/admin-guide/ad_connector_getting_started.html
- https://docs.aws.amazon.com/IAM/latest/UserGuide/gs-identities-mfa.html
- https://docs.aws.amazon.com/singlesignon/latest/userguide/permissionsetsconcept.html
- https://docs.aws.amazon.com/controltower/latest/userguide/what-is-control-tower.html
- https://docs.aws.amazon.com/controltower/latest/userguide/how-controls-work.html
- https://docs.aws.amazon.com/AmazonS3/latest/userguide/example-bucket-policies.html
- https://docs.aws.amazon.com/IAM/latest/UserGuide/id_root-enable-root-access.html
- https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html
- https://docs.aws.amazon.com/IAM/latest/UserGuide/introduction_attribute-based-access-control.html
- https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_managed-vs-inline.html
- https://docs.aws.amazon.com/singlesignon/latest/userguide/organization-instances-identity-center.html
- https://docs.aws.amazon.com/singlesignon/latest/userguide/configure-abac.html
Last reviewed