Overview
Lab details
- This lab walks you through the steps to launch and configure an EC2 Instance using OpenVPN AMI and how to connect to the VPN.
- You will practice using OpenVPN Amazon Machine Images to launch Amazon EC2 Instances.
- Duration: 60 minutes
- AWS Region: US East (N. Virginia) us-east-1
Introduction
What is an EC2?
- AWS defines it as Elastic Compute Cloud.
- It’s a virtual environment where “you rent” to have your environment created, without purchasing.
- Amazon refers to these virtual machines as Instances.
- Preconfigured templates can be used to launch instances. These templates are referred to as images. Amazon provides these images in the form of AMIs (Amazon Machine Images).
- Allows you to install custom applications and services.
- Scaling of infrastructure i.e., up or down is easy based on the demand you face.
- AWS provides multiple configurations of CPU, memory, storage, etc., through which you can pick the flavor that’s required for your environment.
- No limitation on storage. You can pick the storage based on the type of the instance that you are working on.
- Temporary storage volumes are provided, which are called Instance Store Volumes. Data stored in this gets deleted once the instance is terminated.
- Persistent storage volumes are available and are referred to as EBS (Elastic Block Store) volumes.
- These instances can be placed at multiple locations which are referred to as Regions and Availability Zones (AZ).
- You can have your Instances distributed across multiple AZs i.e., within a single Region, so that if an instance fails, AWS automatically remaps the address to another AZ.
- Instances deployed in one AZ can be migrated to another AZ.
- To manage instances, images, and other EC2 resources, you can optionally assign your metadata to each resource in the form of tags.
- A Tag is a label that you assign to an AWS resource. It contains a key and an optional value, both of which are defined by you.
- Each AWS account comes with a set of default limits on the resources on a per-region basis.
- For any increase in the limit, you need to contact AWS.
- To work with the created instances, we use Key Pairs.
Architecture diagram

Task details
- Sign in to the AWS Management Console
- Launching an EC2 Instance
- SSH into EC2 Instance
- Initialize the VPN Server
- Connect to the VPN
- Validation of the lab
- Deleting AWS Resources
Launching the lab environment
- To launch the lab environment, Click on the Launch lab button.
- Please wait until the cloud environment is provisioned. It will take less than a minute to provision.
- Once the Lab is started, you will be provided with an IAM username, Password, Access Key, and Secret Access Key.
You can only start one lab at any given time
Lab guide
Lab steps
Task 1: Sign in to the AWS Management Console
- Click on the Open console button, and you will get redirected to AWS Console in a new browser tab.
-
On the AWS sign-in page,
- Leave the Account ID as default. Never edit/remove the 12-digit Account ID present in the AWS Console. Otherwise, you cannot proceed with the lab.
- Now copy your User Name and Password in the Lab Console to the IAM Username and Password in the AWS Console and click on the Sign-in button.
- Once Signed In to the AWS Management Console, make the default AWS Region as US East (N. Virginia) us-east-1.
Task 2: Launching an EC2 Instance
In this task, we are going to create and launch an EC2 Instance with the required configurations.- Make sure you are in the N.Virginia Region.
- Navigate to EC2 by clicking on the Services menu at the top, then click on EC2 under Compute section.
- Navigate to Instances on the left panel and click on the Launch Instances button.
- Enter Name as MyVPNServer
-
Choose an Amazon Machine Image (AMI):
-
Click on Browse more AMIs.

-
Click on Browse more AMIs.
- Search for Openvpn in the search box.
-
Click on the Select button of the OpenVPN Access Server

- Click on subscribe on the instance launch.

- Click on the Continue button in the popup window.
- Choose an Instance Type: Enter t2.micro

- Key Pair: Choose Create a new key Pair hyperlink.
- Key pair name: Enter MyVPNKey
- Key Pair Type: Select RSA
- Private key file format: Select .pem
-
Click on the Create key pair button to download the key to your local machine.

- Under Network Settings:
-
The following ports will be automatically enabled :

- Now click on the Launch Instances button.
- Launching a VPN Server may take a few minutes, you may see a message saying that the Subscription may take an hour to complete.
- Scroll down and click on View Instances or click to navigate to the instance page
- Launch Status: Your instance is now launching, wait for the complete initialization of the instance till the status changes to Running.

- Now click on the instance ID and copy the IPv4 Public IP of this instance and place it in your text editor.

Task 3: SSH into EC2 Instance
- Please note, that the username is root. Change the hostname or username to openvpnas.
- Please follow the steps to SSH into EC2 Instance.

