LogoLogo
DownloadBlog
  • Overview
  • Getting started
    • Meshnet explained
    • How to start using Meshnet
      • Using Meshnet on Windows
      • Using Meshnet on Android
      • Using Meshnet on iPhone/iPad
      • Using Meshnet on macOS
      • Using Meshnet on Linux
      • Using Meshnet on Android TV
    • How to use Meshnet securely
  • Features
    • Linking devices in Meshnet
      • Linking external Meshnet devices on Windows
      • Linking external Meshnet devices on Android
      • Linking external Meshnet devices on iPhone/iPad
      • Linking external Meshnet devices on macOS
      • Linking external Meshnet devices on Linux
      • Linking external Meshnet devices on Android TV
    • Explaining permissions
      • Remote access permissions
      • File sharing permissions
      • Traffic routing permissions
      • Local network permissions
    • Renaming devices in Meshnet
      • Renaming devices on Windows
      • Renaming devices on Android
      • Renaming devices on iPhone/iPad
      • Renaming devices on macOS
      • Renaming devices on Linux
    • Sharing files in Meshnet
      • Sharing files on Windows
      • Sharing files on Android
      • Sharing files on iPhone/iPad
      • Sharing files on macOS
      • Sharing files on Linux
      • Sharing files on Android TV
    • Routing traffic in Meshnet
      • Routing traffic from Windows
      • Routing traffic from Android
      • Routing traffic from iPhone/iPad
      • Routing traffic from macOS
      • Routing traffic from Linux
      • Routing traffic from Android TV
  • How-to guides
    • Gaming
      • How to set up a private Minecraft server with Meshnet
      • How to set up a private Stardew Valley server with Meshnet
      • How to play Quake 3 Arena over Meshnet
      • How to set up a private Team Fortress 2 server with Meshnet
      • How to set up a remote game-streaming server for Moonlight
      • How to set up a Palworld dedicated server
      • How to play Fallout: New Vegas multiplayer over Meshnet
      • How to set up a private Factorio server with Meshnet
    • Remote files and media access
      • How to set up and access shared folders
        • Configure and access shared folders on Windows
        • Configure and access shared folders on macOS
        • Configure and access shared folders on Linux
        • Access shared folders from Android
        • Access shared folders from iPhone/iPad
        • Access shared folders from Android TV
      • How to watch videos over Meshnet using Kodi
      • How to configure and access a Jellyfin media server remotely
      • How to set up a Plex media server and access it remotely
      • How to set up a remote NAS using OpenMediaVault and Meshnet
      • How to set up a remote picture library with LibrePhotos and Meshnet
      • How to use Syncthing for remote continuous file synchronization
      • How to set up a remote Airsonic music server
      • How to set up HTTP File Server for remote file access
      • How to set up a remote audiobook server
      • How to host a remote Kavita e-book server
      • How to set up and remotely access Immich using Meshnet
    • Remote device access
      • How to log in to your PC remotely over Meshnet
        • Connect to a Windows device
        • Connect to a macOS device
        • Connect to a Linux device
      • How to access remote systems over Meshnet using SSH
      • How to access your IP camera over Meshnet
      • How to use Home Assistant remotely over Meshnet
      • How to make secure macOS Time Machine backups from anywhere
      • How to use Ansible over Meshnet
      • How to access files in your NAS from anywhere without compromising its security
      • How to set up a phone as a security camera with remote access
      • How to assign custom host names to Meshnet services using Nginx proxy manager
      • How to use Proxmox VE remotely over Meshnet
      • How to set up a remotely controlled 3D printer
      • How to set up and remotely access a CasaOS server
    • Joint projects
      • How to set up an NGINX web server and remotely access it over Meshnet
      • How to use Nextcloud file syncing with Meshnet
      • How to set up pair programming using tmux
      • How to set up a Visual Studio Code server for remote development over Meshnet
      • How to host a Focalboard server for remote project management
      • How to use Meshnet for multi-screen Node.js development
      • How to use the Multi-user editing plugin in Unreal Engine over Meshnet
      • How to set up a private Mumble voice chat server
      • How to host a private Rocket.Chat server
    • Own VPN server setup
      • How to set up a VPN server through self-hosting or with DigitalOcean
      • How to create a VPN server with Microsoft Azure
      • How to create a VPN server with AWS
      • How to create a VPN server with Google Cloud
      • How to create a VPN server with Linode
      • How to create a VPN server with Hetzner
    • Network protection
      • How to set up your network protection with Pi-hole
      • How to set up your own DNS server
      • How to protect your network with AdGuard Home
      • How to use the self-hosted Whoogle search engine remotely
      • How to set up a VPN router using Meshnet
  • Troubleshooting
    • Common issues on Windows
    • Common issues on Android
    • Common issues on iPhone/iPad
    • Common issues on macOS
    • Common issues on Linux
