Connecting to an AWS linux instance

 

 

There are advantages and disadvantages with Linux servers one undeniable advantage is that there are much cheaper. Especially so if the distribution does not charge for licensing costs.

I am going to demonstrate how to connect to an AWS Ubuntu instance from my MAC and my Windows machine.

First the MAC.

This is one of those things that is much easier to do on a Mac.

First start an Ubuntu instance using the AWS management console.

One the instance has been provisioned click on connect.

Once the instance is running click connect.

Screen Shot 2014-07-14 at 11.17.37 am

and as the popup explains there options to connect.

Screen Shot 2014-07-14 at 11.19.12 am

For the MAC if you have not done so already you need to change the permissions on the pem file and you do that by opening your terminal window changing to the directory with the pem file in it or better still moving the pem file to your pwd.

Then from the terminal window type the following command

chmod 400 pemname.pem 

Then finally to connect run the following command

ssh -i pemname.pem ubuntu@dnsstring

or just copy and paste from the AWS  screen and paste it in to the terminal. Type in yes when requested and then you should be able to connect like you were on the terminal.

 

Pauls-Mac-mini:~ paulframpton$ chmod 400 doeonfire.pem

Pauls-Mac-mini:~ paulframpton$ ssh -i doeonfire.pem ubuntu@ec2-54-206-235-125.ap-southeast-2.compute.amazonaws.com

Welcome to Ubuntu 14.04 LTS (GNU/Linux 3.13.0-29-generic x86_64)

 * Documentation:  https://help.ubuntu.com/

 System information as of Mon Jul 14 01:17:25 UTC 2014

  System load:  1.91             Processes:           90

  Usage of /:   9.7% of 7.74GB   Users logged in:     0

  Memory usage: 1%               IP address for eth0: 10.251.29.206

  Swap usage:   0%

  Graph this data and manage this system at:

    https://landscape.canonical.com/

  Get cloud support with Ubuntu Advantage Cloud Guest:

    http://www.ubuntu.com/business/services/cloud

0 packages can be updated.

0 updates are security updates.

The programs included with the Ubuntu system are free software;

the exact distribution terms for each program are described in the

individual files in /usr/share/doc/*/copyright.

Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by

applicable law.

ubuntu@ip-10-251-29-206:~$

Now for Windows.

 AWS’s documentation

 First you need to download PuTTY also make sure you download the SSH key Generator.

Open the Putty key generator.

1

click load

and navigate to where you stored the pem file.

You will need to change to view all files to see it.

2

Click OK

3

click Save private key

4

Click Yes

5

Click save.

You can not close the key generator.

Open PuTTY

Click on your instance in AWS and click connect.

6

Select the part highlighted which is username@computername and copy it to your clipboard. Then go to putty and paste it in the hostname field.

7

8

Next navigate to connection SSH then click on Auth.

Under Private key file for authentication click browse find the ppk file that you created earlier and click Ok.

Then click open.

9

If everything went well you should be logged in.

 

 

 

 

 

 

Quick guide to using the vi editor

I am just going to show the most basic things you need to know about vi.

first to open a file type

vi /directory/file

to write a new file do the same thing in this case I am going to write a file called myfile to the desktop

vi /desktop/myfile

Screen Shot 2014-07-07 at 10.57.00 am

I am doing this on a MAC but it is fairly similar on a Linux bash shell

When you open a file you are in reading mode by default.

to write to a file press the “i” button on your keyboard

Screen Shot 2014-07-07 at 10.59.54 am

This puts you in insert mode. You can only enter text in insert mode.

So now you can type text normally

Screen Shot 2014-07-07 at 11.03.44 am

To get out of insert mode press the escape key “esc”

The word insert disappears.

Screen Shot 2014-07-07 at 11.05.46 am

To save this document you need to press the “:” followed by the “w” key and if you are going to close the document the “q” key.

I will just save it at this stage.

Screen Shot 2014-07-07 at 11.13.44 am

Note this would have worked if I was using a linux distro but for some reason my Mac requires me to create the file first you can do that with the touch command

touch myfile.txt

Screen Shot 2014-07-07 at 11.25.16 am

to close the document type :q

if there has been some editing of the file and you don’t want to save those changes type “:q!”

That is all you need to know to open a file edit it, save it and close it again.

How to watch Netflix in a country where it is not available

I have found a way to do this from Australia but you need a few things to make it work.

You need access to a linux server in the United States I recommend an AWS Ubuntu M3 medium instance.

You also need a Mac or a Windows PC (Netflix does not work on Linux and It does not work on an RDP session. At least it didn’t for me.)

These instructions are for Mac for Windows PC Click here.

Copy your key pair (that you created in AWS) to the home directory on your mac /Users/username. Then you need to change the permissions of the pem file open the terminal window and enter the following  command:

chmod 400 pem.pem    (or what ever you called your preshared key, it ends in .pem)

Start your Linux instance

now connect to your Linux instance with the following command

 

ssh -i pem.pem -D 8080 -C -N ubuntu@ec2-54-196-159-117.compute-1.amazonaws.com

the bit in red is your connection string and it may be ec2-user depending on what type of instance you use. Copy the sting from AWS 

when you connect it will ask if you want to accept the connection type yes the cursor should remain solid.

Now go to system preferences on your mac

click on network

Screen Shot 2014-05-21 at 10.41.12 am

Then click on advanced

Screen Shot 2014-05-21 at 10.42.59 am

click on the proxies tab

Screen Shot 2014-05-21 at 10.44.08 am

Select SOCKS Proxy and for proxy server use 127.0.0.1 with port 8080

Press OK then Apply.

If this has worked you should be able to open

netflix.com and be able to join.

Used your credit card (not paypal) and supply a zipcode that is in the region where your AWS instance is. Which is in North Virginia by default.