For the Lambdas that have to exist in a private subnet of the VPC, an internet gateway has to be created. The following code block has to be added under the Resources section of the vpc.yml file, at the same level as the letsPollVPC element. The following code block shows the way it is done:
letsPollIGW: Type: AWS::EC2::InternetGateway letsPollVPCGatewayAttachment: Type: AWS::EC2::VPCGatewayAttachment Properties: VpcId: Ref: letsPollVPC InternetGatewayId: Ref: letsPollIGW
A few points to note for the preceding code:
- We created an Internet Gateway using the AWS::EC2::InternetGateway CloudFormation type.
- We attached the newly created gateway to the letsPollVPC using the AWS::EC2::VPCGatewayAttachment ...