Hi, I’m trying to deploy a serverless API (based on v1.x) whose functions should be in a given vpc with a given security group but my deployment attempts are all failing.
The VPC, Subnets and security groups are all previously created. When I reference a vpc region under provider section at my serververless.yml, the stack creation/update procecess fails with an error: Your access has been denied by EC2, please make sure your function execution role have permission to CreateNetworkInterface. EC2 Error Code: UnauthorizedOperation. EC2 Error Message: You are not authorized to perform this operation.
If do ommit the vpc section and try to manually re-configure the functions in AWS web-console to be in the vpc/subnet/sg I got another error: Your role does not have VPC permissions. Please go back and select “Basic with VPC” under the role dropdown to add these permissions.
How should I do deploy my services with this required configuration? Is there a sample that anyone could share?
Ok, just found the answer on a github issue. In the end I had to declare the vpc under provider and delcare a managed-policy in the resource section to update the IAM role.