• Home
  • Flailing Wildly
  • Résumé
  • Design
  • Code
  • Wishlist
  • About Me

Flailing Wildly
Too much straw, not enough camel.

Uploading web files to a new Amazon EC2 instance

by Ryan Parman • August 10, 2013 • Cloud Computing, Software, Technology, Tutorials • No comments

This is one of a few quick tutorials I’ve had sitting around on my hard drive for a while. I’m posting it now for the sake of anyone who may find these instructions useful.

It’s important to note that these are the instructions you’d use for a standalone EC2 instance. If your app is low-traffic enough to only need a single server, a better option would be to leverage a single-instance Elastic Beanstalk environment which gives you more, better and simpler deployment options.


Launching an instance

  1. You’ll need to launch a new EC2 instance. The simplest way is from the AWS Management Console.
  2. As part of this process, you’ll create a new keypair. The key pair will have a name and a keypair file (.pem). The .pem file is a replacement for a password. You’ll need this file to log into your EC2 instance.
  3. Once the instance has launched, you’ll want to select it in the EC2 console, and find the public hostname in the details section of the screen.

Logging in and fixing access permissions

  1. Armed with Terminal/PuTTY, your keypair file (.pem), and the public hostname of the instance, you’re ready to log into your instance.
  2. If you’re using Terminal, log into your instance using the following command:
    ssh -i {path-to-keypair-pem} ec2-user@{public-hostname}
  3. If you’re using a GUI tool for connecting (e.g., PuTTY), here are the important bits:
    • Hostname: {public-hostname}
    • User: ec2-user
    • Key: {path-to-keypair-pem}
  4. Once you’re logged into the EC2 instance as the ec2-user user, you’ll need to switch to the root user.
    sudo -i
  5. Move into the default Apache DocumentRoot directory.
    cd /var/www/html
  6. Change the owner of this directory to the ec2-user user. This will enable you to use a GUI-based tool to upload your web files.
    chown ec2-user .

Installing any required software

A new EC2 instance is essentially a blank slate. Very little is installed on the instance by default (which keeps it lean and fast), but there are many, many packages available for install via yum.

  • yum list available will show you all of the packages that are available to install.
  • yum list installed will show you all of the packages that are already installed.
  • yum help will show you which commands are available to use.

If you wanted to install PHP and Apache on your server, you would type (assuming you’re already the superuser (i.e., sudo -i)):

yum install php apache

Uploading your web files

  1. Using the SFTP client of your choice (I prefer Transmit or Cyberduck, depending on what I’m doing), connect to your EC2 instance over SFTP using the following credentials:
    • Hostname: {public-hostname}
    • User: ec2-user
    • Key: {path-to-keypair-pem}
  2. Move to the /var/www/html directory.
  3. Drag your web files into this directory to upload them. index.html will be loaded as the homepage when you load the public hostname in your web browser.
Ryan Parman

Ryan Parman is an entrepreneur, open source evangelist and passionate usability advocate currently living in Seattle. He is the founder and visionary behind SimplePie and CloudFusion, co-founder of WarpShare, member of the RSS Advisory Board, and creator of the AWS SDK for PHP. Ryan's aptly-named blog, Flailing Wildly, is where he writes about ideas longer than 140 characters.

« Things I learned about how websites manage passwords
Stephen Elop to become the next Microsoft CEO? I’d buy it. »

Have your say

Login with your favorite account to leave a comment!

Blog search

Archives
  • 2016 (1)
  • 2015 (3)
  • 2014 (6)
  • 2013 (15)
  • 2012 (16)
  • 2011 (27)
  • 2010 (9)
  • 2009 (6)
  • 2008 (12)
  • 2007 (8)
  • 2006 (18)
  • 2005 (57)
  • 2004 (104)
  • 2003 (103)
Categories
  • Apple (62)
  • Browsers (56)
  • Cloud Computing (5)
  • Clueless Recruiters (9)
  • Code (60)
  • Community (2)
  • Creating Websites (32)
  • Culture (8)
  • Design (7)
  • Digital Media (9)
  • Family Life (12)
  • Just for Fun (27)
  • Law (2)
  • Life Lessons (2)
  • Music (5)
  • Notable Quotes (1)
  • Passwords (4)
  • Personal (41)
  • Political (17)
  • Projects (49)
  • Security (6)
  • Software (69)
  • Syndication (28)
  • Technology (92)
  • The Hiring Process (1)
  • Tutorials (9)
  • TV and Movies (17)
  • Video Games (6)
  • Website (62)
  • Work and Business (8)
  • Writing (4)
Socially-aware

Twitter • Facebook • YouTube • Yelp! • Flickr • Instagram • Zerply • LinkedIn • Last.fm • Spotify • Rdio • Pinboard • gdgt

Claim to fame
  • Amazon Web Services
  • WarpShare
  • CloudFusion
  • SimplePie
Legal mumbo-jumbo

All ideas, opinions and comments I post are my own and are in no way affiliated with anybody I work with. If you quote and/or reprint something I've written or said, please direct folks back to this site as a form of attribution. I promise I'll do the same for you. Unless otherwise noted, all content on this site is copyright © 1979–2011 Ryan Parman.

Powered by Rocket Sauce. A Ryan Parman production.