Express amazon ec2 ubuntu starter tutorial

The goal of this tutorial is to provide the simplest way to have a virtual machine server running on amazon ec2. It runs a ubuntu server on the smallest instance available.

  1. create a certificate and store the keys
  2. install ec2 client on your server / laptop
  3. test the client
  4. push your keypair and run your first vm !
  5. log onto the vm
  6. kill the vm (free resources)
  7. bonus

1 Create a certificate and store the keys

You need to be authenticated to talk to amazon: it makes sense. This is done by certificates. So you need to generate one on amazon.

Go to the amazon console website. Create a X509 certificate and download AT THE SAME TIME certificate and private key.

2 Install ec2 client on your server / laptop

You will interact with aws (create and destroy vms, manage services, get reports) with a command line tool. So you need to install it on your workstation.

Add this to your environment file (here it is a bashrc).

3 Test the client

Check everything is ok: you client should be able to talk to amazon.

it’s ok !

4 Push your key pair and run your first VM !

You need to push your ssh keys to amazon:  newly created vms will add it to the authorized keys. So you would do a passless ssh login.

We make a vm, the smaller one, and add the keypair to it.

If you can see your instance you have created your first amazon vm and its running !

5 Log in the VM

Ok, so the final magic step: login to your server ! note: we have the ubuntu server, a convention for amazon ubuntu images.

6 Kill your VM

The vm is running, everything is ok, but the main benefits of amazon is to handle resource as you dont need it. I mean you have to destroy the instance after using it so you dont waste more money.

7 Handy commands to know

Just two avalaible handy commands.

Listing your available keypairs

Available regions id and api endpoint.

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *