Throughout these instructions we'll be bouncing between EC2, the lamp, and your host machine (i.e., your laptop). Bash commands on EC2 will be prepended with cloud$
, commands on lamp with lamp$
, and commands on your local machine with host$
. Example:
cloud$ ifconfig
host$ ifconfig
lamp$ ifconfig
These represent the prompt. You should not include these with the commands you run.
NOTE: The AWS User Interface updates periodically, so what you see in your browser might vary sligthly from the images in the courseware (e.g., buttons pictured as blue might now be orange, or the colors might be inverted - "darkmode").
- Navigate to http://aws.amazon.com and sign up for a new account. (Note: you will need a payment method and active phone number to complete registration)
- When registration is completed and you are signed in, navigate to https://console.aws.amazon.com.
Note: there is an AWS Educate program that will provide you with free AWS credits. Not needed for this course, but it might be useful for you.
-
Navigate to https://console.aws.amazon.com.
-
Use the search field under "AWS Services" to search for EC2 (AWS has so many services at this point that they cannot just provide a table...)
-
Verify that the AWS Region in the upper-right corner is
N. Virginia
(Northern Virginia) - this is very important for the semester run everything in theN. Virginia
region. -
Find the AMI for Ubuntu Server 20.04 LTS (HVM), SSD Volume Type - ami-0885b1f6bd170450c (64-bit x86). Click Select.
-
Choose an instance type of t2.micro and click Review and Launch. This is a Free Tier Eligible instane type.
-
You will be asked for a key pair to securely connect to your instance. Select Create a new key pair, give it a name like
eecs377
, and click Download Key Pair. -
This will create a key and download the private key on your local machine.
-
If the file saves to your computer with a .txt file extention, rename it to have a .pem extension.
-
Restrict permissions on the key. ssh will require this later. On a Unix system:
host$ chmod 400 <path_to_your_pem_file>
-
Click Launch Instance.
-
Once the instance has launched you can navigate to the Instances link in the left side bar to get a list of all of your instances and their state.
Anyone who has the private key you just downloaded can log into your EC2 instance. The first thing you should do is place it somewhere meaningful on your computer where you will remember where and what it is. Your Downloads folder is not an appropriate place for long-term key storage. The second thing you should do is back it up, preferably to labeled physical media such as a USB drive.
Even on the free tier, AWS can bill you for usage over the free rate limits. I recommend you go to https://console.aws.amazon.com/billing/ and configure billing alerts that will let you know if you start getting charges on your account. If you make a mistake or start getting unexpected traffic you will be able to react quickly and avoid getting any surprising charges.
By default, your EC2 instance will be assigned a non-static IP address. When the instance is restarted or stopped, it will lose it's public IP. To deal with this we will configure an Elastic IP so that our lamp will always have a known endpoint to talk to.
- Navigate to https://console.aws.amazon.com.
- Click on EC2.
- On the left-hand side, click Elastic IPs.
- Click Allocate New Address and confirm with Yes, Allocate.
- Once you have your Elastic IP address, select it in the list and select Actions, then Associate Address.
- Click in the Instance field and select your EC2 instance. Then click Associate.
-
Open EC2 Dashboard at https://console.aws.amazon.com/ec2/. Click on Instances.
-
Select your newly created instance (remember, always use the
N. Virginia
region for this semester) and click Connect. (If your instance doesn't appear, you may be in the wrong region. Try the other US regions in the upper-right drop-down.) -
Follow the provided instructions for connecting to your instance via SSH. In an OSX or Linux system, you can run:
host$ ssh -i "<path to private key>" <ec2_user>@<ec2_public_ip>
Note: You should be able to use the same program you used to SSH into your Raspberry Pi (PuTTY, Terminal, etc).
Note: The "ec2_user" for Ubuntu Server on AWS is
ubuntu
. -
You should now be logged in. Run
sudo apt-get update
and accept any prompts you encounter.
Next up: go to Set up Key Forwarding
© 2015-2022 LeanDog, Inc. and Nick Barendt