On-Demand VPN Server with OpenVPN

A key advantage of EC2 is that you can start and stop server instances as you need them and only pay for the time the server is running. This capability is most often useful for increasing and decreasing the number of servers you have running in response to changing demands on a web application. In this application, however, we will use an on-demand server in a very different situation. We will demonstrate how to set up an EC2 instance to run a Virtual Private Network (VPN) server that you can use to secure your network traffic when you access the Internet over an untrusted network.

It is becoming increasingly common for people to access the Internet through public access points, such as WiFi hotspots, wired networks provided by hotels, or the internal networks of companies you may be visiting. The availability of Internet access points is fantastic when you are away from work or home, but this convenience comes with risks when you cannot be sure that the network is secure and safe from snooping. The best way to protect your data when using an untrusted network is to use a VPN to encrypt it.

In this application, we will create an EC2 instance that runs the open-source VPN server OpenVPN (http://openvpn.net/). OpenVPN is a freely-available, powerful, and highly configurable VPN server; best of all, it is relatively simple to set up compared to most other VPN servers.

We will configure the server to use a secret key such that only you, the owner of the ...

Get Programming Amazon Web Services now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.