Task 4: Initialize the VPN Server
- Please enter ‘yes’ to indicate your argument [no]: Enter yes
-
Will this be the primary Access Server node?
- Press ENTER for default [yes]: Click the [enter] button.
-
Please specify the network interface and IP address to be
- Press Enter for default [1]: Click the [enter] button.
-
What public/private type/algorithms do you want to use for the OpenVPN CA?
- Press ENTER for default [rsa]: Click the [enter] button.
-
What key size do you want to use for the certificates?
- Press ENTER for default [2048]: Click the [enter] button.
-
What public/private type/algorithms do you want to use for the self-signed web certificate?
- Press ENTER for default [rsa]: Click the [enter] button.
-
What key size do you want to use for the certificates?
- Press ENTER for default [2048]: Click the [enter] button.
-
Please specify the port number for the Admin Web UI.
- Press ENTER for default [943]: Click the [enter] button.
-
Please specify the TCP port number for the OpenVPN Daemon
- Press ENTER for default [443]: Click the [enter] button.
-
Should client traffic be routed by default through the VPN?
- Press ENTER for default [no]: Click the [enter] button.
-
Should client DNS traffic be routed by default through the VPN?
- Press ENTER for default [no]: Click the [enter] button.
-
Should private subnets be accessible to clients by default?
- Press ENTER for default [yes]: Click the [enter] button.
-
Do you wish to log in to the Admin UI as “openvpn”?
- Press ENTER for default [yes]: Click the [enter] button.
- Type a password for the ‘openvpn’ account: Enter Whizvpn123@ and press [enter] and then enter the same password to confirm the password.
- Please specify your Activation key (or leave blank to specify later): Click the [enter] button.

-
Now login as administrator, open Google Chrome and paste the following URL
- Syntax : https://<IPv4 Public IP>:943/admin/
- Example: https://3.239.61.27:943/admin/
- Now you will get a Warning message Your connection isn’t private, this is because we are not using any SSL certificate for this connection.

- Click on the Advanced Button and see if you have a proceed to website option then click on the link.
- If you see the below message instead, then type thisisunsafe on the keyboard and the page will automatically reload.

-
You will see a login page like this :

-
Login to the VPN Admin page :
- Username: Enter openvpn
- Password: Enter Whizvpn123@
- Now click on the Sign in button.
- Now On the License Agreement page click on the Agree button.
- Click on the VPN Server option in the left-side menu.
-
To make sure all the internet traffic goes through the VPN, Under Network Settings
-
Under Interface, make sure you have selected All Interfaces, if not select All Interfaces and click Save on the right corner.

-
Under Interface, make sure you have selected All Interfaces, if not select All Interfaces and click Save on the right corner.
Task 5: Connect to the VPN
- Open a new tab in the Google Chrome browser.
- Paste the url https://<IPv4 Public IP>/ Example : https://100.26.97.202/
-
Login to the VPN User Page :
- Username: Enter openvpn
- Password: Enter Whizvpn123@
- Now click on the Sign in button.
- Now, based on which operating system you are using, download the VPN connector and install it on your local machine.
- Open the OpenVPNConnector application and if you see Onboarding Tour, just close it.
- Now again, agree to the terms and conditions.
- You will be able to see a pre-configured VPN profile, turn on this connection.

-
Now again enter the username and password.
- Username: Enter openvpn
- Password: Enter Whizvpn123@
- Click on the OK button.
- Now you are connected to the VPN

- Now you can start browsing using a VPN connection.
DO You Know?
OpenVPN is widely used and trusted by organizations and individuals worldwide for its robust security features, including encryption, authentication, and data integrity. It provides a flexible and scalable solution for establishing secure connections, making it suitable for various use cases, such as remote access to corporate networks, securing public Wi-Fi connections, and creating secure communication channels between different cloud environments.
Task 6: Validation Test
- Once the lab steps are completed, please click on the Check my work button on the left side panel.
- This will validate the resources in the AWS account and display whether you have completed this lab successfully or not.
- Sample output :

Task 7: Delete AWS Resources
7.1 Delete EC2 Instance
- Make sure you are in the US East (N. Virginia) Region.
- Navigate to EC2 by clicking on the Services menu at the top, then click on EC2 under Compute section.
- Now Select the EC2 instance that you have created, click on Instance State, and click on the Terminate instance option.
- Click on the Terminate button and your EC2 will start terminating.
Completion and conclusion
- You have successfully created and launched the Amazon EC2 Instance.
- You have successfully logged into an EC2 instance by SSH.
- You have successfully Initialized the VPN Server.
- You have successfully connected to the VPN.
End lab
- Sign out of AWS Account.
- You have successfully completed the lab.
- Once you have completed the steps, click on End lab in the IP Lab Portal and wait till the process is completed
What gets checked
When you press Check my work, the platform verifies each of these:- Launch an EC2 Instance — Check whether an EC2 Instance is launched or not.