— note i am not responsible for any damages made to anything if you follow this guide, these are just personal notes  —

— these are just my notes on how I setup the basic stuff, one day Ill make an article out of this, but I think the common people can decipher thru my cryptic notes to self —

Download fully putty installed google “download putty” I need you to install putty and pageant (used to convert and use and create keys)

Get amazon account its free as long as you stay with in thresholds 🙂 as the link below mentions

Log in to

 Aws.amazon.com

Go to  aws.amazon.com/ec2 and get to the ec2 management console and make sure to select the right location I chose North California (note settings, like keys, instances aka vms, and security gorups, network cards, volumes, are unique to the locaiton.. So if you have a key1 made in north cali you will not see it from West location)

Make a key and export it and remember the name, convert it to use with putty using the program pageant so you will convert it to some other forms, I would convert to every form and save em all

Again Save the key you just made, zip em up, attach em to your secret password database

We will use these keys to login via SSH since first logins are via username (admin or whatever the machine you bought for example lampstack you login with username bitnami and the password doesn’t matter as you will use the key… In putty you can specify what key to use via auth tab)

So then click on start instance from the ec2 management console..

And shop for instance. Note what username you will use when you connect to the VM and how to gain root access. For example the debian 7.1 box only allows you to connect(at first) with  “admin” and then gain root access with “sudo -I” (then of course you can modify that)

Select mini-tier that’s free 750 hours per month (note there are 720 hours in a month, so you are not going to go over most likely, there are other thresholds to worry about) Read more on costs here:

http://serverfault.com/questions/326168/what-is-the-true-cost-of-amazons-ec2-free-tier (just incase that link went down I have a copy of what was said below)

 Make sure the system uses your new key and you can preview the security group it uses (A security group is a firewall, so that’s where you tell amazon what ports to forward to your machine, by default only port 22, if it allowed every port in these vms would be very unsafe)

Launch the system from the ec2 management console, check out the DNS name its very long, check out the public ip and private ip. In the instances tab this is all under description when you click on your instance… I also recommend right clicking on your instances name column and setting the name to something like “ec2debian”

SIDE NOTE: There are options if you right click on the instance, start(boot up the instance vm), stop(shutdown the instance vm), terminate. do not terminate the vm unless you want to start a new one. Terminating an instance cancels it so you don’t have to worry about any costs for it, so if you have a terminated one just lingering there and are wondering if you can still maintain the freeness from ec2, yes you can from what I experienced. I Started up a few bad instances that had to terminate before I settled with what I wanted and I didn’t get charged.

I set my dns to have an A record to point at the public ip. So for example My instance got the public ip 1.1.1.1 and I went in to www.godaddy.com and logged in to my domain mydomain.com  which I purchased thru them, and logged in to the dns manager and edited the zone to have the following a record: A record “ec” points at “1.1.1.1” without quotes of course and I saved. Then the end result is ec.mydomain.com is the same as 1.1.1.1

So then go back to ec2 management console and check security groups make sure inbound tcp 22 is allowed on 0.0.0.0/0 meaning that’s every ip. So you can log in remotely

Go to instance tab click on your instance and copy all of the description stuff to your safe info keeper (Same place you saved you key) this description stuff tells you which key you used and what security gorup and what the ips and dns names are.. Ips because it has private and public ips.

Open putty point it at long dns or public ip and make sure you do it like this username@1.1.1.1 or username@fulldns name.. Note the fulldns name usually has lots of dots and the word amazon is in it, its fully qualified to the ec2 service. Anyhow the username you get from when you setup the instance. Username is the username that is mentioned when you buy the machine, they always want you to log in with a certain username, for debian 71 it was admin, for lampstack it was bitnami… also the password is the key so go to auth tab and put your key there – you will know which type of key to put in based on the extension its asking for, but that’s okay because using pageant you made every extension. Note when you log in it will not ask for password as you just used putty to auth you in with the key.

I would change the password of the username, for debian it was admin for lampstack again it was bitnami, I changed the password to something secure and wrote it down in my safe place ( where I saved my keys and instance description which had the ips and dns info and more)  … passwd <- that’s the command. If that fails log in to root with sudo -i and then do this passwd admin or whatever the username is

Then log in to the root user whichever way that is and give him a password too. sudo -i and then just passwd or even passwd root note most likely they will still want you to connect via ssh with your key instead of password

After you have set the password for root and admin(or whatever the primary initial user is, again for debian its admin and for lampstack it was bitnami) I blew it off

