Skip to content

Commit 0a083cd

Browse files
Changed steps how to set vpc settings
1 parent 0b6b5ca commit 0a083cd

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

README.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,21 @@ Achieving this can be a bit confusing if you're new to VPCs. When you create you
7070

7171
If you want to learn more, here's some more info on [VPCs in the context of RDS](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_VPC.WorkingWithRDSInstanceinaVPC.html) and on [security groups](https://docs.aws.amazon.com/vpc/latest/userguide/VPC_SecurityGroups.html).
7272

73-
Now, we just have to make sure that our Lambda is created within our VPC as well. For that just edit the AWS_VPC environment variables in the `.env.template` and they will be used in the `vpc` section of the `serverless.yml` file. You can find all these values in the RDS console under "Connectivity & Security". (As the securityGroupId it's enough to use the `default` one: this basically makes the Lambda function part of the VPC. There should be 3 subnetIds.)
73+
Now, we just have to make sure that our Lambda is created within our VPC as well. For that just use the AWS_VPC environment variables from the `.env.template` and add the following to the specifications of your `graphql` function in your `serverless.yml` file:
74+
75+
```
76+
vpc:
77+
securityGroupIds:
78+
"Fn::Split":
79+
- ","
80+
- ${env:AWS_VPC_SECURITY_GROUP_IDS}
81+
subnetIds:
82+
"Fn::Split":
83+
- ","
84+
- ${env:AWS_VPC_SUBNET_IDS}
85+
```
86+
87+
You can find all these values in the RDS console under "Connectivity & Security". (As the securityGroupId it's enough to use the `default` one: this basically makes the Lambda function part of the VPC. There should be 3 subnetIds.)
7488

7589
(You will also need to add `"iam:AttachRolePolicy"` to the permissions of the Serverless IAM role policy you will later create.)
7690

0 commit comments

Comments
 (0)