Skip to content

Virtual Private Cloud (VPC) HOWTO

April 15, 2010
NOTE: This is my most popular post, and please do realize the date that it was written. I have not kept up on this subject. It is possible and likely that there are easier ways and newer docs from Amazon themselves. Check newer blogs, and cross reference Amazons docs to be sure you are doing this the right way. Enjoy! -Nick Yeates-
amazon web services logo
Also see What are VPCs?
The following is a technical instruction / log / tutorial / howto of how I went about setting up and instantiating an Amazon EC2 VPC server. It assumes that you or a systems/network admin has already setup the backend VPC connection from the Amazon Cloud gateway, to the Internal Gateway. The Internal Gateway is usually a high-end router or switch (Cisco, Juniper) that has the feature to do this built-in.
If you are looking to setup the backend VPN/VPC connection, refer to Amazons great documentation at:

VPC Install

Followed directions at:

Also a good beginner command-line tutorial is:

I setup the environment below on a mac. The setup steps are slightly different on a mac, than from what is explained on the amazon docs, which is angled for straight linux/unix. Mostly the difference is in how macs do environment variables and paths.

Java Setup

  • setup java in mac shell
    • nano ~/.bash_profile
      
      export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home
      
      #Restart shell
      
      $JAVA_HOME/bin/java -version
      java version "1.6.0_17"
      Java(TM) SE Runtime Environment (build 1.6.0_17-b04-248-10M3025)
      Java HotSpot(TM) 64-Bit Server VM (build 14.3-b01-101, mixed mode)

X.509 Credentials

You can use existing ones on the existing amazon account (if you have the private key from whoeover originaly made it), OR You can create your own new ones. Here I made new ones, according to the guide linked above.

  • AWS UI Sign in > Accounts > Security credentials > X.509 tab > Create New
  • Saved file pk-KFGXD35XEHEO5OUO3IE2OETS5UMPA3JA.pem and cert-KFGXD35XEHEO5OUO3IE2OETS5UMPA3JA.pem
  • Put files in locations
    • mkdir ~/.ec2
      mv ~/Downloads/pk-KFGXD35XEHEO5OUO3IE2OETS5UMPA3JA.pem ~/.ec2/
      mv ~/Downloads/cert-KFGXD35XEHEO5OUO3IE2OETS5UMPA3JA.pem ~/.ec2/

Setup EC2 API tools

These are used to run the command line calls that we will use later.

  • Download and unzip as per docs; I unzipped to ~/ec2-api-tools-1.3-46266
  • Tell the tools where they live
    • nano ~/.bash_profile
      
      export EC2_HOME=~/ec2-api-tools-1.3-46266
      export PATH=$PATH:$EC2_HOME/bin
      export EC2_PRIVATE_KEY=~/.ec2/pk-KFGXD35XEHEO5OUO3IE2OETS5UMPA3JA.pem
      export EC2_CERT=~/.ec2/cert-KFGXD35XEHEO5OUO3IE2OETS5UMPA3JA.pem
      
      #Restart shell

Check to see if working

  • # check to see that variables are there
    env
    
    # check to see that command and connection to AWS is working
    ec2-describe-regions
    
    # test create and stop an instance
    ec2-run-instances ami-b232d0db --key awsnickkey
    ec2-describe-instances i-dd2142b6
    ec2-stop-instances i-dd2142b6
    ec2-terminate-instances i-dd2142b6

Create VPC instance

  • Went to UI and started to create an instance so that I could paruse the Community AMIs
  • Found suz-lab centos 5.4.5 images
  • Start instance
    • ec2-run-instances ami-6b608c02 --key awsnickkey --monitor --subnet subnet-e43dfd8h --instance-type c1.medium
    • ec2-run-instances ami-6b608c02 --key awsnickkey --monitor --subnet subnet-e43dfd8h
Advertisements
3 Comments leave one →
  1. May 4, 2010 3:00 pm

    mv ~/Downloads/pk-KFGXD35XEHEO5OUO3IE2OETS5UMPA3JA.pem ~/.ec2/
    mv ~/Downloads/cert-KFGXD35XEHEO5OUO3IE2OETS5UMPA3JA.pem ~/.ec2/

Trackbacks

  1. Tweets that mention Virtual Private Cloud (VPC) HOWTO « DigitalCooings -- Topsy.com

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: