The problem
If you've worked with AWS SAM templates long enough, you've probably run into messy or inconsistent resource names. These inconsistencies aren’t just an eyesore — they can cause confusion in large teams and complex deployments.
The solution
That’s why I created sam-resource-name-linter — a simple CLI tool to enforce consistent, configurable naming conventions for your AWS SAM resources.
It's a tool written in Javascript that scans your template.yaml
files and checks the logical resource names against a naming convention that you define.
It was built to help teams maintain readable, standardized CloudFormation templates — especially in larger serverless projects where consistency can quickly fall apart.
Key Features
✅ Works out of the box with sensible defaults
⚙️ Fully configurable naming conventions (regex-based)
🧪 Simple integration into CI/CD pipelines
How It Works
- Install the package globally or as a dev dependency:
npm install --save-dev sam-resource-name-linter
Create a new file called named
.sam-resource-name-rules.json
in the root directory of your SAM project.Configure the linter: Before running the linter, personalize your configuration file (
.sam-resource-name-rules.json
) by defining the resource naming rules that suit your project's needs.Execute the linter using the following command:
sam-resource-name-linter
Use Cases
- Team Enforcement: Codify naming rules in CI to enforce consistency across PRs.
- Legacy Cleanup: Identify resources that don’t follow your current naming patterns.
- Education: Teach new developers your team's conventions automatically.
Try It Out
👉 NPM: https://www.npmjs.com/package/sam-resource-name-linter
📖 GitHub: https://github.com/jbrizio/sam-resource-name-linter#readme
Top comments (0)