How to define custom authorizer ARN once in config

Hi Chaps,

using the latest version of Serverless v1.0.0

I recently hit the 200 resource limit and had to break my single Serverless Service into multiple smaller Services and glue it altogether with a build script.

For the most part everything seems ok but I would like to try and improve one thing.

I am using a custom authorizer which is part of one of the Services. All the other Services that use the Authorizer are referencing it like so

authorizer: arn:aws:lambda:eu-west-1:271483244231:function:authorize

that means throughout my serverless.yml i have the above specified near on 200 times. Is there a way I can define it once, in a single place and then just reference it everywhere else?

kind regards,

How about an external variable file: https://serverless.com/framework/docs/guide/serverless-variables/

You could also look into the cross stack referencing as defined here: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/walkthrough-crossstackref.html

Thanks flomotlik that’s perfect

1 Like