In my previous post, I introduced the SANdbox Github repo and described the work that had been done to create an Virtual Lab that is capable of supporting NVMe/TCP traffic.
In this post I’ll walk you through the steps to create your own SANdbox VPC in AWS that will eventually look similar to the following.
Before I get started, I need to acknowledge two sources of information that were invaluable to me as I was getting started with AWS:
- The AWS documentation – I found an article that seemed to describe exactly what I wanted to do but I didn’t have enough context/knowledge of AWS at the time to be able to follow it successfully.
- This “HOW TO Build a Home Lab in AWS for FREE” video by Jon Good. It was incredibly helpful and I highly recommend reviewing it before continuing with the following steps.
Create a Free AWS account
- Click here to create a Free AWS account.
- Provide an email address
- Provide an AWS account name
- Verify the email Address you provided by taking note of the Verification code they provide you an then entering it into the browser when prompted.
- Create your Root user password.
- Provide your contact information
- Provide credit card information
- Confirm your identity (I chose to use SMS)
- Select a support plan (I chose Basic support – Free)
- Click Complete sign up
- Click Go to the AWS console
- Enter or ensure that the correct email address is provided and click Next.
- Enter the password associated with the email address provided and click Next.
Secure your account with MFA
- In AWS, under Console Home, click IAM
- Note: If you ever lose track of a particular view or service, you can always click the Services icon at the top of the page or search for the service name you want to access and get to it that way. I do this all the time for accessing my “EC2” instances.
- In the IAM dashboard, click Add MFA.
- Under Your Security Credentials > Multi-factor authentication (MFA), click activate MFA.
- Choose the type of MFA device to assign (I chose “Virtual MFA device”) and then click Continue
- In the “Set Up virtual MFA device” dialog, you will be prompted to:
- Install a compatible app on your mobile device or computer (I chose the App “Authenticator” because it was supported on IOS and had good reviews online)
- Use the virtual MFA app and your device’s camera to scan the QR code shown within AWS.
- Enter two consecutive tokens from the Authenticator APP, then click OK, and you should see “You have successfully assigned a virtual MFA. Click Close
- Click on “Dashboard” (left side of the screen) and ensure there is a green check mark next to “Root user has MFA”.
- Click on the user name at the top right of the screen (e.g., SANdboxBlog) and then click Sign out
Setup a Billing Alert
Note: Jon Good recommended this and I cannot stress how good of an idea it is. You’d be surprised how quickly you can blow through $10 once you start using non-free instances and Elastic IP Addresses. My only regret is I did not also create a $100 alert :-) … do not make the same mistake I did! The steps for doing this are very straight-forward and can be found here.
Here’s my alarm configuration after setup.
Create a Virtual Private Cloud (VPC)
The VPC is the top level “container” into which all of your Virtual Resources will be deployed.
- To create a VPC, click on Services (at the top left of AWS console screen) and click on (or search for) VPC. Click Create VPC.
- Under VPC settings, I chose VPC and more.
- Under Name tag auto-generation, I provided a tag of SANdboxBlog.
- I decided to use a single Availability Zone as my lab configuration does not require HA.
- I increased the number of private subnets from 1 to 2.
- All other settings were left at defaults.
- The VPC preview should look similar to the following
- Click Create VPC and the VPC workflow will run. Click View VPC after the workflow completes.
Create and associate Security Groups
Creating and managing security groups is a tedious but necessary task. It allows you to define the sources (e.g., IP Addresses) that can be used to access the resources inside of your VPC. I created three Security Groups, one for my LAN (public facing) network and two for my SANs (e.g., SAN A and SAN B). I’ve summarized the SGs I created below for ease of reference.
LAN-Public
Name |
IP ver |
Type |
Protocol |
Port Range |
Source |
SSH |
IPv4 |
SSH |
TCP |
22 |
0.0.0.0/0 |
HTTPS |
IPv4 |
HTTPS |
TCP |
443 |
0.0.0.0/0 |
SAN A and SAN B
Name |
IP ver |
Type |
Protocol |
Port Range |
Source |
mDNS |
- |
Custom UDP |
UDP |
5353 |
0.0.0.0/0 |
NVMe/TCP Discovery |
IPv4 |
Custom TCP |
TCP |
8009 |
0.0.0.0/0 |
NVMe/TCP IO |
IPv4 |
Custom TCP |
TCP |
4420 |
0.0.0.0/0 |
PING |
- |
All ICMP – IPv4 |
ICMP |
ALL |
0.0.0.0/0 |
Create the “LAN-Public” Security Group
- From “Services”, click on EC2. (Not really required but I like to start from the EC2 dashboard for everything)
- On the left side of the console scroll down to “Network & Security” and click on Security Groups and then Create Security Group.
- Add a Security Group Name (e.g., LAN-Public)
- Add a Description (e.g., Allows SSH and HTTP access to instances)
- VERY IMPORTANT Ensure the correct VPC is selected. The default VPC listed in the VPC field is probably not what you want. Click on the ‘X’ in the right side of the VPC field and ensure you have selected the correct VPC. In my case I selected the SANdboxBlog-vpc. If you haven’t already done this, take note of the last four digits of your VPCs instance ID. In my case it’s “a245”, you will use this later on. Also, I highly recommend creating a diagram of your environment to keep track of all of the instance IDs. A completed example diagram will be provided at the end of this post.
- Create Inbound rules – As described in the LAN-Public table above, we need to create rules that will allow for both SSH and HTTPS access to our instances.
SSH
- Under Inbound rules, click Add Rule
- From the Type pulldown, select SSH. This will automatically populate the Protocol and Port Range fields for you.
- From the Source pulldown select Anywhere-IPv4. The IP address of 0.0.0.0/0 will automatically be added to your list of sources.
NOTE: Using Anywhere-IPv4 is NOT a best practice. Ideally, you would specify the IP Address of the system you will be using to access your VPC.
HTTPS
- Click Add Rule
- From the Type pulldown, select HTTPS. This will automatically populate the Protocol and Port Range fields for you.
- From the Source pulldown select Anywhere-IPv4. The IP address of 0.0.0.0/0 will automatically be added to your list of sources.
Confirm that your security group looks similar to what is shown below and then click Create Security Group.
Once the SG was created I took note of the Instance number for the LAN-Public Security Group (i.e., 4872) and added this to my topology diagram.
Create the “SAN A” Security Group
- On the left side of the console click on Security Groups and then Create Security Group.
- Add a Security Group Name (e.g., SAN A)
- Add a Description (e.g., SAN A is a private network for NVMe/TCP Discovery and IO traffic.)
- VERY IMPORTANT Ensure the correct VPC is selected. The default VPC listed in the VPC field is probably not what you want. In my case I selected the SANdboxBlog-vpc and it has an instance ID of “a245”.
- Create Inbound rules – As described in the SAN A and SAN B table above, we need to create rules that will allow for mDNS, NVMe/TCP Discovery, NVMe/TCP IO and Ping to be used between the instances in our VPC.
mDNS
- Under Inbound rules, click Add Rule
- From the Type pulldown, select Custom UDP. This will automatically populate the Protocol field for you.
- In the Port range field enter 5353
- From the Source pulldown select Anywhere-IPv4. The IP address of 0.0.0.0/0 will automatically be added to your list of sources.
- Provide a description (e.g., mDNS)
NVMe/TCP Discovery
- Click Add Rule
- From the Type pulldown, select Custom TCP. This will automatically populate the Protocol field for you.
- In the Port range field enter 8009
- From the Source pulldown select Anywhere-IPv4. The IP address of 0.0.0.0/0 will automatically be added to your list of sources.
- Provide a description (e.g., NVMe/TCP Discovery)
NVMe/TCP IO
- Click Add Rule
- From the Type pulldown, select Custom TCP. This will automatically populate the Protocol field for you.
- In the Port range field enter 4420
- From the Source pulldown select Anywhere-IPv4. The IP address of 0.0.0.0/0 will automatically be added to your list of sources.
- Provide a description (e.g., NVMe/TCP IO)
PING (this is not technically necessary, but you will thank me later).
- Click Add Rule
- From the Type pulldown, select All ICMP – IPv4. This will automatically populate the Protocol and Port range fields for you.
- From the Source pulldown select Anywhere-IPv4. The IP address of 0.0.0.0/0 will automatically be added to your list of sources.
- Provide a description (e.g., PING)
Confirm that your security group looks similar to what is shown below and then click Create Security Group.
Create the “SAN B” Security Group
Using the information from the SAN A and SAN B table above, repeat the steps outlined in “Create the SAN A Security Group” and create another Security Group for SAN B.
OR... You can save a ton of time and do the following
- Under Actions, at the top of the “SAN A Security Group” configuration screen, you can chose “Copy to a new security group”.
VERY IMPORTANT After providing a “Security group name” (e.g., SAN B) and a Description, you will still need to ensure the correct VPC is selected. The default VPC listed in the VPC field is probably not what you want. In my case I selected the SANdboxBlog-vpc and it has an instance ID of “a245”.
- Click Create Security Group
Create your first EC2 Instances
Amazon Elastic Compute Cloud (EC2) instances can be thought of as virtual servers. For the purposes of the SANdbox configuration, I’ve chosen to use EC2 instances that are running Ubuntu 20.04. When I was first getting started and needed to work my way through the process of setting up the environment and familiarizing myself with AWS in general, I chose EC2 instances that were available in the free tier. This means there is no charge up to a certain amount of usage. I will walk you through doing the same for two instances and will get us to the point where you can connect to each instance with SSH and ping across the network interfaces used for SAN A. We will not be setting up SAN B right now, just validating connectivity across one SAN is enough (for now).
- From the “EC2 Dashboard”, click Launch Instance
- Provide a “Name” for the instance (e.g., Host1)
- Under “Application and OS Images (Amazon Machine Image)”, click on ubuntu and then select a particular version. I chose “Ubuntu Server 20.04 LTS (HVM), SSD Volume Type” because it was “Free Tier Eligible”, when we actually create the instances we will use for NVMe/TCP testing, we will make different choices that will have a different cost profile. Leave Architecture set to 64-bit (x86)
- Under “Instance type”, select micro again because it is Free tier eligible.
- Under “key pair (login), select Create new key pair
- In the Create key pair dialog, provide a Key Pair name, I chose to use SANdboxBlog
- Select a “Key pair type” of RSA
- Select a “Private key file format” of .ppk
- Click Create key pair and a file (e.g., SANdboxBlog.ppk) will be downloaded to your system. You will need this file when we connect to the instance via PuTTY in a subsequent step.
- Ensure that your key name (e.g., SANdboxBlog) is shown in the Key pair name – required
- Under “Network Settings” click on Edit
- Under “VPC”, ensure the correct VPC is selected (e.g., SANdboxBlog-vpc)
- Under “Subnet”, ensure your public network is selected (e.g., SANdboxBlog-subnet-public1-us-east-1a)
- Under “Auto-assign public IP”, ensure it is set to Disable
- Under “Firewall (security groups)”, click on “Select existing security group”
- Under “Common security groups”, leave it blank
- Click Advanced network configuration
- Under “Network Interface 1”
- Set the “Description” to Public-LAN
- Under the “Security groups” pull down menu, choose LAN-Public
- Leave everything else at the default setting
- Click Add network interface
- Set the “Description” to SAN A
- Under the “Subnet” pull down menu, select the SAN A subnet
- Under the “Security groups” pull down menu, choose SAN A
- Leave everything else at the default setting
- Note, this instance type only supports two network interfaces, so we will only configure SAN A for now.
- Under the Summary tab (on the right side of the console)
- For Number of instances, specify 2
- Then click Launch instance
- Click View all instances when the button becomes available.
Take an inventory of your Virtual Infrastructure
- Now that your EC2 instances are up, ensure that you name them appropriately, I chose Host 1 and Host 2. You can rename them in the EC2 Dashboard by clicking in the Name field.
- For each Host, take note of at least the last four digits of the instance ID.
- For each Host, click on the Instance ID and select the Networking tab
- Scroll down to the Network Interfaces section and take note of the last four digits of each Interface ID (you may need to expand the Interface ID column to see the last four digits). You’ll also want to understand what network each interface is associated with, and the Description field should answer this question for you.
- You’ll also want to take note of the IPv4 addresses for the SAN A interfaces. We will be using them to verify connectivity in the final step.
- I highly recommend keeping track these instance and interface IDs because we will use them later. Here’s what my configuration looks like at this point. Note that the IP address for the LAN-Public interfaces are Elastic 1 and Elastic 2, we will actually assign them next.
Create and Assign Elastic IPs
If I was only using a single network interface per instance, I could have had a public IP Address assigned to each Interface. However, because this functionality is not supported when you have more than one network interface on an instance, I’ve found the easiest way to get access to my instances is to use Elastic IPs. Unfortunately, Elastic IPs are not free, so please be advised.
- Under “Network & Security” select Elastic IPs and then click on Allocate Elastic IP address
- Click Allocate and you will be returned to the Elastic IP Address screen. Take note of the Allocated IPv4 address. In my case it is 3.230.foo.bar
- Select the IP Address (little check box to the left of the IP), click Actions and then Associate Elastic IP address
- Under resource type, choose Network interface and then click inside of the Network Interface box and select the Public-LAN interface of Host 1. BTW, you need to use the resource ID of the interface and this is why it is so important to keep an updated diagram of your virtual infrastructure as you create it. In my case the last four digits of the interface on Host 1 that is connected to Public-LAN is 20d1. Clicked on the correct interface ID and then click Associate.
- Because you need two Elastic IP addresses, click on Allocate Elastic IP address a second time and repeat the above steps for the Public-LAN interface on Host 2. My second Elastic IP was 34.234.you.too
Connect to your Instances
To complete this next step you’re going to need the SANdboxBlog.ppk file that was downloaded to your system when you were creating your instances. You’re also going to need PuTTY installed on your system as well.
- Open PuTTY
- In the Host Name (or IP Address) field enter the Elastic IP Address associated with Host 1 (e.g., 3.230.foo.bar)
- Under connection -> Data enter the default user name for ubuntu in AWS (ubuntu)
- Under connection -> SSH -> Auth, browse to the location of the SANdboxBlog.ppk file.
- Click Open
- Accept the warning about the Host Key
- And you should be logged into your Host 1 instance.
- Ping the IP Address of the SAN A interface on Host 2, in my case, this IP Address is 10.0.134.136 and verify that it was successful
Next steps
So far we’ve created a Free AWS account, configured MFA, setup billing alerts, created a VPC with three networks, created 3 security groups and verified basic connectivity to and within our VPC using a pair of free tier servers.
Next time we’re going to deploy 3 larger EC2 instances, and install:
- nvme-stas on our Host EC2 instance,
- SmartFabric Storage Software on our Centralized Discovery Controller (CDC) EC2 instance, and
- SPDK on our Storge EC2 instance.
Thanks for reading!