Deploy API Gateway and Lambda in different Security Group

Hi All,

Please bear with me as I have just stared working on serverless and I have many gaps in my understanding.
I have created a lambda function and an API gateway and able to deploy it inside a VPC and same security group using serverless.
But want to know how can I deploy the API gateway and Lambda function inside the same VPC but attached to different security groups.

I am not able to find any examples that match my criteria. Any guidance/samples would be highly appreciated.