Lambda Deploy into VPC

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,

      - sg-98f38XXX
      - subnet-978ffXXX
      - subnet-5e59fXXX

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

service: hello-world-sv

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

    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.

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


Hey there, Chad!

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

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

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

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

    - sg-1c3cfe65
    - subnet-d67b9ffc
    - subnet-76439300

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.


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