VPC peering
At installation time, RunsOn created a new VPC and subnets in the region you selected. Sometimes, you have existing (private) resources in another VPC, and you want to be able to reach them from the runners launched by RunsOn (e.g. Kubernetes cluster, internal services, etc.).
This is where VPC peering comes into play.
AWS provides a (free) service called VPC peering โ that allows you to connect two VPCs together. Until v2.5.0 you had to do this manually or with something like Terraform, but RunsOn now provides a CloudFormation template that you can use to set up VPC peering between RunsOnโs VPC and your existing VPC.
Select the region
To get started, simply select the region where your existing RunsOn stack resides.
This will redirect you to the CloudFormation interface:
Fill in the CloudFormation stack parameters
The CloudFormation stack accepts 3 parameters:
-
RunsOnStackName:
- Type: String
- Description: โName of the existing CloudFormation stack for RunsOn.โ
- Default: โruns-onโ
-
DestinationVpcId:
- Type: AWS::EC2::VPC::Id
- Description: โID of the destination VPC to peer with.โ
-
DestinationVpcCidr:
- Type: String
- Description: โCIDR block of the destination VPC.โ
- Default: โ10.0.0.0/16โ
Once you have filled in the parameters, you can click on the โCreate stackโ button to create the stack. It will add the necessary routes to your existing RunsOn VPC to allow the runners to reach your private resources.
Create a route back to RunsOn VPC in your existing VPC
The only manual step left is to create a route in the route tables of your existing VPC so that traffic can flow back from your private resources to the runners in RunsOn VPC:
If you wanted to automate the route creation (e.g. with Terraform or a script), you can use the following output parameters exposed by the CloudFormation stacks:
RunsOnVpcPeeringConnectionId
, exposed by the VPC peering stack.RunsOnVpcCidrBlock
, exposed by the RunsOn stack.
As an example, you can then use the following AWS CLI command to create the route: