Works with the AI Agents you already use
AWS IAM Least Privilege Mapper
Audit and refactor AWS IAM policies, Terraform, and CloudFormation to eliminate wildcards and enforce least privilege.
$15
AWS IAM Least Privilege Mapper
Example session with this skill installed
Analyze this Terraform block and refactor it for least privilege: resource "aws_iam_policy" "example" { policy = jsonencode({ Statement = [{ Action = "s3:", Resource = "" }] }) }
- Read your context and instructions
- Compiled the aws iam least
I have analyzed the provided Terraform IAM policy. The original policy contained a critical security risk: global wildcard permissions (Action: "s3:*" and Resource: "*"). I have refactored this into a scoped policy restricted to specific operations and a placeholder ARN.
Refactored Scoped IAM Policy
# Refactored Terraform IAM Policy
# Domain: Cybersecurity & DevSecOps
# Pattern: Zero-Trust Least Privilege
resource "aws_iam_policy" "scoped_s3_access" {
name = "MicroserviceS3Access"
path = "/"
description = "Least-privilege policy for specific S3 bucket operations"
policy = jsonencode({
Version = "2012-10-17"
Statement = [
{
Sid = "AllowBucketListing"
Effect = "Allow"
Action = [
"s3:ListBucket"
]
# Replace with your specific bucket ARN
Resource = ["arn:aws:s3:::${var.bucket_name}"]
},
{
Sid = "AllowObjectOperations"
Effect = "Allow"
Action = [
"s3:GetObject",
"s3:PutObject",
"s3:DeleteObject"
]
# Replace with your specific bucket and path ARN
Resource = ["arn:aws:s3:::${var.bucket_name}/*"]
}
]
})
}
Next steps
- Replace
${var.bucket_name}with your specific target S3 bucket ARN in the Terraform configuration. - Apply the policy in a staging environment to verify that the microservice does not require additional actions like
s3:GetBucketLocation. - Review the
references/technical-guide.mdfile for further architectural patterns on resource-based scoping.
Connects securely to your tools. The creator never sees your data.
About this skill
Over-privileged IAM roles are a massive security liability waiting to be exploited. This skill audits your AWS IAM policies, Terraform HCL, and CloudFormation templates to strip away dangerous wildcards and enforce zero-trust security.
What it does
- Policy Parsing: Analyzes IAM JSON, Terraform
aws_iam_policyblocks, and CloudFormation templates for security flaws. - Wildcard Detection: Pinpoints dangerous permissions like
s3:*,dynamodb:*, and unauthorizediam:PassRoleusage. - Action Mapping: Maps broad permissions to the specific API actions required for your microservices.
- Least Privilege Synthesis: Generates scoped policies restricted by Resource ARNs and specific service actions.
How it works
- Input Analysis: Provide an IAM policy JSON or a Terraform file containing IAM resources.
- Risk Identification: The agent flags broad actions and missing resource constraints.
- Requirement Mapping: Define the target service or operation to determine necessary API calls.
- Policy Generation: The agent outputs a refactored, hardened policy ready for deployment.
Frameworks & tools
Works with AWS IAM JSON, Terraform HCL, and AWS CloudFormation. It is optimized for static analysis within modern DevSecOps pipelines.
Why this beats prompting it yourself
Generic LLMs often hallucinate AWS action names or fail to include necessary Resource ARNs. This skill follows a deterministic workflow to ensure every generated policy is cryptographically scoped and adheres to AWS security best practices without requiring live AWS credentials.
Use cases
- Refactoring legacy "Admin" roles into service-specific scoped policies.
- Auditing Terraform repositories for insecure IAM resource definitions.
- Hardening CI/CD pipelines by restricting deployment role permissions.
- Converting broad developer permissions into production-ready least privilege roles.
Known limitations
This tool performs static analysis only and does not make live AWS API calls to verify actual usage logs or CloudTrail data.
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Security.
Static analysis only. Does not integrate with live AWS CloudTrail logs. Limited to project workspace file access.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 4 days ago
File System Read/Write (strictly scoped to current project workspace `./`). Zero global installation or elevated privileges required.
Permissions
Target Use Cases: - Convert this wildcard AWS IAM policy to least privilege. - Audit Terraform IAM roles for security violations. - Eliminate s3: and passrole wildcards from cloudformation.