# Serverless deploying the Lambda function, but not attaching the VPC

**URL:** <https://forum.serverless.com/t/serverless-deploying-the-lambda-function-but-not-attaching-the-vpc/11999>\
**Category:** Serverless Framework\
**Tags:** aws, cloudformation, iam\
**Created:** [July 11, 2020, 3:04am UTC](https://forum.serverless.com/t/serverless-deploying-the-lambda-function-but-not-attaching-the-vpc/11999 "2020-07-11T03:04:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Johnbush](https://avatars.discourse-cdn.com/v4/letter/j/71e660/32.png) [@Johnbush](https://forum.serverless.com/u/Johnbush)\
**Post date:** [July 11, 2020, 3:04am UTC](https://forum.serverless.com/t/serverless-deploying-the-lambda-function-but-not-attaching-the-vpc/11999/1 "2020-07-11T03:04:24Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![bfieber](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/bfieber/32/653_2.png) [@bfieber](https://forum.serverless.com/u/bfieber)\
**Post date:** [July 13, 2020, 6:17pm UTC](https://forum.serverless.com/t/serverless-deploying-the-lambda-function-but-not-attaching-the-vpc/11999/2 "2020-07-13T18:17:15Z")

</div>

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

```auto
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

```

---

<div class="post-metadata">

**Author:** ![cvsudheer108](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/cvsudheer108/32/5991_2.png) [@cvsudheer108](https://forum.serverless.com/u/cvsudheer108)\
**Post date:** [July 14, 2021, 9:23am UTC](https://forum.serverless.com/t/serverless-deploying-the-lambda-function-but-not-attaching-the-vpc/11999/3 "2021-07-14T09:23:08Z")

</div>

> [@bfieber](#):
>
> subnetdIds

Also subnetdIds has a spelling mistake, should be : subnetIds
