Sub topic 2
Service Control Policies and Workforce Access
Assume you know AWS accounts, IAM roles, JSON policies, and basic AWS CLI commands. This chapter connects organization-wide guardrails with access between accounts and sign-in for people.
Service control policies: setting permission boundaries
A service control policy (SCP) is an AWS Organizations policy that sets the maximum permissions available in member accounts. An SCP does not grant permission by itself. An IAM identity policy must still allow the action.
For example, this SCP prevents a member account from removing itself:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "DenyLeaveOrganization",
"Effect": "Deny",
"Action": "organizations:LeaveOrganization",
"Resource": "*"
}
]
}Attach the policy to an OU to affect every account below that OU. You can also attach it to an individual account.
Inheritance, evaluation, and deny lists
An account inherits SCPs from the organization root and its parent OUs. AWS combines these policies when evaluating a request. An explicit deny overrides an allow. The request must also have an identity-based or resource-based policy that grants the action.
A deny-list strategy allows normal permissions by default, then adds focused denies for unsafe actions. It is usually easier to operate than an allow-list strategy, which requires explicit allows at every level and can block new services unexpectedly.
Test policy changes in a nonproduction OU first. Region restrictions need exceptions for global services such as IAM, Organizations, and Route 53.
Reaching other accounts with IAM roles
Cross-account access uses an IAM role in the target account. Its trust policy names the source account or role. The role's permissions policy says what the caller may do.
aws sts assume-role \
--role-arn arn:aws:iam::111122223333:role/OrganizationAccountAccessRole \
--role-session-name admin-sessionAWS STS returns temporary credentials. The target account's SCP still limits actions performed there.
Single sign-on with IAM Identity Center
IAM Identity Center gives people one sign-in point. Create permission sets, such as ReadOnly or Administrator, and assign them to groups and accounts. Identity Center then creates corresponding roles in those accounts.
Permission sets centralize workforce access. Use cross-account IAM roles for service-to-service access or tightly controlled automation.
Exercise
An IAM policy allows ec2:TerminateInstances, but an inherited SCP explicitly denies it. Can the user terminate an instance?
Show answer
No. The SCP's explicit deny overrides the IAM allow.