Experimenting with VpnCloud on AWS
This page provides some scripts to setup and run VpnCloud nodes in the Amazon cloud. There are several reasons to use this kind of setup:
- to automatically create test environments
- to run fully automated tests
- to obtain performance measurements
Requirements
To run the scripts you need python3
and the python modules boto3
and paramiko
.
Also you need an AWS account with credentials configured as described in the boto3 documentation
Costs
The scripts deploy EC2 nodes on AWS. This incurs small costs per node per hour (on a per second granularity) depending on the instance type and the region. Please refer to AWS EC2 pricing for the current prices.
There are basically three instance types that are useful for running VpnCloud:
- t3.nano: This is the cheapest instance type that can run VpnCloud. This setup should not be used for bandwidth tests as the connectivity is limited and bursting the CPU adds additional costs. Price as of 2020-06-24: 0.18 ct. per hour per node (spot instances).
- t2.micro: This instance type is similar to t3.nano with the exception that bursting the CPU is limited and no additional costs arise. This instance is part of the free tier where new users get 750 hours of this instance for free in their first 12 months. Without free tier, t3.nano should be preferred.
- m5.large: This is the cheapest instance type that can run VpnCloud and guarantees a connectivity of 10 GBit/s. This instance type supports node clustering. Price as of 2020-06-24: 3.5 ct. per hour per node (spot instances).
The scripts can (and by default will) use spot instances to save up to 70% of the costs.
Please note that you should not connect the nodes to other nodes outside of AWS as external traffic has to be paid per GB.
Scripts
The scripts are contained in the scripts folder.
common.py
This is the file that provides most functionality and is shared by all scripts. Have a look at this file if you want to know what is actually happening.
performance.py
This is a full solution to obtain performance measurements that can be compared. The measurements are run between 2 nodes that are connected with 10 Gbit/s. The experiment run takes about 8 minutes and costs about $ 0.02.
testnet.py
Create a few nodes on AWS for experiments and terminate them when done.
The script takes some arguments which are all optional (see ./testnet.py --help
for options).
If you call
$> ./testnet.py --count 2 --keyfile key.pem
the script will setup 2 nodes, print their IPs and store the private key in a file named key.pem
.
You can connect to the nodes using the following command (replace the actual IP address):
$> ssh ec2-user@1.2.3.4 -i key.pem
When done, just press enter and the script will remove all resources.
example.py
This is a minimal script that creates two nodes and runs a ping. Use this script as a starting point for your own experiments.
Notes
-
In general the scripts are pretty cautious to remove resources after the script is done. This should also work in case of an exception. However when errors occur, you should double-check that no instances are left over and cause costs over time.
-
If you want to run performance tests, you should use an instance type from the
m5
family and activate the instance clustering (cluster_nodes = True
).