# How to add unequal number of vpc settings to diff aws systems?

**URL:** <https://forum.serverless.com/t/how-to-add-unequal-number-of-vpc-settings-to-diff-aws-systems/16449>\
**Category:** Serverless Framework\
**Tags:** aws, lambda\
**Created:** [December 23, 2021, 9:42am UTC](https://forum.serverless.com/t/how-to-add-unequal-number-of-vpc-settings-to-diff-aws-systems/16449 "2021-12-23T09:42:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kashyapm94](https://avatars.discourse-cdn.com/v4/letter/k/f08c70/32.png) [@Kashyapm94](https://forum.serverless.com/u/Kashyapm94)\
**Post date:** [December 23, 2021, 9:42am UTC](https://forum.serverless.com/t/how-to-add-unequal-number-of-vpc-settings-to-diff-aws-systems/16449/1 "2021-12-23T09:42:46Z")

</div>

We have a code deployed in 2 different environments in aws: test system & prod system.

In the test system, we have 3 subnets & 1 security group which have to be attached to the lambda.

In the prod system, we have 1 subnet & 2 security groups that have to be attached to the lambda. ( I know it is not a good practice to have just 1 subnet).

I would like to declare these in the serverless.yml file itself. I tried

```auto
provider:
  name: aws
  runtime: python3.6
  stage: ${opt:stage, 'test'}
  lambdaHashingVersion: 20201221
  region: ${env:AWS_DEFAULT_REGION}
  vpc:
    securityGroupIds:
      - ${self:custom.securityGroupIds.${self:provider.stage}1}
      - ${self:custom.securityGroupIds.${self:provider.stage}2}
    subnetIds:
      - ${self:custom.subnetIds.${self:provider.stage}1}
      - ${self:custom.subnetIds.${self:provider.stage}2}
      - ${self:custom.subnetIds.${self:provider.stage}3}

custom:
  securityGroupIds:
    test1: sg-xxxxxxxxxxx
    test2: ''
    prod: sg-yyyyyyyyyyy
  subnetIds:
    test1: subnet-xxxxxxxxxx
    test2: subnet-yyyyyyyyyy
    test3: subnet-zzzzzzzzzz
    prod1: subnet-aaaaaaaaaa
    prod2: ''
    prod3: ''
  pythonRequirements:
    dockerizePip: non-linux

functions:
  ec-frankfurt:
    handler: lambda_function.lambda_handler
    timeout: 60
    memorySize: 512

```

When the code is deployed via CI/CD, it throws an error.

Is there a way how I can declare the vpc settings for this case?

Thanks
