mtwtfss-serverless-names

0.0.13 • Public • Published

serverless-plugin-aws-resource-names

serverless

Serverless plugin to enable custom AWS resource names

Usage

Install the plugin to your project:

npm install serverless-aws-resource-names --save

Add the plugin and its configuration to your serverless project:

plugins:
  - serverless-aws-resource-names
custom:
  serverless-aws-resource-names:
    source: mapping.json

Create the mapping.json file in your project and modify the names to your hearts desire!

{
    "template": {
        "compiled": "cloudformation-template-update-stack.json",
        "core": "cloudformation-template-create-stack.json"
    },
    "stack": "$service-$stage",
    "role": {
        "Fn::Join": [
            "-", [
                "$service",
                "$stage",
                "$region",
                "lambdaRole"
            ]
        ]
    },
    "policy": {
        "Fn::Join": [
            "-", [
                "$stage",
                "$service",
                "lambda"
            ]
        ]
    },
    "apiGateway": "$stage-$service",
    "lambda": "$service-$stage-$lambda",
    "logGroup": "/aws/lambda/$service-$stage-$lambda"
}

Mapping Variable Reference

  • $service - Refers to the service attribute in your serverless.yml
  • $stage - Refers to the stage which you deploy to via serverless e.g. sls deploy -s dev
  • $region - Refers to the AWS region that you are deploying to. This is configured in your serverless.yml under the provider.region attribute or by your AWS CLI configuration.
  • $lambda - Refers to the name of your lambda function, defined in your serverless.yml under the functions attribute.
  • $rand - Globally replaces all instances with a random UUID.

Readme

Keywords

Package Sidebar

Install

npm i mtwtfss-serverless-names

Weekly Downloads

1

Version

0.0.13

License

MIT

Unpacked Size

15.3 kB

Total Files

7

Last publish

Collaborators

  • mtwtfss