AWS day to day

I love working from the console and aws-cli could be your best friend. Guide how to install this on you system can be found on [Getting Set Up with the AWS Command Line Interface] (

Once you have finished all the step and can execute aws ec2 describe-instances from your favorit console your are ready!

aws ec2 describe-instances

First step is to generate a SSH key, you can use multiple keys depending on needs.

ssh-keygen -t rsa -f ~/.ssh/aws-<NAME_OF_KEY>-ec2 -b 4096

Next step is to upload your SSH key to your AWS.

aws ec2 import-key-pair --key-name aws-<NAME_OF_KEY>-ec2-key --public-key-material "$(cat ~/.ssh/aws-<NAME_OF_KEY>

Now its time to crete a security group and some basic rules. In my case I only want to allow SSH traffic from a know WAN IP.

aws ec2 create-security-group --group-name SSHRule --description "Inbound SSH from know IP address"

aws ec2 authorize-security-group-ingress --group-name SSHRule --cidr <WAN_IP>/32 --protocol tcp --port 22

I use Frankfurt DataCenter and you can find images on Amazon Machine Image (AMI). In this example I’m using Ubuntu Server 14.04 LTS (HVM), SSD Volume Type - ami-accff2b1 on a micro hardware model.

aws ec2 run-instances --image-id ami-accff2b1 --key-name aws-<NAME_OF_KEY>-ec2-key --instance-type t2.micro --security-groups SSHRule

Machine will now be build and external IP address associated with the host. You can find the PublicIp address greping the describe-instances.

aws ec2 describe-instances | grep PublicIp
|||  PublicIpAddress       |  52.XX.XX.83                                         |||
|||||  PublicIp      |  52.XX.XX.83                                             |||||
||||||  PublicIp      |  52.XX.XX.83

Now you are ready to SSH to your machine.

ssh -i ~/.ssh/aws-<NAME_OF_KEY>-ec2 -l ubuntu 52.XX.XX.185