From magic-powers
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 claudepluginhub kienbui1995/magic-powers --plugin magic-powersThis skill uses the workspace's default tool permissions.
- Designing IAM roles, policies, and permission structures
Generates design tokens/docs from CSS/Tailwind/styled-components codebases, audits visual consistency across 10 dimensions, detects AI slop in UI.
Records polished WebM UI demo videos of web apps using Playwright with cursor overlay, natural pacing, and three-phase scripting. Activates for demo, walkthrough, screen recording, or tutorial requests.
Delivers idiomatic Kotlin patterns for null safety, immutability, sealed classes, coroutines, Flows, extensions, DSL builders, and Gradle DSL. Use when writing, reviewing, refactoring, or designing Kotlin code.
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 only