Code Monkey home page Code Monkey logo

multi-cloud-vpn-terraform's Introduction

Multi-cloud VPN with AWS and GCP

Terraform templates to establish VPN connection between AWS and GCP.

Setup

Export your AWS credentials:

export AWS_ACCESS_KEY_ID=YOUR_AWS_KEY_ID
export AWS_SECRET_ACCESS_KEY=YOUR_AWS_SECRET_KEY

Export your google credentials per terraform docs:

export GOOGLE_PROJECT=$(gcloud config get-value project)
export GOOGLE_CREDENTIALS=$(cat ~/.config/gcloud/${USER}-*.json)

Run Terraform

There are a few parameters in the AWS Customer Configuration that cannot be extracted from the terraform attributes, a makefile automates the extraction of these fields and mananges a terraform.tfvars file.

First, add your EC2_SSH_PUB_KEY to the terraform.tfvars file so that you can ssh into the EC2 instance later:

echo "EC2_SSH_PUB_KEY = \"$(cat ~/.ssh/google_compute_engine.pub)\"" >> terraform.tfvars

Now, run the make target to provision the infrastructure:

make

SSH Into the Instances

The init scripts for the EC2 and GCE instsances automatically install and run iperf3 in server mode listening on port 80.

Run terraform output to see the IP adddresses used below.

Follow the steps below to ssh into either of the instances:

For GCP:

gcloud compute ssh --zone us-central1-a us-central1-iperf

For EC2:

ssh -i ~/.ssh/google_compute_engine ubuntu@ec2_instance_public_ip

Replace ec2_instance_public_ip with public IP of your ec2 instance.

Run iperf3

export TARGET=IP_OF_OTHER_INSTANCE
sudo iperf3 -c $TARGET -i 1 -t 60 -V -p 80

Replace IP_OF_OTHER_INSTANCE with the internal IP of the instance you are targeting.

References

multi-cloud-vpn-terraform's People

Contributors

danisla avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.