How to create your private VPN on the cloud
Published: 2023-09-20 13:17:22

---
title: How to create your private VPN on the cloud
published: true
date: 2023-09-20 10:09:26 UTC
tags: 
canonical_url: https://blog.michaeltech.xyz/how-to-create-your-private-vpn-on-the-cloud
---

### Background

As the world around us gets more and more intertwined with the World Wide Web, the need to secure our Internet experience has never been more important than ever. With the rise of IOT (Internet of Things), we are seeing an increasingly digitalized world where almost everything has to be connected to the Internet to perform basic functions. The way the internet works, when we connect to the internet our ISPs(Internet Service Providers) allocate what is known as an IP address, an IP address can be easily described as an address used to identify a device on the internet, similar to the home address of an individual, which a postman uses to determine where specific letters (in digital terms packets of data) are eventually directed and sent to.

The major problem with surfing on the internet is that many times our browsing activities and transactions can be easily accessed and manipulated by malicious actors and hackers, this is where a VPN comes in, a VPN stands for Virtual Private Network it is used to encrypt and anonymize our activities on the web. , many users and organizations use it to secure their online activities that could be easily subjected to a cyberattack, many also use it to escape the limitation of location-based IP restrictions. VPN services are in quite demand, I will do a walkthrough on how we can easily build our own custom VPN server with the help of an opensource tool(OpenVPN) and using a cloud platform

We can create a server on any of the popular cloud platforms, most of these platforms offer basic free credits for the first few months of usage, I will demonstrate with the Azure cloud platform but it is basically the same step on other cloud platforms, we will create a compute instance where the OpenVPN tool is preinstalled using the OpenVPN Access Server, the tool has a free tier that allows for two VPN connections it can be easily accessed from the marketplace of any of the cloud platforms, a simple instance without much computing power will do the job.

### Setup Guide

From the Azure portal, search for '_Marketplace_', after navigating to Azure MarketPlace, search for OpenVPN, you will see the OpenVPN Access Server service

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1695124013953/4d6548fe-af95-4ff9-9344-412a66d30020.png)

When the service has been selected, create an administrator username and password for the instance. you can leave most of the default settings the same, with Azure there is an option to enable auto shutdown keep that off to enable our VPN to be always available.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1695124265906/a94bd4d1-1f0f-450e-97cc-46145ed849c5.png)

Once the instance has been created copy the public IP address it will be used to configure the OpenVPN server, after this is done SSH into the compute instance with your details.

```
 ssh openvpn@192.174.232.165

```

Read and accept the OpenVPN agreement and allow the default settings to be used, you can choose when you come to this option to create a different admin profile.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1695127225640/ade002fa-0b6e-4e32-b3cd-aec7331ac73a.png)

When this is all done, log into the OpenVPN Server admin section with your public IP address.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1695127461656/c6e05527-1f6f-4b30-8e4e-620d84bac8fa.png)

When inside, change the hostname to reflect your public IP address and save the settings. This is crucial to the VPN functionality as it should not be connected to a different IP address.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1695143536501/8273e3f2-bc7e-4c40-8888-23f16f40d53b.png)

After this is done, download the client software on your system or device and download your VPN user profile which will configure the client profile.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1695133917302/4877e97b-47cb-43f6-8f80-f371bc80c35d.png)

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1695134403383/b58dfa37-769c-4e11-a712-7bc7ac7e9561.png)

Input your password and connect to the VPN

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1695134485297/ef399c1e-55d5-445b-8f9d-4645345ac6f0.png)

You should be able to connect to the internet with the VPN server, now if you check your IP it should be the same as the one on your VPN profile.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1695136887592/b9b1ea05-6e82-4a52-8072-2d82db62f2b4.png)

Awesome! Your VPN is now up and running! This can also be further configured to fit your custom needs and requirements. Let me know in the comment section if you have any feedback or ideas about it.