Sample Serverless.yml for multiple AWS accounts needed!

Personally we do the following:

custom:
  defaultStage: dev
  profiles:
    dev: dev
    prod: prod
    test: dev
provider:
  stage:  ${opt:stage, self:custom.defaultStage}
  region: us-east-1
  profile: ${self:custom.profiles.${self:provider.stage}}

Setup multiple AWS accounts as others above have mentioned and then you just need to specify the stage and it automatically will select the correct profile to use; dev and test use our dev acc, prod the prod account.

Tailor as you see fit,
Ryan

3 Likes