# Lambda Deploy into VPC

**URL:** <https://forum.serverless.com/t/lambda-deploy-into-vpc/5829>\
**Category:** Serverless Framework\
**Tags:** aws\
**Created:** [September 17, 2018, 5:14pm UTC](https://forum.serverless.com/t/lambda-deploy-into-vpc/5829 "2018-09-17T17:14:06Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chad](https://avatars.discourse-cdn.com/v4/letter/c/ecccb3/32.png) [@Chad](https://forum.serverless.com/u/Chad)\
**Post date:** [September 17, 2018, 5:14pm UTC](https://forum.serverless.com/t/lambda-deploy-into-vpc/5829/1 "2018-09-17T17:14:06Z")

</div>

I am trying to deploy a Lambda into a non-default VPC. The steps I took are,

serverless create --template aws-nodejs --path hello-world-sv  
I then edited the serverless.yaml file and added,

```auto
  vpc:
    securityGroupIds:
      - sg-98f38XXX
    subnetdIds:
      - subnet-978ffXXX
      - subnet-5e59fXXX

```

But however my lambda is not deployed in a VPC. Here is the full serverless config (removed comments),

```auto
service: hello-world-sv

provider:
  name: aws
  runtime: nodejs8.10
  vpc:
    securityGroupIds:
      - sg-98f38XXX
    subnetdIds:
      - subnet-978ffXXX
      - subnet-5e59fXXX
  stage: dev
  region: us-east-1

functions:
  hello:
    handler: handler.hello

```

(only change from actual was I masked a few of the subnet/security group values with XXX) Yes those subnets and security group exist in the VPC I want the lambda in. I can successfully add the VPC configuration via the console w/ the exact same ids I use in the serverless.yaml file, I see no reference to VPC in the resulting cloudformation template. I should note that when I add the vpc section to the serverless.yaml file the IAM Role is updated/created with the managed policy of ‘AWSLambdaVPCAccessExecutionRole’ added so at least that is working correctly.

Any help would be much appreciated.

serverless 1.31.0  
running command with a profile that has Administrator access to AWS env.

---

<div class="post-metadata">

**Author:** ![Chad](https://avatars.discourse-cdn.com/v4/letter/c/ecccb3/32.png) [@Chad](https://forum.serverless.com/u/Chad)\
**Post date:** [October 2, 2018, 10:57pm UTC](https://forum.serverless.com/t/lambda-deploy-into-vpc/5829/2 "2018-10-02T22:57:20Z")

</div>

Any idea how I could go about debugging this? Is there log files that indicate deploying the lambda into a VPC failed?

Thanks!

---

<div class="post-metadata">

**Author:** ![tulioliveira](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/tulioliveira/32/2807_2.png) [@tulioliveira](https://forum.serverless.com/u/tulioliveira)\
**Post date:** [November 30, 2018, 2:02pm UTC](https://forum.serverless.com/t/lambda-deploy-into-vpc/5829/3 "2018-11-30T14:02:49Z")

</div>

Hey there, Chad!

Did you find a solution to this? I’m having the same problem…

---

<div class="post-metadata">

**Author:** ![Chad](https://avatars.discourse-cdn.com/v4/letter/c/ecccb3/32.png) [@Chad](https://forum.serverless.com/u/Chad)\
**Post date:** [November 30, 2018, 8:00pm UTC](https://forum.serverless.com/t/lambda-deploy-into-vpc/5829/4 "2018-11-30T20:00:57Z")

</div>

Yes, my issue ended up being a misspelling of subnetIds as listed above (subnetdIds vs subnetIds)

---

<div class="post-metadata">

**Author:** ![tulioliveira](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/tulioliveira/32/2807_2.png) [@tulioliveira](https://forum.serverless.com/u/tulioliveira)\
**Post date:** [December 3, 2018, 10:40am UTC](https://forum.serverless.com/t/lambda-deploy-into-vpc/5829/5 "2018-12-03T10:40:24Z")

</div>

Oh, i see… I have a different problem them, thanks for the help!

---

<div class="post-metadata">

**Author:** ![bbarrington42](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/bbarrington42/32/7431_2.png) [@bbarrington42](https://forum.serverless.com/u/bbarrington42)\
**Post date:** [February 11, 2019, 9:55pm UTC](https://forum.serverless.com/t/lambda-deploy-into-vpc/5829/6 "2019-02-11T21:55:55Z")

</div>

I don’t have any typos and my vpc entry in serverless.yml is silently ignored. Any suggestions?  
Here’s the snippet from serverless.yml

```
vpc:
  securityGroupIds:
    - sg-1c3cfe65
  subnetIds:
    - subnet-d67b9ffc
    - subnet-76439300
```

---

<div class="post-metadata">

**Author:** ![paolo](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/paolo/32/3379_2.png) [@paolo](https://forum.serverless.com/u/paolo)\
**Post date:** [June 4, 2019, 11:31am UTC](https://forum.serverless.com/t/lambda-deploy-into-vpc/5829/7 "2019-06-04T11:31:38Z")

</div>

A bit late, but for the benefit of anyone else reading this: if you’ve previously deployed without VPC settings, and add VPC settings later, you seem to need to use `serverless deploy --force`.

---

<div class="post-metadata">

**Author:** ![MelMacaluso](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/melmacaluso/32/3978_2.png) [@MelMacaluso](https://forum.serverless.com/u/MelMacaluso)\
**Post date:** [November 6, 2020, 10:22am UTC](https://forum.serverless.com/t/lambda-deploy-into-vpc/5829/9 "2020-11-06T10:22:52Z")

</div>

Everyone reading this, as @paolo said this is the solution `serverless deploy --force`
