I’m having issues deploying lambdas with sls 1.14 into VPC. Any tips?
I’m following the info from the docs:
provider:
name: aws
runtime: nodejs6.10
stage: ${opt:stage, self:custom.default_stage}
region: us-east-1
profile: ${self:custom.profiles.${self:provider.stage}}
vpc:
securityGroupsIds:
- ${file(./serverless.env.yml):${self:provider.stage}.SECURITY_GROUP_1}
subnetIds:
- ${file(./serverless.env.yml):${self:provider.stage}.SUBNET_1}
- ${file(./serverless.env.yml):${self:provider.stage}.SUBNET_2}
This results in no VPC configuration for any of the lambdas in the project. You can see I’m trying to use environment variables above, I’ve tried also with explicit strings and putting the vpc config down on the function.Nothing! I’ve looked at the compiled cloud formation - I dont see anything about these security groups or subnets in there. What am I doing wrong?
I tried all solutions exposed here and in other topics but I still fail configuring a lambda to connect to an existing VPC: the lambda is always in “NO VPC”. I use sls 1.26.0. This is my serverless.yml file (I replace sensitive data by xxx):
slowly learning my way through SERVERLESS - One question I have for the group, in a deployment can serverless CREATE vpc, subnets, and security groups ?? I can see here where it can be inserted into and conjunction with those structures, but on a green field deployment can it actually create those AWS resources ?? If not, then what tool are people using to create those objects which server does not create and how are those objects then passed to awaiting serverless, so it can run round 2 ??
@jorgedlt Serverless uses CloudFormation to setup resources. Anything you can setup with CloudFormation you can add to the resources section of your serverless.yml and serverless will set it up during deployment.
Thanks Buggy - My other DEV friends have come back with the same answer so I’ll follow that advise.
– As follow on question; Since some of the foundation based objects are to be deployd with CF and SLS would come as a second “layer”; Is there a way to have SLS know about or be aware of the previous CF layer or deployment??