Assign Lambda Function To Specific VPC ID in serverless.yml

Viewed 6844

I am using Serverless framework to deploy a Python lambda function to AWS. In my serverless.yml file I have defined a function which I need to deploy to a VPC with specific ID as only that VPC has network connectivity needed to make some business related requests from the lambda function.

  customer_callback:
    vpc:
      subnetIds:
        - subnet-something
    handler: myservice/event_stream.customer_callback

In the documentation, the above example is what they mention as a way to attach the function to a VPC:

https://serverless.com/framework/docs/providers/aws/guide/functions/

However, the function is not deployed to a VPC at all, e.g. I end up with:

enter image description here

I have tried specifying VPC ID directly like this:

  customer_callback:
    vpc:
      id: vpc-something
    handler: myservice/event_stream.customer_callback

But that does nothing as well. The documentation for this issue is basically non-existent and I tried searching a lot so I finally have to post here to ask for help.

1 Answers
Related