Here’s how I create my own VPN (Part 2)
My Motivation:
As a Non Resident of India (NRI), watching my favorite shows and movies were turning out to be difficult. Determined to resolve my situation I tumbled upon multiple ways to watch. But with each solution, came its own catch. And thus gave me motivation to create my own VPN using AWS.
I am linking the first part of the post here.
Do take a look at the takeaways too before you close the post :)
Steps:
- Creating an AWS account
- Start an EC2 instance with OpenVPN machine image
- Connect to your VPN server and configure it
- Connect to VPN as a client and start browsing your favorite Indian sites
Step 1: Creating an AWS account
Create a new AWS account using your email. You will be logged in as Root user and will be asked about personal details like name and address. Post this, you will be asked to enter your billing details but don’t worry as AWS is free of cost for 1 year for some of its services like EC2 t2.micro instance under the Free-tier policy.
At this point, if you are already past your Free-tier policy , then you can run the t2.nano as that’s the cheapest option. An EC2 server like the t2.micro and t2.nano are virtual machines hosted by AWS, in the cloud, which can be rented by customers, like us, as when needed.
At this point set your AWS region as Mumbai i.e. Asia Pacific (Mumbai)ap-south-1. This will ensure that the VPN server is located in India.
Step 2: Start an EC2 server with OpenVPN machine image
Search EC2 and “Launch Server” with OpenVPN Machine Image
OpenVPN is a free and open-source software. This OpenVPN Access Server AMI(Amazon Machine Image) is a paid commercial offering but the first option is a free version where only 2 clients can connect.
Create a key-pair login and download it.
Remember to download it as this is your only chance to download it. Its gonna help you login into your VPN server as Admin.
Finally hit launch. Once your server is running you’ll see something like this. Congratulations, you have your own personal VPN server. Let’s go and configure it.
Step 3: Connect to your server and configure it
Right click on the instance and click connect. You can use the EC2 Instance connect to do the upcoming steps on your web browser or you can use your own terminal. Do remember that in case you prefer to use the terminal of your PC, follow steps mentioned in the second image.
Agree through all the term and conditions and keep the values in default. Create a password for the admin account of your server and note it down.
Once everything is complete, you’ll receive the link for the admin page of your VPN server which we just created. Copy the admin URL link and past it in another tab. Note that your link would definitely look different than mine, as the public IPs generated for 2 instances are never same.
Your browser might determine the link as unsafe, but be assured that its safe because we have just created it. Click “Advanced” and “Proceed to xx.xxxx.xxxx.xx (unsafe)”. Once opened, the username will be “openvpn” and the password is as you set in the previous step.
Once you’re logged in go to “CONFIGURATION >> VPN Settings” and set “Should client Internet traffic be routed through the VPN?” to “YES”. Save the settings and click on “Update Running Server” to apply the setting on our server.
Step 4: Connect to VPN as a client
To connect as a client, go to your address bar and erase the address until the port number. For example, if the admin page is located at https://13.232.159.99:943/admin then the client page is located at https://13.232.159.99:943/
Login into the client using the same username and password. Once logged in select the device and OS you’re on and download the VPN client-app. This will start the download the VPN-application for your device. Install it, even if your OS suggests not to, because its an application created only for you.
Once installed, open the application and agree to term and conditions. And finally hit connect. You’ll be required to enter the password you set.
When finally connected, you can try opening your favorite Indian sites like JioCinema, Primevideo.in, zee5, sonyliv etc.
In case you’re still skeptical, google “What’s my IP” or visit https://whatismyipaddress.com/. I bet you will get something like this.
Incase you want to open websites on your phone (*remember you can connect 2 clients for free using this server*), you can download the vpn client for your mobile. You will need to move the downloaded application to your mobile device and install it and BOOM your mobile is connected via India too.
Takeaways
- Do remember about only 2 free-clients, if you want to connect more devices/clients to the VPN, do get the paid one
- Although for new AWS users, the t2.micro is free but its capped at 750 hours. So that means if you leave it ON you might incur charges after a month or two.
- I would suggest, to connect to the server when you need to watch a game or a series. Post that, please “STOP” your instance. In that way you will retain the configurations you did and start the server whenever you need to connect again.
- In case you decide to “STOP” your instance, kindly attach an Elastic IP to your instance , so that even after stopping and restarting your EC2 instance, your IP address doesn’t change.
- Alternatively you can “Terminate” your instance, but that would mean you would lose all your configurations and the server.
Conclusion
Creating your own VPN server and routing all your internet traffic through it is a safe way to browse the internet. Apart from viewing your favorite websites it all protects from hackers and other malicious entities who are trying to snoop on your data. Its really a 10 min procedure which will ensure you have a safe and secure way of connecting to your sites over the commercial offerings as they have been accused of snooping over user data in the past.
Thank You for reading the long post. Do connect with me if are stuck at any step experimenting through the process.