Powered by GitBook

© 2025 Nord Security. All Rights Reserved.

On this page
  • Introduction
  • Prerequisites
  • Create a VM instance on AWS
  • Connect to your instance
  • Setting permissions for the private key
  • Accessing your instance using an SSH client
  • Install NordVPN on the instance
  • Log in to NordVPN
  • Enable Meshnet
  • Grant the traffic routing permission
  • Route traffic through your instance

Was this helpful?

  1. How-to guides
  2. Own VPN server setup

How to create a VPN server with AWS

Discover how to create and configure your private VPN server using AWS and Meshnet.

PreviousHow to create a VPN server with Microsoft AzureNextHow to create a VPN server with Google Cloud

Last updated 4 months ago

Was this helpful?

Introduction

As the internet has become an indispensable part of our daily lives, addressing its inherent challenges is more important than ever — be it maintaining privacy, securing connections, or accessing global content without restrictions. A personal VPN server can be an effective solution to these concerns, allowing you to navigate the digital world with greater control and peace of mind.

This article focuses on how to create a VPN server using a cloud-based approach in combination with Meshnet. With Meshnet's connectivity and , you can access your VPN server securely from any location and device, without the need for advanced configuration.

When it comes to choosing a cloud provider for setting up a virtual machine, (AWS) stands out as a popular and reliable option. AWS provides an attractive free tier, enabling you to explore their services without any financial commitment.

Note

While setting up your own VPN server enhances your online privacy, it may not provide the same level of protection as connecting to a standard VPN server offered by NordVPN. NordVPN follows a , which is crucial for ensuring your online activities remain confidential.

Prerequisites

Before you begin, sign up for an and log in. During registration, you can choose from various support plans, including a free option.

Create a VM instance on AWS

Complete the following steps to prepare for launching a virtual machine (VM), referred to as an EC2 instance in the AWS environment.

  1. From the navigation bar, select the Regions dropdown menu and choose the region where you want your server to be located.

  2. Do any of the following:

    • On the Console home page, under Build a solution, choose Launch a virtual machine.

    • Open the and, under Launch instance, select the Launch instance button, and then choose the Launch instance option.

Note

This guide primarily covers the setup of an Ubuntu-based VM, but AWS also supports Windows, macOS, and other operating system VMs for custom virtual servers.

To configure and launch a VM instance:

  1. Under Name and tags, in the Name field, enter a name for your instance.

  2. Under Application and OS Images (Amazon Machine Image), choose an operating system for your instance, like Ubuntu, and its preferred version. Consider choosing a version marked as Free tier eligible to avoid additional costs.

  3. Under Instance type, you can select the hardware configuration for your instance. The instance type eligible for the free tier is already selected by default, so you can proceed without modifying it unless you need additional resources.

  4. You can leave the default options selected for the remaining configuration settings of your instance.

  5. Under Summary, select Launch instance. It will take a few minutes for AWS to set up the instance.

Before connecting to your instance, ensure that it has passed all status checks displayed in the Status check column of the Instances pane, as shown:

Connect to your instance

Setting permissions for the private key

To protect your private key, make sure that only you have read access to it by setting the appropriate permissions.

  1. Right-click the downloaded private key.

  2. Select Properties, choose the Security tab, and click Advanced.

  3. Click Disable inheritance > Convert inherited permissions into explicit permission on this object.

  4. Back in the Advanced security settings window, remove access for all users except your own account by selecting a permission entry and clicking Remove.

  5. Click Apply, and then click OK to save changes.

  1. Open Terminal.

  2. Enter the following command, replacing </path/key-pair-name.pem> with the path to the downloaded private key:

    chmod 400 </path/key-pair-name.pem>

    Example

Accessing your instance using an SSH client

Note

By default, password authentication and root login are disabled.

To establish an SSH connection to your VM instance:

  1. Locate the public DNS address of your instance in the Public IPv4 DNS column of the Instances pane.

  2. Open Command prompt (on Windows) or Terminal (on Linux and macOS).

  3. Enter the following command, replacing the placeholders with the appropriate values for your VM instance, where:

    • </path/key-pair-name.pem> is the path to your private SSH key file.

    • <instance-public-dns-name> is the public DNS address of your VM instance.

    ssh -i </path/key-pair-name.pem> <instance-username>@<instance-public-dns-name>

    Example

  4. You will receive a response similar to the one below. Type yes and press Enter to confirm the connection.

You should now be successfully connected to your instance.

