How to Setup an AWS Client VPN Using OpenVPN on EC2

In this tutorial, we will explore how to set up a basic client VPN on Amazon Web Services (AWS) EC2 using OpenVPN Access Server. The scenario involves establishing a VPN connection between your on-premises client and the private network within AWS. By the end of this step-by-step guide, you’ll be able to access your AWS cloud resources, such as other EC2 instances, securely and efficiently.

Before you start, you need to create a Virtual Private Cloud (VPC) to launch the OpenVPN on that VPC. We already have a tutorial on how to create your own VPC on AWS here.

Step 1: Sign in to AWS Console

Open your web browser and go to the AWS Management Console (console.aws.amazon.com).

Sign in with your AWS account credentials.

Screenshot showing login page of aws

Step 2: Navigate to EC2 Dashboard

Once you’re logged in. In the search bar search  “EC2” and click on the EC2.

Screenshot showing selecting the AWS EC2 Service

Step 3: Creating an EC2 instance 

First select the region that you want to create the VPN on. 

Then click on the “Launch Instance” button as shown in the picture below.

Screenshot showing selecting the region and launching the aws instance

Step 4: Setting up the EC2 details

Give the name of the ec2 instance.

Click on browse more AMIs.

Screenshot showing browsing the OpenVPN AMI

Search “openvpn” on the search bar.

Click on the “Select” next to OpenVPN Access Server and then the “Continue” button.

Screenshot showing searching the AMI

Now you can see the details required to launch the OpenVPN are filled automatically.

Screenshot showing details of the AWS instances

By default there will be a “t2.small” instance selected. Let’s select the Free tier eligible “t2.micro” instance. 

Screenshot showing selecting the t2.micro instance

On the Key pair(login) section. Click on “Create new key pair.” We need to ssh into that instance for the setup of OpenVPN and for that we need a key pair file. (store this file securely, because it contains the information about the instances)

Screenshot showing creating a key pair for instance

Provide a name for your key pair and select RSA and .pem as key pair format and click on “Create key pair.” It will automatically download the .pem file on your device. (you can also use the .ppk file format if you are using a third-party ssh client like PuTTY). 

Screenshot showing providing the key pair details

Leave all the things as default and click on “Launch Instance.” We are leaving all the details as it is which was suggested by the AMI that we choose from AWS Marketplace. 

(If you want to use your own VPC, Subnet, and Security Group you can select those from the Network Setting tab by clicking the “Edit” button)

Screenshot showing launching the instance

Wait for the instance to be launched and running with status checked as 2/2 checks passed.

Screenshot showing checking the instance state

Step 5: Connecting to the instance 

Select the instance that we have created and click on “Connect.”