Referencing SSM and CLI options in serverless.js and .ts

Hi Everyone!

I’ll preface my question with: I know there’s already a guide to configure a serverless stack with a serverless.yml file, but there’s no guide to do it with other file formats such as serverless.js or serverless.ts … The only thing I saw in the docs are:

For the sake of simplicity, most code snippet detailed in this documentation only refer to the serverless.yml YAML service file format. However, all functionalities work as well in the other available service file formats.

So my question is, in a .js or a .ts file, is there a way for me to reference CLI options (like the opt reference in yml) or even the ssm tag if I’m referencing something from ssm? There’s nothing in the docs about this.

I’ve tried stuff like this but all failed.

  • '${ssm:/some/api/api-key, ""}'
  • stage: '${self:provider.stage}'

This would be nice to have some documentation on as it doesn’t appear to work. Bit annoying, little things like this is what spoils Serverless as a good solution for production quality projects.

Hello just had the issue

the syntax :

     vpc: {
            securityGroupIds: ['${ssm:${self:custom.serverlessSsmFetch.LAMBDA_SECURITY_GROUP_IDS}}'], 
            subnetIds: ['${ssm:${self:custom.serverlessSsmFetch.LAMBDA_SUBNET_IDS}}]
        } 

worked for me.

As far as I understand you have to use the syntax as it would have been rendered while using serverless.yml template