Skip to main content

Apache on an Amazon EC2 Ubuntu instance

I'm refreshing myself on how to make web sites that aren't PHP-CMS-on-Pantheon this week in preparation for a new job.

Launch an Amazon EC2 Virtual Machine. For this, I chose Ubuntu Linux. When the launcher told me that everyone could access my instance, I set SSH to only allow my IP address, and set HTTP and HTTPS to everyone.

ssh -i ~/.ssh/MyKeyPair.pem ubuntu@{EC2 IP_Address}

While ssh'd into your instance, install Apache.

In a browser, load your EC2 instance IP address. You should see the default Apache web page!

You can edit /var/www/html/index.html with nano while ssh'd in, but I like to manage files with a GUI. In FileZilla, open the site manager. Add your EC2 IP address and pem file. Your username will depend on what kind of Linux you chose when you set up your instance (my username was ubuntu). You should be able to navigate to /var/www/html and see index.html, which you edit to change that default Apache web page. Hooray!

Blink on Intel Edison with mini breakout board

You'll need:
An Intel Edison
The Edison mini breakout board
Two micro USB cables
A Mac
An LED light

Connect the Edison to the board. Then start at Step 4 in these directions to get connected to the Edison via WiFi. Notes: I had to hit 0 to re-scan once, and to enable ssh, you do have to set a password.

After that, these set up directions are very thorough.

If you run into trouble reconnecting after flashing (scary moment!), try changing which USB cable is plugged into which port on the Edison. If that doesn't work, try other cables.

And now to add hardware. I looked at the 4 rows of 14 pins (!!!) and wondered… hmmm, where is good old pin 13 for my blink.js program?

I started Googling "blink Edison mini breakout board" and soon realized that the pins are labeled by row (j17-j20) and column (1-14). Googling for Edison j17 got me to Intel’s mraa library, with support for Python, C++, and NodeJS. Their install instructions work great.

The mraa library numbers the pins from 0 to 55, with good old pin 13 at j17, pin 14. So I plugged the long end of my LED into that, and the short end into GND, which is at j19, pin 3. Fast as I could, I typed:
vi blink.js

And I pasted in their example code.

Then:
node blink.js

It worked!

Update: It works with rwaldron's galileo-io module as well. Just npm install galileo-io, and run this example (changing the pin from 3 to 13). Now to see about PS/2 keyboard reading...