[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7AB8P54F27GKY2H6A4ZGYPD":3,"skill-same:01M7AB8P54F27GKY2H6A4ZGYPD":107},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":16,"sourceHtmlUrl":17,"categories":18,"keywords":19,"publishedAt":20,"linkOnly":21,"markdownContent":22,"markdownBody":23,"frontMatter":24,"refName":70,"commitSha":71,"skillDirectory":72,"forksCount":14,"repositoryHtmlUrl":73,"repositoryHomepageUrl":6,"ownerHtmlUrl":74,"ownerBlogUrl":6,"ownerDescription":75,"updatedAt":76,"install":77,"resources":90},"01M7AB8P54F27GKY2H6A4ZGYPD","securing-aws-iam-permissions",null,"Hardens AWS IAM configurations to enforce least-privilege access, covering IAM policy scoping, permission boundaries, IAM Access Analyzer integration, and credential rotation strategies. Use when reducing the blast radius of compromised AWS identities, auditing overly permissive IAM policies, or setting up permission boundaries and Access Analyzer findings review across cloud accounts.","NeelakshSaxena\u002FVayu","NeelakshSaxena","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F87892838?v=4","01M7A3B9YFS6F6N9DD1787DT86","Neelaksh Saxena","01M7A3B9ZKBT09MNMPX2XN69BY",0,"Apache-2.0","https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fsecuring-aws-iam-permissions\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fsecuring-aws-iam-permissions\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: securing-aws-iam-permissions\ndescription: 'Hardens AWS IAM configurations to enforce least-privilege access, covering\n  IAM policy scoping, permission boundaries, IAM Access Analyzer integration, and credential\n  rotation strategies. Use when reducing the blast radius of compromised AWS identities,\n  auditing overly permissive IAM policies, or setting up permission boundaries and\n  Access Analyzer findings review across cloud accounts.\n\n  '\ndomain: cybersecurity\nsubdomain: cloud-security\ntags:\n- aws-iam\n- least-privilege\n- permission-boundaries\n- access-analyzer\n- cloud-identity\nversion: 1.0.0\nauthor: mahipal\nlicense: Apache-2.0\nnist_csf:\n- PR.IR-01\n- ID.AM-08\n- GV.SC-06\n- DE.CM-01\nmitre_attack:\n- T1078.004\n- T1530\n- T1537\n- T1580\n- T1003\nmitre_f3:\n  version: '1.1'\n  tactics:\n  - initial-access\n  - positioning\n  techniques:\n  - id: F1006.001\n    name: 'Account Takeover: Exposed API Key'\n    tactic: initial-access\n    source: f3\n  - id: F1006.002\n    name: 'Account Takeover: Exposed Login Credential'\n    tactic: initial-access\n    source: f3\n  - id: T1550.001\n    name: 'Use Alternate Authentication Material: Application Access Token'\n    tactic: initial-access\n    source: attack\n  - id: T1110.003\n    name: 'Brute Force: Password Spraying'\n    tactic: initial-access\n    source: attack\n  - id: F1005.004\n    name: 'Account Manipulation: Change Account Details'\n    tactic: positioning\n    source: f3\n---\n\n# Securing AWS IAM Permissions\n\n## When to Use\n\n- When onboarding new AWS accounts or workloads that require scoped IAM policies\n- When IAM Access Analyzer reports overly permissive policies or unused permissions\n- When preparing for a compliance audit requiring least privilege evidence (SOC 2, PCI-DSS)\n- When migrating from long-lived access keys to short-lived role-based credentials\n- When remediating findings from AWS Security Hub related to IAM misconfigurations\n\n**Do not use** for Azure AD or Google Cloud IAM configurations, application-level authorization logic, or federated identity provider setup (see managing-cloud-identity-with-okta).\n\n## Prerequisites\n\n- AWS account with administrative access or IAM:FullAccess permissions\n- AWS CLI v2 installed and configured with named profiles\n- AWS CloudTrail enabled for at least 90 days of API activity history\n- Familiarity with JSON-based IAM policy syntax and ARN resource notation\n\n## Workflow\n\n### Step 1: Inventory Existing IAM Entities and Policies\n\nGenerate a comprehensive inventory of all IAM users, roles, groups, and attached policies using the AWS CLI and IAM credential reports. Identify accounts with console access, programmatic access keys, and their last-used timestamps.\n\n```bash\n# Generate IAM credential report\naws iam generate-credential-report\naws iam get-credential-report --query 'Content' --output text | base64 -d > iam-report.csv\n\n# List all IAM roles and their attached policies\naws iam list-roles --query 'Roles[*].[RoleName,Arn,CreateDate]' --output table\n\n# Find users with access keys older than 90 days\naws iam list-users --query 'Users[*].UserName' --output text | while read user; do\n  aws iam list-access-keys --user-name \"$user\" \\\n    --query \"AccessKeyMetadata[?CreateDate\u003C='$(date -d '-90 days' +%Y-%m-%d)'].[UserName,AccessKeyId,Status,CreateDate]\" \\\n    --output table\ndone\n```\n\n### Step 2: Enable and Analyze IAM Access Analyzer Findings\n\nActivate IAM Access Analyzer at the organization or account level to identify resources shared externally and generate least-privilege policy recommendations based on CloudTrail activity.\n\n```bash\n# Create an Access Analyzer for the account\naws accessanalyzer create-analyzer \\\n  --analyzer-name account-analyzer \\\n  --type ACCOUNT\n\n# List active findings for external access\naws accessanalyzer list-findings \\\n  --analyzer-arn arn:aws:access-analyzer:us-east-1:123456789012:analyzer\u002Faccount-analyzer \\\n  --filter '{\"status\": {\"eq\": [\"ACTIVE\"]}}'\n\n# Generate a policy based on CloudTrail activity for a specific role\naws accessanalyzer start-policy-generation \\\n  --policy-generation-details '{\n    \"principalArn\": \"arn:aws:iam::123456789012:role\u002FAppRole\",\n    \"cloudTrailDetails\": {\n      \"trailArn\": \"arn:aws:cloudtrail:us-east-1:123456789012:trail\u002Fmanagement-trail\",\n      \"startTime\": \"2025-01-01T00:00:00Z\",\n      \"endTime\": \"2025-03-01T00:00:00Z\"\n    }\n  }'\n```\n\n### Step 3: Scope Policies to Specific Resources and Conditions\n\nReplace wildcard resource ARNs with specific resource identifiers. Add IAM policy conditions for MFA enforcement, source IP restrictions, and time-based access windows.\n\n```json\n{\n  \"Version\": \"2012-10-17\",\n  \"Statement\": [\n    {\n      \"Sid\": \"AllowS3ReadSpecificBucket\",\n      \"Effect\": \"Allow\",\n      \"Action\": [\n        \"s3:GetObject\",\n        \"s3:ListBucket\"\n      ],\n      \"Resource\": [\n        \"arn:aws:s3:::production-data-bucket\",\n        \"arn:aws:s3:::production-data-bucket\u002F*\"\n      ],\n      \"Condition\": {\n        \"Bool\": {\"aws:MultiFactorAuthPresent\": \"true\"},\n        \"IpAddress\": {\"aws:SourceIp\": \"10.0.0.0\u002F8\"},\n        \"DateGreaterThan\": {\"aws:CurrentTime\": \"2025-01-01T00:00:00Z\"}\n      }\n    }\n  ]\n}\n```\n\n### Step 4: Implement Permission Boundaries\n\nAttach permission boundaries to IAM roles and users to define the maximum scope of permissions an entity can receive, preventing privilege escalation even if an administrator attaches an overly permissive policy.\n\n```bash\n# Create a permission boundary policy\naws iam create-policy \\\n  --policy-name DeveloperPermissionBoundary \\\n  --policy-document file:\u002F\u002Fdeveloper-boundary.json\n\n# Attach the boundary to an IAM role\naws iam put-role-permissions-boundary \\\n  --role-name DeveloperRole \\\n  --permissions-boundary \"arn:aws:iam::123456789012:policy\u002FDeveloperPermissionBoundary\"\n```\n\n```json\n{\n  \"Version\": \"2012-10-17\",\n  \"Statement\": [\n    {\n      \"Sid\": \"AllowCommonServices\",\n      \"Effect\": \"Allow\",\n      \"Action\": [\n        \"s3:*\",\n        \"dynamodb:*\",\n        \"lambda:*\",\n        \"logs:*\",\n        \"cloudwatch:*\"\n      ],\n      \"Resource\": \"*\"\n    },\n    {\n      \"Sid\": \"DenyIAMChanges\",\n      \"Effect\": \"Deny\",\n      \"Action\": [\n        \"iam:CreateUser\",\n        \"iam:DeleteUser\",\n        \"iam:CreateRole\",\n        \"iam:DeleteRole\",\n        \"iam:AttachRolePolicy\",\n        \"iam:PutRolePermissionsBoundary\"\n      ],\n      \"Resource\": \"*\"\n    }\n  ]\n}\n```\n\n### Step 5: Enforce MFA and Eliminate Long-Lived Credentials\n\nRequire MFA for all human users accessing the AWS console and CLI. Migrate workloads from IAM user access keys to IAM roles with temporary credentials via STS AssumeRole.\n\n```bash\n# Enforce MFA via SCP at the organization level\naws organizations create-policy \\\n  --name RequireMFA \\\n  --type SERVICE_CONTROL_POLICY \\\n  --content '{\n    \"Version\": \"2012-10-17\",\n    \"Statement\": [\n      {\n        \"Sid\": \"DenyAllExceptMFA\",\n        \"Effect\": \"Deny\",\n        \"NotAction\": [\n          \"iam:CreateVirtualMFADevice\",\n          \"iam:EnableMFADevice\",\n          \"iam:ListMFADevices\",\n          \"iam:ResyncMFADevice\",\n          \"sts:GetSessionToken\"\n        ],\n        \"Resource\": \"*\",\n        \"Condition\": {\n          \"BoolIfExists\": {\"aws:MultiFactorAuthPresent\": \"false\"}\n        }\n      }\n    ]\n  }'\n\n# Deactivate unused access keys\naws iam update-access-key --user-name old-user --access-key-id AKIAEXAMPLE --status Inactive\n```\n\n### Step 6: Automate Continuous IAM Monitoring\n\nDeploy AWS Config rules and Security Hub controls to continuously evaluate IAM posture. Set up EventBridge rules to alert on high-risk IAM changes such as new root access key creation or policy modifications.\n\n```bash\n# Enable AWS Config rule for IAM password policy\naws configservice put-config-rule \\\n  --config-rule '{\n    \"ConfigRuleName\": \"iam-password-policy\",\n    \"Source\": {\n      \"Owner\": \"AWS\",\n      \"SourceIdentifier\": \"IAM_PASSWORD_POLICY\"\n    },\n    \"InputParameters\": \"{\\\"RequireUppercaseCharacters\\\":\\\"true\\\",\\\"RequireLowercaseCharacters\\\":\\\"true\\\",\\\"RequireSymbols\\\":\\\"true\\\",\\\"RequireNumbers\\\":\\\"true\\\",\\\"MinimumPasswordLength\\\":\\\"14\\\",\\\"MaxPasswordAge\\\":\\\"90\\\"}\"\n  }'\n\n# EventBridge rule to detect root account usage\naws events put-rule \\\n  --name DetectRootUsage \\\n  --event-pattern '{\n    \"detail-type\": [\"AWS API Call via CloudTrail\"],\n    \"detail\": {\n      \"userIdentity\": {\"type\": [\"Root\"]}\n    }\n  }'\n```\n\n## Key Concepts\n\n| Term | Definition |\n|------|------------|\n| Least Privilege | Granting only the minimum permissions required for an identity to perform its function |\n| Permission Boundary | An advanced IAM feature that sets the maximum permissions an entity can have, regardless of attached policies |\n| IAM Access Analyzer | AWS service that uses automated reasoning to identify resources shared externally and generate least-privilege policies from CloudTrail activity |\n| Service Control Policy (SCP) | Organization-level policy that sets permission guardrails across all accounts in an AWS Organization |\n| Assume Role | STS operation that returns temporary security credentials for cross-account or service-to-service access |\n| Credential Report | AWS-generated CSV listing all IAM users, their access keys, MFA status, and last activity timestamps |\n| Policy Condition | Constraints in IAM policies that restrict when and how permissions apply, such as MFA requirements or IP ranges |\n| Identity Federation | Allowing external identity providers to grant temporary AWS access without creating IAM users |\n\n## Tools & Systems\n\n- **AWS IAM Access Analyzer**: Generates least-privilege policies from CloudTrail activity and identifies resources shared with external entities\n- **AWS Config**: Continuously evaluates IAM configuration compliance against managed and custom rules\n- **AWS Security Hub**: Aggregates IAM security findings from Access Analyzer, Config, and third-party tools into a unified dashboard\n- **IAM Policy Simulator**: Tests the effects of IAM policies before deployment by simulating API calls against policy evaluation logic\n- **Prowler**: Open-source AWS security assessment tool that runs over 300 checks including IAM best practices and CIS benchmark controls\n\n## Common Scenarios\n\n### Scenario: Developer Role Over-Provisioned with AdministratorAccess\n\n**Context**: A startup attached the AWS-managed AdministratorAccess policy to all developer roles for speed during early development. A security audit reveals 15 roles with full account access while developers only use S3, Lambda, and DynamoDB.\n\n**Approach**:\n1. Enable IAM Access Analyzer and generate policy recommendations based on 90 days of CloudTrail data for each role\n2. Create scoped policies allowing only the specific S3 buckets, Lambda functions, and DynamoDB tables each team accesses\n3. Attach a permission boundary denying IAM, Organizations, and billing actions\n4. Deploy the new policies in a parallel role with CloudTrail monitoring before replacing the original\n5. Remove AdministratorAccess and rotate all access keys\n\n**Pitfalls**: Replacing policies without a parallel testing period causes service disruptions. Forgetting to scope Lambda:InvokeFunction to specific function ARNs leaves lateral movement paths open.\n\n### Scenario: Rotating Compromised Access Keys Across Multiple Services\n\n**Context**: An access key is found in a public GitHub repository. The key belongs to an IAM user with S3 and EC2 permissions across three AWS accounts.\n\n**Approach**:\n1. Immediately deactivate the compromised key using `aws iam update-access-key --status Inactive`\n2. Review CloudTrail logs for all API calls made with the compromised key in the past 30 days\n3. Create a new access key for the user and update all dependent services and CI\u002FCD pipelines\n4. Delete the compromised key after confirming all services use the new credentials\n5. Migrate the workload to use IAM roles with STS temporary credentials to prevent future key exposure\n\n**Pitfalls**: Deleting the key before deactivating it prevents forensic analysis of which services relied on it. Failing to check all three accounts for unauthorized activity leaves potential backdoors undetected.\n\n## Output Format\n\n```\nIAM Security Assessment Report\n==============================\nAccount ID: 123456789012\nAssessment Date: 2025-02-23\nAnalyzer: IAM Access Analyzer + Prowler v4.3\n\nCRITICAL FINDINGS:\n[C-001] Root account has active access keys\n  - Resource: arn:aws:iam::123456789012:root\n  - Remediation: Delete root access keys, enable MFA on root\n  - CIS Benchmark: 1.4 (Ensure no root account access key exists)\n\n[C-002] IAM user 'deploy-bot' has AdministratorAccess with no MFA\n  - Resource: arn:aws:iam::123456789012:user\u002Fdeploy-bot\n  - Last Activity: 2025-02-20\n  - Remediation: Replace with IAM role, enforce MFA condition\n\nHIGH FINDINGS:\n[H-001] 3 IAM policies use wildcard Resource \"*\" with sensitive actions\n  - Policies: DevPolicy, CIPolicy, LegacyAdminPolicy\n  - Remediation: Scope resources to specific ARNs using Access Analyzer\n\n[H-002] 7 access keys older than 90 days detected\n  - Users: svc-backup, svc-monitoring, dev-alice, dev-bob, ...\n  - Remediation: Rotate keys, migrate to role-based access\n\nSUMMARY:\n  Total Findings: 14\n  Critical: 2 | High: 4 | Medium: 5 | Low: 3\n  Compliance Score: 62% (CIS AWS Foundations Benchmark v3.0)\n```\n","# Securing AWS IAM Permissions\n\n## When to Use\n\n- When onboarding new AWS accounts or workloads that require scoped IAM policies\n- When IAM Access Analyzer reports overly permissive policies or unused permissions\n- When preparing for a compliance audit requiring least privilege evidence (SOC 2, PCI-DSS)\n- When migrating from long-lived access keys to short-lived role-based credentials\n- When remediating findings from AWS Security Hub related to IAM misconfigurations\n\n**Do not use** for Azure AD or Google Cloud IAM configurations, application-level authorization logic, or federated identity provider setup (see managing-cloud-identity-with-okta).\n\n## Prerequisites\n\n- AWS account with administrative access or IAM:FullAccess permissions\n- AWS CLI v2 installed and configured with named profiles\n- AWS CloudTrail enabled for at least 90 days of API activity history\n- Familiarity with JSON-based IAM policy syntax and ARN resource notation\n\n## Workflow\n\n### Step 1: Inventory Existing IAM Entities and Policies\n\nGenerate a comprehensive inventory of all IAM users, roles, groups, and attached policies using the AWS CLI and IAM credential reports. Identify accounts with console access, programmatic access keys, and their last-used timestamps.\n\n```bash\n# Generate IAM credential report\naws iam generate-credential-report\naws iam get-credential-report --query 'Content' --output text | base64 -d > iam-report.csv\n\n# List all IAM roles and their attached policies\naws iam list-roles --query 'Roles[*].[RoleName,Arn,CreateDate]' --output table\n\n# Find users with access keys older than 90 days\naws iam list-users --query 'Users[*].UserName' --output text | while read user; do\n  aws iam list-access-keys --user-name \"$user\" \\\n    --query \"AccessKeyMetadata[?CreateDate\u003C='$(date -d '-90 days' +%Y-%m-%d)'].[UserName,AccessKeyId,Status,CreateDate]\" \\\n    --output table\ndone\n```\n\n### Step 2: Enable and Analyze IAM Access Analyzer Findings\n\nActivate IAM Access Analyzer at the organization or account level to identify resources shared externally and generate least-privilege policy recommendations based on CloudTrail activity.\n\n```bash\n# Create an Access Analyzer for the account\naws accessanalyzer create-analyzer \\\n  --analyzer-name account-analyzer \\\n  --type ACCOUNT\n\n# List active findings for external access\naws accessanalyzer list-findings \\\n  --analyzer-arn arn:aws:access-analyzer:us-east-1:123456789012:analyzer\u002Faccount-analyzer \\\n  --filter '{\"status\": {\"eq\": [\"ACTIVE\"]}}'\n\n# Generate a policy based on CloudTrail activity for a specific role\naws accessanalyzer start-policy-generation \\\n  --policy-generation-details '{\n    \"principalArn\": \"arn:aws:iam::123456789012:role\u002FAppRole\",\n    \"cloudTrailDetails\": {\n      \"trailArn\": \"arn:aws:cloudtrail:us-east-1:123456789012:trail\u002Fmanagement-trail\",\n      \"startTime\": \"2025-01-01T00:00:00Z\",\n      \"endTime\": \"2025-03-01T00:00:00Z\"\n    }\n  }'\n```\n\n### Step 3: Scope Policies to Specific Resources and Conditions\n\nReplace wildcard resource ARNs with specific resource identifiers. Add IAM policy conditions for MFA enforcement, source IP restrictions, and time-based access windows.\n\n```json\n{\n  \"Version\": \"2012-10-17\",\n  \"Statement\": [\n    {\n      \"Sid\": \"AllowS3ReadSpecificBucket\",\n      \"Effect\": \"Allow\",\n      \"Action\": [\n        \"s3:GetObject\",\n        \"s3:ListBucket\"\n      ],\n      \"Resource\": [\n        \"arn:aws:s3:::production-data-bucket\",\n        \"arn:aws:s3:::production-data-bucket\u002F*\"\n      ],\n      \"Condition\": {\n        \"Bool\": {\"aws:MultiFactorAuthPresent\": \"true\"},\n        \"IpAddress\": {\"aws:SourceIp\": \"10.0.0.0\u002F8\"},\n        \"DateGreaterThan\": {\"aws:CurrentTime\": \"2025-01-01T00:00:00Z\"}\n      }\n    }\n  ]\n}\n```\n\n### Step 4: Implement Permission Boundaries\n\nAttach permission boundaries to IAM roles and users to define the maximum scope of permissions an entity can receive, preventing privilege escalation even if an administrator attaches an overly permissive policy.\n\n```bash\n# Create a permission boundary policy\naws iam create-policy \\\n  --policy-name DeveloperPermissionBoundary \\\n  --policy-document file:\u002F\u002Fdeveloper-boundary.json\n\n# Attach the boundary to an IAM role\naws iam put-role-permissions-boundary \\\n  --role-name DeveloperRole \\\n  --permissions-boundary \"arn:aws:iam::123456789012:policy\u002FDeveloperPermissionBoundary\"\n```\n\n```json\n{\n  \"Version\": \"2012-10-17\",\n  \"Statement\": [\n    {\n      \"Sid\": \"AllowCommonServices\",\n      \"Effect\": \"Allow\",\n      \"Action\": [\n        \"s3:*\",\n        \"dynamodb:*\",\n        \"lambda:*\",\n        \"logs:*\",\n        \"cloudwatch:*\"\n      ],\n      \"Resource\": \"*\"\n    },\n    {\n      \"Sid\": \"DenyIAMChanges\",\n      \"Effect\": \"Deny\",\n      \"Action\": [\n        \"iam:CreateUser\",\n        \"iam:DeleteUser\",\n        \"iam:CreateRole\",\n        \"iam:DeleteRole\",\n        \"iam:AttachRolePolicy\",\n        \"iam:PutRolePermissionsBoundary\"\n      ],\n      \"Resource\": \"*\"\n    }\n  ]\n}\n```\n\n### Step 5: Enforce MFA and Eliminate Long-Lived Credentials\n\nRequire MFA for all human users accessing the AWS console and CLI. Migrate workloads from IAM user access keys to IAM roles with temporary credentials via STS AssumeRole.\n\n```bash\n# Enforce MFA via SCP at the organization level\naws organizations create-policy \\\n  --name RequireMFA \\\n  --type SERVICE_CONTROL_POLICY \\\n  --content '{\n    \"Version\": \"2012-10-17\",\n    \"Statement\": [\n      {\n        \"Sid\": \"DenyAllExceptMFA\",\n        \"Effect\": \"Deny\",\n        \"NotAction\": [\n          \"iam:CreateVirtualMFADevice\",\n          \"iam:EnableMFADevice\",\n          \"iam:ListMFADevices\",\n          \"iam:ResyncMFADevice\",\n          \"sts:GetSessionToken\"\n        ],\n        \"Resource\": \"*\",\n        \"Condition\": {\n          \"BoolIfExists\": {\"aws:MultiFactorAuthPresent\": \"false\"}\n        }\n      }\n    ]\n  }'\n\n# Deactivate unused access keys\naws iam update-access-key --user-name old-user --access-key-id AKIAEXAMPLE --status Inactive\n```\n\n### Step 6: Automate Continuous IAM Monitoring\n\nDeploy AWS Config rules and Security Hub controls to continuously evaluate IAM posture. Set up EventBridge rules to alert on high-risk IAM changes such as new root access key creation or policy modifications.\n\n```bash\n# Enable AWS Config rule for IAM password policy\naws configservice put-config-rule \\\n  --config-rule '{\n    \"ConfigRuleName\": \"iam-password-policy\",\n    \"Source\": {\n      \"Owner\": \"AWS\",\n      \"SourceIdentifier\": \"IAM_PASSWORD_POLICY\"\n    },\n    \"InputParameters\": \"{\\\"RequireUppercaseCharacters\\\":\\\"true\\\",\\\"RequireLowercaseCharacters\\\":\\\"true\\\",\\\"RequireSymbols\\\":\\\"true\\\",\\\"RequireNumbers\\\":\\\"true\\\",\\\"MinimumPasswordLength\\\":\\\"14\\\",\\\"MaxPasswordAge\\\":\\\"90\\\"}\"\n  }'\n\n# EventBridge rule to detect root account usage\naws events put-rule \\\n  --name DetectRootUsage \\\n  --event-pattern '{\n    \"detail-type\": [\"AWS API Call via CloudTrail\"],\n    \"detail\": {\n      \"userIdentity\": {\"type\": [\"Root\"]}\n    }\n  }'\n```\n\n## Key Concepts\n\n| Term | Definition |\n|------|------------|\n| Least Privilege | Granting only the minimum permissions required for an identity to perform its function |\n| Permission Boundary | An advanced IAM feature that sets the maximum permissions an entity can have, regardless of attached policies |\n| IAM Access Analyzer | AWS service that uses automated reasoning to identify resources shared externally and generate least-privilege policies from CloudTrail activity |\n| Service Control Policy (SCP) | Organization-level policy that sets permission guardrails across all accounts in an AWS Organization |\n| Assume Role | STS operation that returns temporary security credentials for cross-account or service-to-service access |\n| Credential Report | AWS-generated CSV listing all IAM users, their access keys, MFA status, and last activity timestamps |\n| Policy Condition | Constraints in IAM policies that restrict when and how permissions apply, such as MFA requirements or IP ranges |\n| Identity Federation | Allowing external identity providers to grant temporary AWS access without creating IAM users |\n\n## Tools & Systems\n\n- **AWS IAM Access Analyzer**: Generates least-privilege policies from CloudTrail activity and identifies resources shared with external entities\n- **AWS Config**: Continuously evaluates IAM configuration compliance against managed and custom rules\n- **AWS Security Hub**: Aggregates IAM security findings from Access Analyzer, Config, and third-party tools into a unified dashboard\n- **IAM Policy Simulator**: Tests the effects of IAM policies before deployment by simulating API calls against policy evaluation logic\n- **Prowler**: Open-source AWS security assessment tool that runs over 300 checks including IAM best practices and CIS benchmark controls\n\n## Common Scenarios\n\n### Scenario: Developer Role Over-Provisioned with AdministratorAccess\n\n**Context**: A startup attached the AWS-managed AdministratorAccess policy to all developer roles for speed during early development. A security audit reveals 15 roles with full account access while developers only use S3, Lambda, and DynamoDB.\n\n**Approach**:\n1. Enable IAM Access Analyzer and generate policy recommendations based on 90 days of CloudTrail data for each role\n2. Create scoped policies allowing only the specific S3 buckets, Lambda functions, and DynamoDB tables each team accesses\n3. Attach a permission boundary denying IAM, Organizations, and billing actions\n4. Deploy the new policies in a parallel role with CloudTrail monitoring before replacing the original\n5. Remove AdministratorAccess and rotate all access keys\n\n**Pitfalls**: Replacing policies without a parallel testing period causes service disruptions. Forgetting to scope Lambda:InvokeFunction to specific function ARNs leaves lateral movement paths open.\n\n### Scenario: Rotating Compromised Access Keys Across Multiple Services\n\n**Context**: An access key is found in a public GitHub repository. The key belongs to an IAM user with S3 and EC2 permissions across three AWS accounts.\n\n**Approach**:\n1. Immediately deactivate the compromised key using `aws iam update-access-key --status Inactive`\n2. Review CloudTrail logs for all API calls made with the compromised key in the past 30 days\n3. Create a new access key for the user and update all dependent services and CI\u002FCD pipelines\n4. Delete the compromised key after confirming all services use the new credentials\n5. Migrate the workload to use IAM roles with STS temporary credentials to prevent future key exposure\n\n**Pitfalls**: Deleting the key before deactivating it prevents forensic analysis of which services relied on it. Failing to check all three accounts for unauthorized activity leaves potential backdoors undetected.\n\n## Output Format\n\n```\nIAM Security Assessment Report\n==============================\nAccount ID: 123456789012\nAssessment Date: 2025-02-23\nAnalyzer: IAM Access Analyzer + Prowler v4.3\n\nCRITICAL FINDINGS:\n[C-001] Root account has active access keys\n  - Resource: arn:aws:iam::123456789012:root\n  - Remediation: Delete root access keys, enable MFA on root\n  - CIS Benchmark: 1.4 (Ensure no root account access key exists)\n\n[C-002] IAM user 'deploy-bot' has AdministratorAccess with no MFA\n  - Resource: arn:aws:iam::123456789012:user\u002Fdeploy-bot\n  - Last Activity: 2025-02-20\n  - Remediation: Replace with IAM role, enforce MFA condition\n\nHIGH FINDINGS:\n[H-001] 3 IAM policies use wildcard Resource \"*\" with sensitive actions\n  - Policies: DevPolicy, CIPolicy, LegacyAdminPolicy\n  - Remediation: Scope resources to specific ARNs using Access Analyzer\n\n[H-002] 7 access keys older than 90 days detected\n  - Users: svc-backup, svc-monitoring, dev-alice, dev-bob, ...\n  - Remediation: Rotate keys, migrate to role-based access\n\nSUMMARY:\n  Total Findings: 14\n  Critical: 2 | High: 4 | Medium: 5 | Low: 3\n  Compliance Score: 62% (CIS AWS Foundations Benchmark v3.0)\n```\n",{"name":5,"tags":25,"author":31,"domain":32,"license":15,"version":33,"mitre_f3":34,"nist_csf":57,"subdomain":62,"description":63,"mitre_attack":64},[26,27,28,29,30],"aws-iam","least-privilege","permission-boundaries","access-analyzer","cloud-identity","mahipal","cybersecurity","1.0.0",{"tactics":35,"version":38,"techniques":39},[36,37],"initial-access","positioning","1.1",[40,44,47,51,54],{"id":41,"name":42,"source":43,"tactic":36},"F1006.001","Account Takeover: Exposed API Key","f3",{"id":45,"name":46,"source":43,"tactic":36},"F1006.002","Account Takeover: Exposed Login Credential",{"id":48,"name":49,"source":50,"tactic":36},"T1550.001","Use Alternate Authentication Material: Application Access Token","attack",{"id":52,"name":53,"source":50,"tactic":36},"T1110.003","Brute Force: Password Spraying",{"id":55,"name":56,"source":43,"tactic":37},"F1005.004","Account Manipulation: Change Account Details",[58,59,60,61],"PR.IR-01","ID.AM-08","GV.SC-06","DE.CM-01","cloud-security","Hardens AWS IAM configurations to enforce least-privilege access, covering IAM policy scoping, permission boundaries, IAM Access Analyzer integration, and credential rotation strategies. Use when reducing the blast radius of compromised AWS identities, auditing overly permissive IAM policies, or setting up permission boundaries and Access Analyzer findings review across cloud accounts.\n",[65,66,67,68,69],"T1078.004","T1530","T1537","T1580","T1003","main","7540bbccf0c1ded6156a467b02c95b61ad62413f",".agents\u002Fskills\u002Fsecuring-aws-iam-permissions","https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu","https:\u002F\u002Fgithub.com\u002FNeelakshSaxena","Currently exploring the intersection of tech","2026-09-11 03:02:31",{"source":8,"skillName":5,"commands":78,"prompt":88,"zipAvailable":89},[79,82,85],{"tool":80,"command":81},"npx","npx skills add NeelakshSaxena\u002FVayu --skill securing-aws-iam-permissions",{"tool":83,"command":84},"bunx","bunx skills add NeelakshSaxena\u002FVayu --skill securing-aws-iam-permissions",{"tool":86,"command":87},"pnpm","pnpm dlx skills add NeelakshSaxena\u002FVayu --skill securing-aws-iam-permissions","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fsecuring-aws-iam-permissions\u002FSKILL.md",true,[91,95,101],{"path":92,"resourceType":92,"resourceTypeDesc":93,"sizeBytes":94,"sourceHtmlUrl":16},"LICENSE","许可证",11255,{"path":96,"resourceType":97,"resourceTypeDesc":98,"sizeBytes":99,"sourceHtmlUrl":100},"references\u002Fapi-reference.md","REFERENCE","参考文档",2325,"https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fsecuring-aws-iam-permissions\u002Freferences\u002Fapi-reference.md",{"path":102,"resourceType":103,"resourceTypeDesc":104,"sizeBytes":105,"sourceHtmlUrl":106},"scripts\u002Fagent.py","SCRIPT","脚本",7710,"https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fsecuring-aws-iam-permissions\u002Fscripts\u002Fagent.py",[108,115,122,129,136,143],{"skillNo":109,"name":110,"nameZh":6,"description":111,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":112,"categories":113,"keywords":114,"publishedAt":20},"01M7ACCCVNCFKMA9X6D15X6G98","runpodctl","Runpod CLI for managing GPU\u002FCPU workloads from the terminal — pods, serverless endpoints, templates, network volumes, Hub deploys, models, SSH, and file transfer (send\u002Freceive). Use for terminal\u002FCI\u002Fscripting, Hub browse\u002Fdeploy, SSH setup, `doctor`, or when the Runpod MCP tools are not connected. For structured tool calls in an MCP-enabled session, prefer runpod-mcp.","https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Frunpodctl\u002FSKILL.md",[],[],{"skillNo":116,"name":117,"nameZh":6,"description":118,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":119,"categories":120,"keywords":121,"publishedAt":20},"01M7ACC63SRHEA5KMCHSMZK2TC","runpod","Start here for any Runpod task — running GPU\u002FCPU pods, deploying serverless endpoints, templates, network volumes, building images, or understanding how Runpod works. Routes to the right skill (runpod-mcp, runpodctl, flash, companion-clis, runpod-usage, runpod-templates, runpod-migrate) and indexes two dozen live-verified end-to-end examples (golden paths) — use it when the lane is unclear, and for any multi-step or provisioning task even when it is not.","https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Frunpod\u002FSKILL.md",[],[],{"skillNo":123,"name":124,"nameZh":6,"description":125,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":126,"categories":127,"keywords":128,"publishedAt":20},"01M7ACC0Q1C89N9BZBV91CTQTF","runpod-usage","How Runpod works and how to work it — pods vs serverless, GPU\u002FVRAM selection, storage, building a container, networking, plus the agentic pod development loop (provision → ssh-exec → set up → poll readiness) and on-pod install hygiene (uv\u002Fapt). Use to answer \"how does X work\", \"which GPU\", \"how do I build a container\", or \"how do I stand up a workload on a pod\". Guidance, not a tool — execute with runpodctl, runpod-mcp, or flash.","https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Frunpod-usage\u002FSKILL.md",[],[],{"skillNo":130,"name":131,"nameZh":6,"description":132,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":133,"categories":134,"keywords":135,"publishedAt":20},"01M7ACBRPE345GF5GM5B8P8RRC","runpod-templates","Runpod's official prebuilt pod templates (ComfyUI, PyTorch, and others): what each image ships, which ports and paths it uses, how to pick one, how to pin a version, and what is missing on first boot. Use when a task says \"run \u003CX> on a pod\" and an official template already covers it, instead of building an image — and when a user needs help with or wants to fix something about a Runpod template they are already running (won't boot, can't reach the UI, missing models, wrong CUDA line, broken ComfyUI workflow metadata on imported workflows): start here and route onward. Deploy with runpodctl or runpod-mcp; end-to-end walkthroughs live in the runpod router's golden paths.","https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Frunpod-templates\u002FSKILL.md",[],[],{"skillNo":137,"name":138,"nameZh":6,"description":139,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":140,"categories":141,"keywords":142,"publishedAt":20},"01M7ACBJATHKVX1TWES2F44GY8","runpod-migrate","Migrate a codebase from the Runpod GraphQL API or REST v1 to REST v2 — inventory which parts use which API version, rewrite the call sites, flag breaking changes, and verify. Use when someone asks to move to v2, asks what v2 would change, or asks which Runpod API their code is on. For managing infrastructure rather than migrating code, use runpod-mcp or runpodctl.","https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Frunpod-migrate\u002FSKILL.md",[],[],{"skillNo":144,"name":145,"nameZh":6,"description":146,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":147,"categories":148,"keywords":149,"publishedAt":20},"01M7ACBC7GHVH6T9YEAPCG2AP8","runpod-mcp","Manage Runpod infrastructure — pods, serverless endpoints, jobs, templates, network volumes, container-registry auth, GPU\u002FCPU catalog, and billing — via the Runpod MCP server's structured tool calls. Use when the Runpod MCP tools (create-pod, list-endpoints, …) are connected in this session, or to connect them (hosted OAuth or local npx). Prefer this over runpodctl for plain infra CRUD when MCP is available; use runpodctl for the terminal, file transfer, or SSH setup.","https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Frunpod-mcp\u002FSKILL.md",[],[]]