skills/cloud/aws/iam-security/SKILL.md
Use when designing IAM policies, troubleshooting access denied errors, implementing SCPs, permission boundaries, cross-account roles, or using IAM Access Analyzer. Covers AWS SCS-C02, SAP-C02, and DVA-C02 identity domains.
npx skillsauth add kienbui1995/magic-powers iam-securityInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
AccessDenied errors in AWS| Policy Type | Attached To | Purpose | |-------------|------------|---------| | Identity policy | IAM user, group, role | Grant permissions to the principal | | Resource policy | AWS resource (S3, KMS, Lambda, etc.) | Grant/deny access from specific principals | | SCP (Service Control Policy) | AWS Organizations OU or account | Set maximum permissions for member accounts | | Permission boundary | IAM user or role | Maximum permissions for that IAM entity | | Session policy | AssumeRole call | Limit permissions for a specific session | | ACL | S3, VPC (legacy) | Cross-account resource access (legacy; avoid) |
Key insight: Multiple policy types can apply simultaneously. The effective permissions = intersection of what ALL applicable policies allow.
Evaluation order (AWS processes in this order):
Simplified rule: Explicit DENY wins → then all remaining policies must ALLOW → any missing allow = implicit DENY.
Cross-account access: Both the identity policy in Account A (allow sts:AssumeRole) AND either the role's trust policy in Account B must allow the access. Resource policies in Account B alone can grant access to Account A principals for some services (S3, KMS, SQS).
| Aspect | IAM Role | IAM User | |--------|---------|---------| | Credentials | Temporary (STS-issued, 1–12h) | Long-term access keys | | Identity | Assumed by any trusted principal | Fixed individual | | Best for | Services, cross-account, federated access | Break-glass admin, legacy CLI | | Key rotation | Automatic (STS expiry) | Manual (must rotate) | | Recommendation | Always prefer roles | Minimize users; use SSO instead |
Use roles for:
FullAWSAccess SCP applied to root (allows everything); tighten by adding deny SCPsSCP deny strategy (preferred):
{
"Effect": "Deny",
"Action": ["ec2:TerminateInstances"],
"Resource": "*",
"Condition": {"StringNotEquals": {"aws:RequestedRegion": ["us-east-1", "us-west-2"]}}
}
SCP allow-list strategy: remove FullAWSAccess and explicitly allow only approved services. Stronger but more management overhead.
SCPs apply to: all IAM users and roles in the account (including root user's service calls). SCPs do NOT apply to the management (root) account of the Organization.
Example: Developer creates Lambda execution roles, but cannot escalate beyond their own permissions:
{
"Effect": "Allow",
"Action": ["iam:CreateRole", "iam:AttachRolePolicy"],
"Resource": "*",
"Condition": {"StringEquals": {"iam:PermissionsBoundary": "arn:aws:iam::ACCOUNT:policy/DevBoundary"}}
}
{
"Principal": {"AWS": "arn:aws:iam::ACCOUNT_A:role/app-role"},
"Action": "sts:AssumeRole"
}
sts:AssumeRole for the Account B rolests:AssumeRole → receives temporary credentials for Account B roleExternalId: Required for third-party cross-account access (prevents confused deputy attacks). Third party provides ExternalId in AssumeRole call; role trust policy conditions on ExternalId.
aws:ResourceTag/team = ${aws:PrincipalTag/team})*) in Action or Resource in production policies?Action: "*", Resource: "*"); no SCPs in multi-account setup (no guardrails)sts:AssumeRole call from Account AAssumeRole call) = further restrict the role's permissions for that specific session onlycontent-media
Use when designing for XR (AR/VR/MR), choosing interaction modes, or adapting 2D UI patterns for spatial computing
testing
Use when creating new skills, editing existing skills, or verifying skills work before deployment
development
Use when you have a spec or requirements for a multi-step task, before touching code
development
Use when executing a structured workflow — select and run a feature, bugfix, refactor, research, or incident template with correct agent and model assignments per phase.