Test settings by connecting with the dns and the ip and also with your own dns ( the one you change d at your “godaddy” or like domain hosting site)

SIDE NOTE: Maybe you are confused but, ec2 gives you a full qualified dns name (long name with amazon in it) and also an IP, but we also set our own dns with a service like godaddy so that a domain like mydomain.com can have an a record like ec, thus ec2.mydomain.com can point to the same machine just the same as the amazon fully qualified dns name would reach you and the ip

Ip = fully qualified dns name by amazon = fully qualified dns name by your dns hoster

SIDE NTOE: Note there is probably away to host dns with amazon, I just havent got that far, I am using godaddy for that and ec2 amazon for the vms obviously

Okay after everything is setup and tested, go to the ec2 management console and go to volumes, there  you will see the small drive that your vm (instance) has and you can right click and take a snapshot… Name the volume initial. That’s my backup, if I mess up I can just revert to that and not have to do the config from above 🙂 I keep making snapshots I was curious if snapshots compile to cost money, again as long as you don’t go over your thresholds as the article said you are okay, so just keep an eye on these thresholds (which I know exist in some way that you can monitor I just don’t know yet how, google is our friend)

NOTE: IF you install something like apache which needs port 80 open, besides the Linux firewall you need to also check the amazon ec2 firewall, again you set that thru the ec2 console management under security groups click on the security group managing your instance/vm and just go to inbound rules and hit add (for all ips just put 0.0.0.0/0).

###############################################

###############################################

 

What is the true cost of Amazon’s EC2 Free Tier?

QUESTION

I noticed that Amazon has a free EC2 tier. I am very interested in trying it but am afraid to host my own site there. My head starts to spin when I see all of the ways they charge users (charges for bandwidth, disk space, # of hours of operation). I just want to run a drupal site and have ssh. I get less than 5,000 hits/month, but am growing often. I have no serious problems with my current site but am trying to save a little bit of cash.

I see posts like this and wonder if I will be stuck paying $10 or so a month any way. Can anyone confirm that free is really free? What are “traps” that people fall into that ends up costing them money?

amazon-ec2 cost

ANSWER

If you are just running a Drupal website, you will need an EC2 instance with EBS storage and an Elastic IP address (all EC2 instances have SSH access). The EC2 instance (t1.micro) will be free (for 1 year, if you are a new customer) 

You get 10GB of EBS storage – the default Amazon Linux AMI has an 8GB root volume. I would recommend shrinking this down to about 4 GB and attaching a second 6GB volume to your instance (at least personally, I like to keep my data separate from the root volume). One area where you might incur costs are for I/O. Amazon’s Linux AMI is quite efficient, but depending on your drupal setup and traffic, it would not be unexpected to exceed the 1M I/Os you get per month.

Ideally, you will use EBS snapshots for your backups, however, that is very dependent on the amount of data you have. This is one of the reasons I like to split the root volume from my data. It is very easy to exceed 1GB of snapshot storage, and it can be quite difficult to estimate your necessary snapshot space (the first snapshot will be around 50% of your used space (depending on how compressible your data is). Each subsequent snapshot will take much less, since it is a differential backup, but looks at changed blocks as opposed to changed files. Alternatively, you can take more traditional backups (tar.gz) and upload them to S3 (remember though, that generating those backups result in I/Os).

Your final cost will come from bandwidth – 15GB per month is included in the free tier. Determine your current bandwidth usage to see whether or not you will go over.

At any time you can view your current account activity on Amazon’s site, so you can monitor if you are getting close to the threshold values. Unfortunately, there is no way of setting caps on resource usage on AWS – whatever you use you have to pay for.

I would recommend setting up an EC2 instance, but keeping your existing host operational to begin with. You can switch your DNS to point to your AWS Elastic IP and try it out, keeping an eye on your Account Activity. If you find that everything is well within an acceptable range, you can do away with your existing host, otherwise, it is a simple matter of reverting your DNS and rsyncing any changes to go back to your old host (remember to delete your snapshots, EBS volumes, and stop your instances otherwise you will continue to incur costs). AWS also provides ‘reports’ with hourly activity broken down by resource usage – they are a bit hard to read, but you should be able to make sense of them. They can help you to determine when and what might be causing your usage to to be higher than normal.

Just to recap: you should be able to predict bandwidth usage in advance – which means that I/O will be the main factor that is hard to predict (and snapshot usage if you opt to go that root).

Leave a Reply

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