Terraform declarations for Single node OpenVPN infrastructure. You can have your pay as you go personal VPN in minutes! And you can destroy your environment whenever you want!
Terraform v0.11.3
Check your version.
$ terraform -v
Install Terraform
, you can use brew if you're on Mac OS X.
$ brew install terraform
Make sure you provided AWS credentials to your environment.
You can simply export:
export AWS_ACCESS_KEY_ID=(your access key id)
export AWS_SECRET_ACCESS_KEY=(your secret access key)
Or, you can use something like awsudo if you are using multiple accounts in your system:
$ awsudo -u personal env | grep AWS
AWS_ACCESS_KEY_ID='<jadajada>'
AWS_SECRET_ACCESS_KEY='<blablabla>'
To provision remote machine, Terraform
needs to access that machine, for that you have to add your SSH key to your local ssh-agent
, so Terraform
can find:
$ ssd-add # Adds default ssh key
$ ssd-add ~/.ssh/my-jada-jada-key # Adds a specific ssh key
Then plan your changes:
$ terraform plan
If everything is ok, you should see something like:
If everything looks good, you can apply your plan, it will take couple of minutes:
$ terraform apply
If everything is ok, you should see something like:
Booom! You did it!
Use generated file with an OpenVPN client. In OS X, you can install one with brew
.
$ brew install openvpn
Then,
$ sudo openvpn --config awesome-personal-vpn.ovpn
$ sudo openvpn --config awesome-personal-vpn.ovpn --deaemon # as daemon
$ sudo -b openvpn --config awesome-personal-vpn.ovpn # run in background
If you want a GUI client, you can use Tunnelblick for Mac OS X, with Tunnelblick is installed, just go to your console:
$ open awesome-personal-vpn.ovpn
If you want to configure your VPN, you can pass following parameters.
$ terraform apply \
-var "aws_region=JADA" \
-var "ssh_remote_user=JADA"
-var "ssh_public_key_path=JADA" \
-var "vpn_data=JADA" \
-var "vpn_port=1234" \
-var "vpn_client_name=JADA"
Your VPN is ready! Have fun!
Special thanks to @kylemanna for docker-openvpn
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request
We use SemVer for versioning. For the versions available, see the tags on this repository.
- Kemal Akkoyun - Initial work - kakkoyun
See also the list of contributors who participated in this project.
This project is licensed under the GNU General Public License v3.0 - see the LICENCE file for details