cursor-rules / rules
Cursor rule8 starsChanged 19 months agoMITView on GitHub
AWS IAM Security Best Practices
Where files are headingNew Cursor rule files have more rules about planning and tracking tasks, and fewer about code style.
Of the Cursor rule files we read, the 1,533 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository17 other files it gives its agents.
- .cursor/rules/aws-bedrock.mdcCursor rule
- .cursor/rules/aws-cloudformation.mdcCursor rule
- .cursor/rules/aws-dynamodb.mdcCursor rule
- .cursor/rules/aws-eventbridge.mdcCursor rule
- .cursor/rules/aws-gamelift.mdcCursor rule
- .cursor/rules/aws-lambda.mdcCursor rule
- .cursor/rules/aws-sagemaker.mdcCursor rule
- .cursor/rules/aws-sam.mdcCursor rule
- .cursor/rules/aws-vpc.mdcCursor rule
- .cursor/rules/base.mdcCursor rule
- .cursor/rules/docs-structure.mdcCursor rule
- .cursor/rules/expo.mdcCursor rule
- .cursor/rules/nextjs.mdcCursor rule
- .cursor/rules/react.mdcCursor rule
- .cursor/rules/react-native.mdcCursor rule
- .cursor/rules/readme-documentation.mdcCursor rule
- .cursor/rules/typescript.mdcCursor rule
The file
Show its rules and text
We split this aws-iam.mdc into the rules it gives an agent
30 rules. About 0 are common, 30 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈30
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 18
Use specific ARNs instead of wildcards when possible
- Distinctive: line 19
Add conditions to further restrict access when appropriate
- Distinctive: line 22
Use policy variables to make policies more precise
- Distinctive: line 26
Create purpose-specific roles for different functions
- Distinctive: line 29
Use role paths to organize roles by application or service
- Distinctive: line 31
Document purpose and usage of each role
- Distinctive: line 36
Create function-specific IAM roles
- Distinctive: line 38
Use resource-based conditions for additional security
- Distinctive: line 40
Add X-Ray permissions if tracing is enabled
- Distinctive: line 42
Document all permissions in comments or metadata
- Distinctive: line 43
Follow the same-account principle for resource access
- Distinctive: line 46
Use resource policies to control API access
- Distinctive: line 48
Create API-specific roles for Lambda integrations
- Distinctive: line 52
Use IAM tags for access control when appropriate
- Distinctive: line 58
Use IAM policy conditions for attribute-level security
- Distinctive: line 59
Create separate roles for read and write operations
- Distinctive: line 63
Document access patterns in IAM policy comments
- Distinctive: line 67
Use specific resource ARNs for object access
- Distinctive: line 71
Use bucket policies in conjunction with IAM policies
- Distinctive: line 78
Use AWS managed policies as a starting point
- Distinctive: line 79
Create custom policies for specific requirements
- Distinctive: line 81
Use IAM Access Analyzer to identify issues
- Distinctive: line 88
Use cross-stack references for shared IAM resources
- Distinctive: line 90
Document policy decisions in code comments
- Distinctive: line 92
Use IAM policy templates for consistent patterns
- Distinctive: line 96
Use IAM roles instead of long-term access keys
- Distinctive: line 99
Create processes for emergency access
- Distinctive: line 101
Use session tags for dynamic permissions
- Distinctive: line 109
Use IAM Access Analyzer to identify unintended access
- Distinctive: line 110
Create dashboards for permission usage
≈ “Common” is an estimate: at least 1 in 5 of the 3,030 Cursor rule files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
--- description: AWS IAM Security Best Practices globs: alwaysApply: false --- --- Description: AWS IAM Security Best Practices Globs: **/iam/**/*.ts, **/iam/**/*.json, **/cdk/**/*.ts, **/sam/**/*.yaml, **/cloudformation/**/*.yaml --- # AWS IAM Development Standards @base.mdc @typescript.mdc ## IAM Policy Design - Apply the principle of least privilege for all IAM roles and policies - Grant only the minimum permissions necessary for the required task - Use specific ARNs instead of wildcards when possible - Add conditions to further restrict access when appropriate - Separate permissions by function or service - Review and audit IAM policies regularly - Use policy variables to make policies more precise - Implement resource-based policies where applicable ## IAM Role Structure - Create purpose-specific roles for different functions - Assign appropriate trust relationships to roles - Set appropriate session durations for assumed roles - Use role paths to organize roles by application or service - Implement proper cross-account role access patterns - Document purpose and usage of each role - Organize roles using proper naming conventions - Apply strict permission boundaries for delegated permissions ## Lambda Function IAM Roles - Create function-specific IAM roles - Grant only permissions needed by the specific Lambda function - Use resource-based conditions for additional security - Include CloudWatch Logs permissions for proper logging - Add X-Ray permissions if tracing is enabled - Implement resource-level permissions when possible - Document all permissions in comments or metadata - Follow the same-account principle for resource access ## API Gateway IAM Integration - Use resource policies to control API access - Implement proper IAM authentication for private APIs - Create API-specific roles for Lambda integrations - Separate roles for different API stages - Include proper CloudWatch Logs permissions - Implement custom authorizers with appropriate permissions - Use IAM tags for access control when appropriate - Apply API key restrictions correctly ## DynamoDB Access Control - Grant specific table-level permissions for operations - Implement fine-grained access control using IAM conditions - Use IAM policy conditions for attribute-level security - Create separate roles for read and write operations - Implement proper access controls for DynamoDB streams - Apply IAM conditions for specific key-based access - Restrict access to specific indexes when applicable - Document access patterns in IAM policy comments ## S3 Bucket Policies - Implement least privilege for bucket access - Use specific resource ARNs for object access - Apply proper conditions for public content when needed - Leverage VPC endpoint policies for private access - Implement IAM roles for cross-account access - Use bucket policies in conjunction with IAM policies - Apply proper encryption requirements in policies - Implement S3 Object Ownership correctly ## Security Best Practices - Enable and enforce MFA for critical operations - Implement proper key rotation for access keys - Use AWS managed policies as a starting point - Create custom policies for specific requirements - Implement proper credential management - Use IAM Access Analyzer to identify issues - Implement Service Control Policies for organization-wide controls - Monitor and alert on policy changes and unusual access patterns ## Infrastructure as Code - Define IAM resources using CloudFormation, SAM, or CDK - Parameterize environment-specific values - Use cross-stack references for shared IAM resources - Implement proper resource naming conventions - Document policy decisions in code comments - Validate IAM policy correctness before deployment - Use IAM policy templates for consistent patterns - Implement proper drift detection for IAM resources ## Temporary Credentials - Use IAM roles instead of long-term access keys - Implement proper AssumeRole patterns - Set appropriate permission boundaries - Create processes for emergency access - Implement proper role chaining for multi-account access - Use session tags for dynamic permissions - Apply proper service-linked role usage - Implement role assumption monitoring ## Auditing and Monitoring - Enable AWS CloudTrail for API activity monitoring - Set up alerts for sensitive IAM changes - Implement regular access reviews - Use IAM Access Analyzer to identify unintended access - Create dashboards for permission usage - Monitor unused permissions and access keys - Implement proper IAM credential reporting - Track and alert on policy version changes
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

