Lambda Deploy into VPC

aws

#1

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,

  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),

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.


#2

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

Thanks!


#3

Hey there, Chad!

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


#4

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


#5

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