This guide describes the process to run Twister on Amazon EC2 virtual machine. Please go through following steps to run Twister on AWS.
1. Create VPC and Networks
2. Creating an instance on Amazon Web Services EC2
3. Accessing Twister instance
4. Attaching interfaces to EC2 machine
Each of these parts are explained in detail below
- Creating VPC and Networks
- Go to AWS Management Console
![alt tag] (https://cloud.githubusercontent.com/assets/3003907/14815313/142f3cd2-0bc4-11e6-973f-df595a3615d7.png)
- Click on sign in button and log in with AWS credentials.
A dashboard will open up with list of all AWS components. Click on
VPC
service in Networking section. This service is usually listed around bottom of the list, as also depicted in the figure below:
![alt tag] (https://cloud.githubusercontent.com/assets/3003907/14815377/7e7d3c88-0bc4-11e6-84b1-7afce65d3de3.png)
- Go to
Your VPC
in the left panel and click onCreate VPC
button.
- A pop up window will open. Provide a VPC name and a valid CIDR block. Click on
Yes, Create
button.
- Check the newly created VPC, and select
Edit DNS Hostnames
button from drop down menu underActions
- Check
Yes
radio button inEdit DNS Hostnames
window.
- Select
Subnets
in left panel and click onCreate Subnet
- A pop up window will open. Create a subnet for accessing Twister VMs. Provide subnet name e.g. “Twister Access”, in
VPC
box select the VPC created in last step. Select any availability zone and a CIDR block.
Note:
It is more convenient to choose any one of the availability zone and stick to that availability zone
for creation of rest of the resources in a VPC.
- Similarly create another subnet for Twister Data Network.
- Check “Twister Access Subnet” and select
Modify Auto Assign Public IP
from drop menu inSubnet Actions
- Check the box for Enable auto assign public IP.
- Go to
Internet Gateways
in left panel and click onCreate Internet Gateway
. Provide a name and click onYes, Create
button.
- Now check the newly created gateway and click on
Attach to VPC
button. Select the Twister VPC and click onYes, Attach
.
- Now go to routes table in in left panel. Check the Twister VPC and click on “Edit” button under
Routes
tab as shown in figure below.
- Add 0.0.0.0/0 in destination. Select ‘Twister Gateway’ for Target box and click on save button.
- Now go to
Subnet Associations
tab, click onEdit
button and check the two subnets created in previous steps.
- In VPC dashboard, go to
Security Group
tab underSecurity
panel. Click onCreate Security Group
button.
-
Provide name for security groug and select VPC from drop down menu. Also add rules to allow TCP, UDP and ICMP traffic as shown in figure below.
-
Now to EC2 dashboard, go to
Key Pairs
tab inNetwork & Security
panel. Click onCreate Key Pair
.
- Create a new keypair and save the ".pem" key generated. This keypair will be used to create access EC2 instances.
- Creating an instance on Amazon Web Services EC2
- Click on
EC2
service in compute section from AWS portal. This service is usually listed as first service, as also depicted in the figure below:
- Click on Launch instance button to create a new virtual machine:
- Choose Amazon Machine Image (AMI) for launching an instance.
Twister should work on all operating systems that are supported by DPDK.
[See list of DPDK support OS.] (http://dpdk.org/doc/guides/rel_notes/supported_os.html)
Twister should work on any 64bit Amazon linux image which support hardware virtual machine (HVM). Following HVM images have been tested on Amazon EC2.
Ubuntu Server 14.04 LTS (HVM), SSD Volume Type
Amazon Linux AMI 2016.03.1 (HVM), SSD Volume Type
Following Amazon Images should work with Twister as they meet the requirements of Twister. But they have not been tested yet.
Red Hat Enterprise Linux 7.2 (HVM), SSD Volume Type
SUSE Linux Enterprise Server 12 SP1 (HVM), SSD Volume Type
Select Ubuntu Server 14.04 LTS (HVM), SSD Volume Type
or Amazon Linux AMI 2016.03.1 (HVM), SSD Volume Type
(64 bit) image from the list.
- In step 2, choose an instance type from the menu.
The NICs connected with Virtual Machine should either be virtual functions or other DPDK supported NICs. [See the list of DPDK supported NICS] (http://dpdk.org/doc/nics)
In Instance Types, only Compute Optimized
Family supports virtual functions. Other Instance Type Families connect xen based NICs which are not supported by Twister.
For ease of use c4.xlarge
instance type is selected here.
- In step 3 (configure instance details), select “Twister VPC” and “Twister Access subnet” in respective boxes. Also select
Enable
for auto assigning public IP.
- In step 3 (configure instance details), go to
Advanced Details
and add following lines in text box labelled asUser data
. -In case of Ubuntu AMI:
#!/bin/bash
apt-get update -y
apt-get upgrade -y
apt-get install linux-generic linux-headers-generic make gcc gdb git unzip python-netaddr -y
bash -c "echo vm.nr_hugepages = 1024 >> /etc/sysctl.conf"
mkdir -p /mnt/huge
sed -i -e '$i \mount -t hugetlbfs nodev /mnt/huge &\n' /etc/rc.local
reboot
-In case of Amazon Linux or CentOS AMI:
#!/bin/bash
yum update -y
yum install make gcc gdb git unzip kernel-devel redhat-lsb -y
bash -c "echo vm.nr_hugepages = 1024 >> /etc/sysctl.conf"
mkdir -p /mnt/huge
chmod +x /etc/rc.local
sed -i -e '$i \mount -t hugetlbfs nodev /mnt/huge &\n' /etc/rc.local
bash -c "echo nodev /mnt/huge hugetlbfs defaults 0 0 >> /etc/fstab"
reboot
These commands in user-data will install the software dependecies required for twister, configure hugepages creation at boot time and reboot the VM for the changes to take effect.
-
Skip step 4 (
Add storage
) and step 5 (Tag instance
) as there are no configurations required for them. -
Go to Step 6 (
Configure Security Group
), click onChoose an existing security group
and select the security group created in previous step. -
Click on Launch button. A window will pop up to select a key pair. Select
Choose an existing key pair
and select key pair created in previous section. Otherwise create a new key pair and download it.
- After selecting a key pair, tick the acknowledgement check box and click on
Launch Instances
button. Dashboard will redirect to Launch Status page. Click on the instance link given on this page as shown in figure below.
- Instance can be viewed in instances tab now. Hover over
Name
Column for newly created instance and click on the edit button to give it a more readable name.
After creation of the machine, installation of updates may take 4-5 minutes. In order to view the progress of installation procedure, log in to the machine and run following command.
tail /var/log/cloud-init-output.log
- Accessing Twister instance
-
Go to instances tab in left panel and select the Twister virtual machine. Click on
Connect
button on top. -
In order to access the instance, go to instances tab from left panel, select the virtual machine just created and click on
Connect
button. A window will pop up, showing ssh access credentials. Use the key generated in pervious steps to SSH into VM.
If you are in Windows machine, connect using PuTTY. For Linux users, change permission of key pair and SSH with the using Public DNS as shown in figure below.
- Attaching interfaces to EC2 machine
- Go to
Network Interfaces
tab underNetwork & Security
section in left panel. Click onCreate Network Interface
.
- Select Twister Data subnet (created in VPC and networks section) from drop down menu. Select security group
Twister Security Group
created in previous steps. Click onYes, Create
button.
Note down the subnet address of the subnet specified. It will be later used in configuring Twister ports.
- Now select the newly created interface and click on
Attach
button. Select Twister virtual machine, created in previous steps. Click onAttach
button.
- Note down the IP address of attached NIC. IP address is generally listed in
Details
tab inNetwork Interfaces
panel. As shown in figure below:
Note:
* IP address, netmask and gateway would be required in next steps to configure Twister ports
* Netmask can be calculated from the subnet address to Twister data network.
For example, netmask for 10.0.2.0/24 subnet would be 255.255.255.0
* Generally gateway of the subnet in AWS is the first address in the network.
For example, gateway for 10.0.2.0/24 subnet would be 10.0.2.1