VPC Configuration
Last updated on
Acquiring Default Subnet ID
In the Amazon EC2 Console, go to VPC > Virtual Private Cloud > Your VPC.
Save your VPC ID (marked as Default VPC).
Go to VPC > Virtual Private Cloud > Your VPCs and select any of the subnets that have the same Default VPC ID. Copy the Subnet ID and paste it into your SAM Template.
# For network connectivity to AWS resources in a VPC, specify a list of security groups and subnets in the VPC.
# Required: Yes
# More info about VpcConfig https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-function-vpcconfig.html
VpcConfig:
SecurityGroupIds:
- ''
SubnetIds:
- ''
Acquiring Security Group ID
In the Amazon EC2 Console, go to VPC > Security > Security Groups.
Create a Security Group and fill out the Basic Details with the following fields:
- Input the Security Group Name and Description with a descriptive name for your group or project. In the below example, the Security Group Name has been called title-matchmaking-app.
- Choose the VPC with the Default VPC ID you created when acquiring the subnet ID.
Add rules to a security group. Create two inbound rules and one outbound rule.
- Create two Inbound Rules with the following parameters:
- Select the Type with a Custom TCP and define the port range. 6379 has been used in the example below.
- Select Anywhere for the Source to allow all traffic from the specified protocol to reach your instance. This option will automatically add a 0.0.0.0/0 IPv4 CIDR block as the source.
- (Optional) Specify the description of the Rule.
- Create one Outbound Rule with the following parameters:
- Select All as the Type. The protocol and port range will be configured automatically.
- Select Custom as the Destination. You will need to input the IP address in CIDR notation, a CIDR block, another security group, or a prefix list to allow outbound traffic.
- (Optional) Specify the description of the Rule.
- Create two Inbound Rules with the following parameters:
Click the Create Security Group button. An overview of your security group will be displayed. Copy the security group ID and paste it on your SAM Template.
# For network connectivity to AWS resources in a VPC, specify a list of security groups and subnets in the VPC.
# Required: Yes
# More info about VpcConfig https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-function-vpcconfig.html
VpcConfig:
SecurityGroupIds:
- ''
SubnetIds:
- ''