This is a follow up post from the previous one, which walked through setting up an OpenVPN server on your own Amazon EC2 machine (for free!).
So, assuming you already have the server setup, lets continue by connecting an Android device to the OpenVPN server.
Create a new user
Navigate to the admin page of your OpenVPN server:
(Your browser may warn you about the https certificate safety issue, since we have not setup any https.)
In the menu, under "User management", select "User Permissions",
and create a new user named "android", and check "Allow autologin".
Hit "Save settings" and then the "Update running server" button at the top.
It should now look like this:
Hit the "Show" button for the android user, set a password for the user, and save and update the server.
Connecting a client the OpenVPN server
If you navigate to the OpenVPN main page:
You should now be able to login with your newly created user, and select "login" in the dropdown box:
This will give you a list of options for clients you can use to connect to your OpenVPN server:
You could now click and install the client for Windows or OS X, but instead, we are going to set it up on Android.
Connecting your Android device to the OpenVPN server
Download and install the OpenVPN Android app from Google Play.
We will now do the same step as above. Open a browser, and navigate to the OpenVPN main page:
(If you see the "Connection is not private" warning in Chrome, press Advanced, and the "Proceed" link at the bottom)
Login with the user you created.
At the bottom of the page, download the connection profile for: "Yourself (autologin profile)":
(If chrome does not let you download it, long-press the link, and select "Save link".
With the file now downloaded, click the client.ovpn from the Android pull down menu to open it in the OpenVPN app.
(or open the OpenVPN Android app, and go to Menu -> Import -> Import profile from SDcard. Navigate to the download location, most likely in your Downloads folder, and select the client.ovpn file. )
If the profile is successfully imported, you can now hit the Connect button.
Now your Android device should be connected to internet through the VPN.
You can check your ip adress, and see that it's now being tunneled through your AWS EC2 server. Go to www.whatismyip.com for example.
Data transfer may be a bit slower, since it's now going through a VPN.
For extra security
If you are planning on using the VPN when on for exmaple you are on a holiday, using hotel wifis only, you should enable the "Seamless tunnell" in the OpenVPN Android app settings.
This will only enable connections that go through the VPN.
Note: I have tried this myself, but it seems to not work in absolutely all cases. (It was probably because of a bug in Android 4.4.)
Did you manage to connect your device?