How to create VPC shared between stages?

I’m creating some Resources (Lambdas, DynamoDB) that I want to run with a VPC. I have two stages: ‘dev’ and ‘test’. I’ve created the Resources with names including the stage name (e.g. ‘dev-lambda’, ‘test-lambda’, etc).

What I would like to do is have only 1 VPC, that contains all my ‘dev’ and ‘test’ Resources. Is this possible with a Serverless Framework config? I have seen the documentation about VPC Configuration but I’m unsure if this is for creating a VPC per stage, or a VPC for all stages?

Anyone able to help with this?

I’ve set the VPC in serverless.yml

  name: aws
  runtime: java8
  stage: ${opt:stage, 'dev'}
  region: eu-west-2
  memorySize: 1472
      - !Ref SubnetA
      - !Ref SubnetB
      - !Ref SecurityGroup

but this creates a VPC for each stage, within the Stack.

What i’d like it a VPC outside of the Stack, so one VPC can be assigned to Lambdas within several different Stacks

I think this post might help you. If not please let me know.