Basic OpenVPN server using IAC(Terraform) & AWS.
- Terraform 12 https://www.terraform.io/downloads.html
- AWS Account https://aws.amazon.com/
- AWS CLI https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html
- Clone the repo
- Make sure you have an AWS account and installed AWS CLI on your system. Follow this article for more info on how to create a credential file for your AWS CLI. https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html
- Update public key in
04-instance.tf
aws_key_pair
resource to use your own. Your Public key can be found via terminal usingcat ~/.ssh/key_name.pub
command. - Open
variables.tfvars
and update themy_ip
variable to use your own public IP address. To retrieve your public ip you can executecurl ifconfig.co
via the terminal. - Once all the variables have been updated execute
make vpn
from the terminal and once terraform asks for an input enteryes
to let terraform build your environment. - After your environment has been setup you can ssh into your ec2-instance using your private key
ssh -i ~/.ssh/private_key
. - Once you successfully are able to access your instance please follow this article by OpenVPN as to how you want to configure your OpenVPN server. https://openvpn.net/vpn-server-resources/amazon-web-services-ec2-byol-appliance-quick-start-guide/. You can follow the steps of the OpenVPN server setup until your reach the
Changing_Default_Timezone
section as terraform does rest of the stuff. - Once installed login with your local instance credentials username
openvpn
and to set the user password please executesudo passwd openvpn
to set a password for the user. After configuration is complete you can head over tohttps://your_ip:943/?src=connect
to download your VPN profile for your system. - To connect system to VPN you will need to download a VPN Client e.g. Tunnelblick or OpenVPN Connect (can be found in the profile page) as seen below.
- Execute
make destory
to remove all infrastructure
Feel free to make an PR's or raise any issues 😀