Serverless deploying the Lambda function, but not attaching the VPC

I am facing an issue in attaching vpc for the Lambda function.sls deploy completes sucessfully but vpc not getting attached to the lambda function.

service: event-listener


provider:
  name: aws
  runtime: nodejs12.x
  deploymentBucket: listener-deployment
  stackTags:
    application: cloud
    Ou: iam
    environment: dev
  vpc:
      securityGroupIds:
        - sg-xxxxxxxx
      subnetdIds:
        - subnet-xxxxxxxx
        - subnet-xxxxxxxx
        - subnet-xxxxxxxx

functions:
  hello:
    handler: index.lambdaEvent
    name: event-listener
    description: DO-NOT-DELETE - Lambda function to push IAM event from Aws to the Application
    runtime: nodejs12.x
    role: arn:aws:iam::xxxxxxxx:role/lambda_basic_execution

please help me to understand what’s going wrong, I am not getting any errors in cloudformation stack.

Looks like you double indented the properties under the vpc.
securityGroupIds & subnetdIds should only be 2 spaced deeper than vpc

provider:
  name: aws
  runtime: nodejs12.x
  deploymentBucket: listener-deployment
  stackTags:
    application: cloud
    Ou: iam
    environment: dev
  vpc:
    securityGroupIds:
      - sg-xxxxxxxx
    subnetIds:
      - subnet-xxxxxxxx
      - subnet-xxxxxxxx
      - subnet-xxxxxxxx
1 Like

Also subnetdIds has a spelling mistake, should be : subnetIds

1 Like