# How to create VPC shared between stages?

**URL:** <https://forum.serverless.com/t/how-to-create-vpc-shared-between-stages/9643>\
**Category:** Serverless Framework\
**Created:** [October 17, 2019, 11:23am UTC](https://forum.serverless.com/t/how-to-create-vpc-shared-between-stages/9643 "2019-10-17T11:23:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![JamesTAB](https://avatars.discourse-cdn.com/v4/letter/j/a6a055/32.png) [@JamesTAB](https://forum.serverless.com/u/JamesTAB)\
**Post date:** [October 17, 2019, 11:23am UTC](https://forum.serverless.com/t/how-to-create-vpc-shared-between-stages/9643/1 "2019-10-17T11:23:18Z")

</div>

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](https://serverless.com/framework/docs/providers/aws/guide/functions#vpc-configuration) but I’m unsure if this is for creating a VPC per stage, or a VPC for all stages?

---

<div class="post-metadata">

**Author:** ![JamesTAB](https://avatars.discourse-cdn.com/v4/letter/j/a6a055/32.png) [@JamesTAB](https://forum.serverless.com/u/JamesTAB)\
**Post date:** [October 21, 2019, 11:22am UTC](https://forum.serverless.com/t/how-to-create-vpc-shared-between-stages/9643/2 "2019-10-21T11:22:28Z")

</div>

Anyone able to help with this?

I’ve set the VPC in serverless.yml

```
provider:
  name: aws
  runtime: java8
  stage: ${opt:stage, 'dev'}
  region: eu-west-2
  memorySize: 1472
  vpc:
    subnetIds:
      - !Ref SubnetA
      - !Ref SubnetB
    securityGroupIds:
      - !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

---

<div class="post-metadata">

**Author:** ![hoang-innomizetech](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/hoang-innomizetech/32/3744_2.png) [@hoang-innomizetech](https://forum.serverless.com/u/hoang-innomizetech)\
**Post date:** [November 5, 2019, 4:01pm UTC](https://forum.serverless.com/t/how-to-create-vpc-shared-between-stages/9643/3 "2019-11-05T16:01:31Z")

</div>

I think [this post](https://dev.to/hoangleitvn/how-to-toggle-vpc-configuration-per-stage-4abp) might help you. If not please let me know.
