Skip to main content

AWS EC2 VPN Server Setup: Quick Start Guide

Abstract

How to launch the AWS marketplace appliance for Access Server and get your VPN server up and running in minutes.

Access Server provides an Amazon Web Services (AWS) VPN that you can get up and running within minutes.

Working with AWS, you use their appliances, which are Linux-based virtual machines running on virtualized hardware. By using the Access Server appliance from their marketplace, you can launch a VPN hosted in the cloud, with the following benefits:

Read on for your guide to getting started with your VPN server on the web.

This guide steps you through launching a BYOL instance.

You can choose from several options in the AWS marketplace that come with a set number of connections or the bring-your-own-license (BYOL) Access Server instance.

When you select an instance with a set number of connections, you pay the subscription for those connections through AWS and keep that set amount.

When you select a BYOL instance, you purchase a license separately from us for unlocking connections. You buy a subscription on our site and activate it on your Access Server installation. You can adjust the number of connections up or down at any time.

When you launch a BYOL-type AMI, you can get started immediately without purchasing a subscription. You can connect up to two devices simultaneously and test out all features and functionality of Access Server without a time limit. When you need to expand beyond two connections, you purchase and activate a license key.

If you’re launching one of the Amazon AWS EC2 tiered instances, refer to that separate quick start guide: AWS Tiered.

For more information about Access Server subscriptions, refer to Which licensing models are available for Access Server?

To launch a new instance with Access Server software:

  1. Select the Access Server listing in the AWS Marketplace and launch.

  2. Configure the software with a 64-bit AMI, the latest version of Access Server, and your desired region.

  3. Select your desired instance type. (Refer to System Requirements for details, if needed.)

  4. Use our predefined access on ports and protocols for the security group.

  5. Select a key pair for securely connecting to your instance (or click to create one).

  6. You're ready to launch.

Tip

For the security group, we recommend using the default group for the marketplace instance but adjusting the sources for some ports to improve security. For your information, these are the ports that need to be open:

  • TCP 22: For SSH to remotely administer your appliance. We recommend you restrict this port to trust IP addresses by entering a specific subnet in CIDR notation (e.g., 12.34.56.0/24 for a subnet or 11.22.33.44/32 for a single IP address).

  • TCP 943: The Admin Web UI uses this port, which is also served on port 443 by default.

  • TCP 945: The clustering functionality uses this port. If you don’t use this feature, you don’t need to open this port. If you do, ensure the cluster nodes can reach each other on their public addresses.

  • TCP 443: For HTTPS, used by the Client Web UI, the interface where your users sign into the VPN server to retrieve client or config files. We recommend leaving this port open to the source as 0.0.0.0/0. The Access Server is also default enabled on this port unless you turn off this setting. In multi-daemon mode, the OpenVPN TCP daemon shares this port with the Client Web UI, and your clients initiate TCP-based VPN sessions under this port number.

  • UDP 1194: For the OpenVPN UDP port used by your clients to initiate UDP-based VPN sessions to the VPN server, the preferred way for clients to communicate. Keep this port open for all clients.

Once you launch your new AMI, you need to SSH into the console using an SSH client software and the private key pair you used/created previously.

Use the instance username openvpnas.

Connect with ssh:

ssh -i /path/key-pair-name.pem openvpnas@instance-public-ipv4-address

You can refer to Connect to Access Server via SSH using PuTTY for steps to connect with the PuTTY SSH client from a Windows computer. If you have a different configuration, please follow Amazon’s instructions on connecting to your instance.

Connect to your server, and the Access Server will complete the installation. Access Server then provides the URLs for your Admin Web UI and Client Web UI and the username and password for signing into the Admin Web UI.

Refer to First-time setup for details.

In addition to the steps in the link above, we recommend you assign an Elastic IP address to your instance:

  1. From your AWS console, click Elastic IPs under Network & Security.

  2. Click Allocate Elastic IP address.

  3. Select the pool and enter any tags (optional).

  4. Click Allocate.

  5. After AWS allocates your new IP address, select it, and click Actions > Associate Elastic IP address.

  6. Choose Instance as the resource type, select your Access Server instance from the Instance search field, and select the Private IP address by clicking in the search field and selecting the option available.

  7. Click Associate.

  8. Sign in to your Admin Web UI.

  9. Click Configuration > Network Settings and enter the Elastic IP in the Hostname or IP Address field.

You can start right away with two simultaneous connections to your VPN server. To add more connections, purchase a subscription from our site and activate it using the Admin Web UI: Purchasing And Activating A Subscription.

The default time zone may not be the time zone that you're in. If you are in a different time zone, you can change this setting by running this command, then choose your appropriate time zone:

sudo dpkg-reconfigure tzdata

We recommend installing the NTP client to keep the time synchronized, but it's especially important for those that plan on using multi-factor authentication with TOTP. Run this command:

apt-get install ntp

Access Server’s default routing uses network address translation (NAT). Traffic originating from the VPN clients appears to come from the local IP address of Access Server with NAT, and this is simpler than setting up routing.

However, when using NAT, your traffic from the VPC itself can’t directly access a VPN client as the NAT engine prevents direct contact. You must configure routing instead of NAT to allow direct access to a VPN client.

To access this configuration:

  1. Sign in to the Admin Web UI.

  2. Click Configuration > VPN Settings.

  3. Scroll to the Routing section, where you can click Yes, using Routing.

  4. Configure your subnets for your network.

After setting up routing, the source IP address of packets coming from the VPN clients is kept intact, and direct access from the VPC network to the VPN client subnet is possible. However, because the VPC doesn’t automatically recognize the VPN subnet within the VPN instance, it doesn’t know how to send the return traffic back to the instance. To correct this problem, add a static route in the Amazon routing table for your VPC so that the return traffic flows properly. Refer to Amazon’s AWS VPC routing documentation: Route tables for your VPC (Amazon).

We recommend updating your Linux OS. From the time we've generated the appliance and you've downloaded and are using it, there are likely a number of updates. To make sure your appliance OS is up to date, execute the following commands:

sudo apt-get update
sudo apt-get upgrade

When you launch an EC2 instance, you can pass user data to the instance to perform common automated configuration tasks. You can use this feature to preconfigure Access Server with specific settings, as defined below.

We use AWS “user data,” which is only available to you through the manual launch method on the EC2 dashboard or via API or CLI.

Here’s an example of user data sent during launch:

  • Send a username and password for your administrative user. When you do this, you don’t need to SSH in to finish the setup wizard. You’ve already set your account credentials.

Entering user data:

  1. During the steps above for creating an AMI, when you reach step 7, Advanced details, expand that section.

  2. Scroll down to the text field, User data.

  3. Enter your data for one or more of the available settings below. Ensure you enter each row as key1=value1, and don’t use quote keys or spaces on either side of the equal character. Example:

public_hostname=vpn.example.com
admin_user=admin1
admin_pw=p@$w0rd

Available settings for pre-configuration with Access Server:

Key

Description

public_hostname

The hostname used by clients to contact the server.

admin_pw

The administrative account initial password.

Warning

This parameter is communicated to the instance via cleartext channel.

license

The Access Server license key.

Tip

Without a license key, Access Server allows up to two concurrent connections.

reroute_gw (boolean, default=0)

If 1, clients route internet traffic through the VPN.

reroute_dns (boolean, default=0)

If 1, clients route DNS queries through the VPN. Note: If the VPC CIDR block is defined, it is made accessible to VPN clients via NAT.

Additional Security Steps You Can Take After Installation