Install NordVPN on the instance

To set up NordVPN on your instance, follow these steps:

  1. Download and install the NordVPN Linux client by entering this command in the instance terminal:

    sh <(wget -qO - https://downloads.nordcdn.com/apps/linux/install.sh)

  2. Log in to your NordVPN account.

Log in to NordVPN

You can log in to your NordVPN account without the use of a graphical user interface (GUI) in two ways:

  • By running the nordvpn login command with the --token flag

  • By running the nordvpn login command with the --callback flag

Instructions for both methods are outlined below.

Log in using a token
  1. Under Advanced settings, select Get access token.

  2. Enter the verification code sent to your email address.

  3. Under Access token, click Generate new token.

  4. In the dialog that appears, choose either a token that expires in 30 days or one that never expires, and then select Generate token.

  5. Select Copy and close.

  6. On your VM, enter the nordvpn login --token command along with the copied token:

    nordvpn login --token <your_token>

    Example

    nordvpn login --token 3fe460cefb8dcf1478c92e45908cec9f9bdbadf7a456a6dfb35dc2c58ee39d5b

You should now see a welcome message.

Log in using a URL
  1. Run the following command:

    nordvpn login

  2. Open the provided link on any device in your browser.

  3. Complete the login procedure.

  4. Right-click the Continue button and select Copy link address.

  5. Run the following command, replacing <URL> with the previously copied link address:

    nordvpn login --callback "<URL>"

    Example

    nordvpn login --callback "nordvpn://login?action=login&exchange_token=MGFlY2E1NmE4YjM2NDM4NjUzN2VjOWIzYWM3ZTU3ZDliNDdiNzRjZTMwMjE5YjkzZTNhNTI3ZWZlOTIwMGJlOQ%3D%3D&status=done"

You should now see a welcome message.

Tip

To preserve your token when logging out of the NordVPN app, use the nordvpn logout --persist-token command. Otherwise, your token will be revoked.

Note

If you encounter the error message “Whoops! Permission denied accessing /run/nordvpn/nordvpnd.sock,” enter sudo usermod -aG nordvpn $USER. Then, reboot your instance and log back in.

Enable Meshnet

nordvpn set meshnet on

To view the Nord name and Meshnet IP address of your instance, enter the following command.

nordvpn meshnet peer list

Grant the traffic routing permission

To begin using the VPN server, you need to grant the traffic routing permission for each peer device that you want to have access to the server. Enable this permission from the server machine using the following command:

nordvpn meshnet peer routing allow <device>

Example

nordvpn meshnet peer routing allow secret.raccoon-everest.nord

Route traffic through your instance

To begin using your instance as a VPN server, you need to route traffic from a client device through the instance. Follow these steps:

  1. On your client device, open NordVPN and log in to your account.

Under Key pair (login), choose the option to create a new key pair. Make sure to save the automatically downloaded private key file in a secure location. For additional details, refer to .

Configure network settings for better security if needed. Default settings usually suffice for a typical setup, but customizing security groups adds extra protection. For more information, see the procedure in Amazon's documentation.

Once your instance is running, you can access it from your local computer using .

<instance-username> is the username associated with your VM. The default username is determined by the AMI selected when configuring the instance. For example, an Ubuntu AMI uses ubuntu as the username. For more information, consult the article in Amazon’s documentation.

On any device, log in to your dashboard and select the Meshnet (by NordVPN) card.

On your instance, by typing this command:

Additionally, you will see all the devices connected to your network. Depending on the granted to each device, they will have access to this server via Meshnet.

For more information, see the page.

Start routing traffic through the linked host device you set up. For specific instructions, see .

should now match the public IP address of your instance. This way, your real IP address remains secure, and the websites you visit will detect the location of your VPN server instead of your actual device.

Amazon's documentation on creating a key pair
Create a security group
SSH
Manage users on your Linux instance
Nord Account
permissions
Your device's IP address
Amazon Web Services
strict no-logs policy
AWS account
EC2 console dashboard
Routing traffic in Meshnet
traffic routing capabilities
enable Meshnet
Traffic routing permissions
Selecting Launch a virtual machine in the AWS console.
Selecting the operating system of the virtual machine.
Checking if the VM has passed the status checks.
Clicking Remove.
Running the 'chmod 400' command.
Finding the public IPv4 DNS of the VM
Connecting to the VM over SSH.
SSH connection confirmation message.
"Meshnet (by NordVPN)" card highlighted.
Clicking the 'Set up NordVPN manually' button.
Clicking 'Generate new token'.
Selecting the token expiry option.
Clicking Route all traffic.
Checking the new IP address after connecting to the VPN server.