Script that allows the easy creation of OpenVPN endpoints in any AWS region. To create a VPN endpoint is done with a single command takes ~3 minutes. It will create the proper security groups. It spins up a tagged ec2 instance and configures OpenVPN software. Once instance is configured an OpenVPN configuration file is downloaded and ready to use. There is also functionality to see which instances are running in which region and ability to terminate the instance when done. Additional functionality includes specifying instance type, generate ssh keypairs, specify custom ami, change login user and more to come.
Create on demand OpenVPN Endpoints in AWS that can easily be destroyed after done only pay for what you use.
1.)Create a virtualenv:
mkvirtualenv -p python3 env/ source env/bin/activate
2.)Install dependencies by running
pip install -r requirements.txt
3.)Ensure that you have an AWS .credentials file by running:
Then type in the following and add your keys (remove parenthesis):
[default] aws_access_key_id = (your_access_key_here) aws_secret_access_key = (your_secret_key_here)
4.)Install OpenVPN client (if needed)
1.Ensure dependencies are all installed.
2.Clone repo to system.
git clone https://github.com/ttlequals0/autovpn.git
3.To create SSH keypair execute autovpn with -G and -r options for AWS region of choice. (optional) NOTE: Make sure to add new key to your ssh-agent.
./autovpn -G -r us-east-1
4. Execute autovpn with -C -k and -r options to deploy to AWS:
./autovpn -C -r us-east-1 -k us-east-1_vpnkey
4. OpenVPN config files are downloaded to current working directory.
5.Import the OpenVPN config file and connect:
sudo openvpn us-east-1_aws_vpn.ovpn