MCPcopy Index your code
hub / github.com/awslabs/serverless-rules

github.com/awslabs/serverless-rules @v0.3.5

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.3.5 ↗ · + Follow
241 symbols 554 edges 63 files 204 documented · 85%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Serverless Rules

The Serverless Rules are a compilation of rules to validate infrastructure as code template against recommended practices. This currently provides a module for cfn-lint and a plugin for tflint.

You can use those rules to get quick feedback on recommended practices while building a serverless application, as part of automated code review process, or as guardrails before deploying to production.

📜Documentation | 🐍PyPi

PUBLIC PREVIEW: this project is currently in public preview to get feedback from the serverless community. APIs, tools, and rules might change between the beginning of public preview and version 1.

You can find a list of currently supported rules in the documentation.

Usage guide

cfn-lint

To get started with Serverless Rules and cfn-lint, install cfn-lint-serverless module: pip install cfn-lint cfn-lint-serverless

You can now instruct cfn-lint to use Serverless Rules module installed previously via --append-rules or -a for short:

cfn-lint my_template.yaml -a cfn_lint_serverless.rules

You can try with a Serverless Application Model (SAM) example provided in this repository by running:

cfn-lint examples/sam/template.yaml -a cfn_lint_serverless.rules

tflint

This plugin depends on tflint. If you use tflint version 0.29 or newer, you can leverage the tflint --init command to automatically install the plugin. Otherwise, you will need to download the tflint-ruleset-aws-serverless binary corresponding to your system from the releases page.

You can enable the Serverless Rules plugin by adding a plugin section in the .tflint.hcl file in your project:

plugin "aws-serverless" {
  enabled = true
  version = "0.3.5"
  source = "github.com/awslabs/serverless-rules"
}

Contributing

See CONTRIBUTING to learn how to contribute to this project.

Security

See CONTRIBUTING for more information.

License

This library is licensed under the MIT-0 License. See the LICENSE file.

Core symbols most depended-on inside this repo

NewAwsLambdaPermissionMultiplePrincipalsRule
called by 10
tflint-ruleset-aws-serverless/rules/aws_lambda_permission_multiple_principals.go
Name
called by 8
tflint-ruleset-aws-serverless/rules/aws_iam_role_lambda_no_star.go
NewAwsLambdaFunctionEolRuntimeRule
called by 6
tflint-ruleset-aws-serverless/rules/aws_lambda_function_eol_runtime.go
NewAwsLambdaEventInvokeConfigAsyncOnFailureRule
called by 6
tflint-ruleset-aws-serverless/rules/aws_lambda_event_invoke_config_async_on_failure.go
NewAwsAPIGatewayMethodSettingsThrottlingRule
called by 6
tflint-ruleset-aws-serverless/rules/aws_api_gateway_method_settings_throttling.go
NewAwsApigatewayV2StageThrottlingRule
called by 6
tflint-ruleset-aws-serverless/rules/aws_apigatewayv2_stage_throttling.go
NewAwsLambdaFunctionTracingRule
called by 5
tflint-ruleset-aws-serverless/rules/aws_lambda_function_tracing.go
NewAwsApigatewayStageStructuredLoggingRule
called by 5
tflint-ruleset-aws-serverless/rules/aws_api_gateway_stage_structured_logging.go

Shape

Method 145
Function 52
Struct 25
Class 19

Languages

Go75%
Python25%

Modules by API surface

cfn-lint-serverless/cfn_lint_serverless/rules/lambda_.py21 symbols
tflint-ruleset-aws-serverless/rules/aws_iam_role_lambda_no_star.go11 symbols
cfn-lint-serverless/cfn_lint_serverless/rules/api_gateway.py11 symbols
tflint-ruleset-aws-serverless/rules/aws_lambda_permission_multiple_principals.go8 symbols
tflint-ruleset-aws-serverless/rules/aws_lambda_function_tracing.go8 symbols
tflint-ruleset-aws-serverless/rules/aws_lambda_function_eol_runtime.go8 symbols
tflint-ruleset-aws-serverless/rules/aws_lambda_function_default_timeout.go8 symbols
tflint-ruleset-aws-serverless/rules/aws_lambda_function_default_memory.go8 symbols
tflint-ruleset-aws-serverless/rules/aws_lambda_event_invoke_config_async_on_failure.go8 symbols
tflint-ruleset-aws-serverless/rules/aws_cloudwatch_log_group_lambda_retention.go8 symbols
tflint-ruleset-aws-serverless/rules/aws_api_gateway_stage_logging.go8 symbols
tflint-ruleset-aws-serverless/rules/aws_sqs_queue_redrive_policy.go7 symbols

For agents

$ claude mcp add serverless-rules \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact