Skip to content

Commit

Permalink
Changed steps how to set vpc settings
Browse files Browse the repository at this point in the history
  • Loading branch information
tinymarsracing authored Mar 22, 2019
1 parent 0b6b5ca commit 0a083cd
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,21 @@ Achieving this can be a bit confusing if you're new to VPCs. When you create you

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).

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.)
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:

```
vpc:
securityGroupIds:
"Fn::Split":
- ","
- ${env:AWS_VPC_SECURITY_GROUP_IDS}
subnetIds:
"Fn::Split":
- ","
- ${env:AWS_VPC_SUBNET_IDS}
```

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.)

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

Expand Down

0 comments on commit 0a083cd

Please sign in to comment.