DEV Community

Cover image for Deploying OpenVPN on AWS
Muhammed Ashraf for AWS Community Builders

Posted on • Updated on

Deploying OpenVPN on AWS

When it comes to VPN, it may b important for your infrastructure to use, since you may have to serve private content without publicly exposing services on the internet.

For example: internal portals for employees typically need to be accessible only via a private network.

Thanks to AWS Community AMIs since it provides a verified AMI for the OpenVPN server.

In this article we will demonstrate how to setup an OpenVPN server on AWS EC2 instance and how to access it.

Below are mainly the features of OpenVPN server:

  • OpenVPN Access Server delivers the enterprise VPN to your business.

  • Protect your data communications and provide encrypted remote access to on-premise, hybrid, and public cloud resources.

  • Access Server provides you with a powerful and easy-to-use web-based admin site that makes VPN management and configuration in a simple way.

  • Access Server integrates OpenVPN server capabilities, enterprise access management, OpenVPN Client software packages works on different operating environments:
    Windows.
    MAC.
    Linux, and mobile OS (Android and iOS) environments.

  • OpenVPN offers different licensing model on AWS starting from 2 concurrent connection with no cost other than the AWS hardware costs

Solution Pre-requisites

  • AWS Account.
  • VPC with Public subnet to host the EC2 instance on it.
  • OpenVPN deployed on EC2 (Can be deployed from Marketplace).
  • A router supports VPN.

High Level Design

Image description

Implementation Steps

  1. Login into AWS console with your credentials.
  2. Search in the address for VPC and select VPC service
  3. Create a VPC any name you want with 1 public and 0 private subnet.
  4. Search for EC2 instance service and select it to start launching a new EC2 which will be working as VPN access server.
  5. Here we will select Browse AMI and search for OpenVPN
  6. Search for OpenVPN and select AWS Marketplace AMI
  7. Create a new key and select it then launch the instance in the provisioned VPC and public subnet
  8. After the instance is ready press connect and select SSH Client, I used Gitbash to connect to it using the key created, make sure to chmod to 400 of the key as per the instructions in SSH client tab.
  9. ssh -i “yourkey.pem" root@ecx-x-x-x-x.us-west-2.compute.amazonaws.com
  10. use sudo passwd openvpn to change the openvpn user password
  11. Navigate into your browser and paste the public ip of EC2 instance as below http://instance_public_ip:943/admin then enter username OpenVPN and password you created above
  12. Navigate on Configuration VPN Settings and make sure the client internet traffic to be routed through the VPN option is true.
  13. Press Update Running Server to reflect the configuration.
  14. Navigate into http://instance_public_ip:943/ and login into the page you will be redirect into this for me it will be windows.
  15. Enter your server configuration in the OpenVPN connect.

Top comments (0)