@kush good point with git pull and docker compose. I do similarly on my AWS instance.
Forgot to mention earlier, an alternative I’ve only heard good things about at recent prices vs what you get, is with DigitalOcean. They have very good tutorials for a lot of things. Worth checking out for setting up your server for the first few times. There are some nice guides for several different OS for setting up for a LAMP server for instance.
I do agree, the products and pricing on AWS appears to be a nightmare, there are so many things that it’s near impossible to get a clear overview of what’s what and how much it cost at the end of the day. Aws does have a nice Billing panel with a great overview, so you can track everything at any time.
In the end of creating your instance you’ll be able to download a key file, *.pem. Download this one and store it in more than one place, if you lose it, it can be a tedious nightmare to get one from amazon, since they are insanely strict when it comes to security. Without it, you lose access to your instance without it. Don’t forget to chmod 400 file.pem or you won’t be able to use it with ssh -i file.pem ubuntu@yourserverip.
At the end of the day, there aren’t many things you need to look at when you start out. There are EC2, VPC, Elastic IP, Spot Instances, EBS and Route53, will explain what they are further on. Below is a screenshot of one of my earlier bills when I was using free tier servers. At the moment I’m paying for one, because I need 4 gigs of RAM due to git server and some other services.
One thing that doesn’t show on my bill is traffic, all uploads to your server are for free, downloads cost. I have yet to be billed for downloads, and I’ve been in the 10 gig area. If you do have files to transfer to other people, consider storing these files on dropbox and simply add a link to those on your website that’s hosted here. Just an idea.
As you can see, it has a Linux t2.micro instance with 283 hours on it. The hours doesn’t mean it’s been for that amount of hours, 1 hour = 1x CPU@100% for 1 hour, at 10% utilization you’d get 10 hours of running out of it. You have 720 hours/month for free
Route53 is DNS service. If you have your own domain, you can move it here, and will have easy access to administering it, create sub domains as you please for virtual servers. More on Route53 below.
EBS storage, as you can see is below the monthly free tier, and is therefore free of charge. More on EBS below.
The good thing with using Route53, is the time it takes to update. Since AWS is hosting some of the top tier DNS servers, the update is close to instant. In many cases, you’d have to wait 3-6 hours, sometimes 12 hours or more for the sub domain you created to propagate to lower tier DNS servers. This even works when running over dodgy DNS servers, I’m currently using Russian DNS servers, they block a large amount of the google tracking and commercials crap, so I have a lot less spam on websites because of this.
VPC is Virtual Private Cloud, it’s a bit of an advanced feature, the standard settings are fine for starters, but using this, it’s possible to segment and have complete control over your cloud network, which can be v nice in some situations. In free tier you can have two of these, everyone after that cost. VPC is dependent on the availability zone you chose to create you server in, so if you already have a VPC in zone A, you can’t access it in zone B without messing around a bit. (more on zones further on)
Elastic IP is a neat feature. It gives you a static IP on the internet. So lets say you setup your server with DNS and all the fixings, something goes tits up and you have to setup a new server. All you have to do is to move you Elastic IP to your new instance, and everything previously configured will point to your new server. You can have one elastic ip for free.
EBS storage can be used to make your experimenting easier. You have the standard image with your OS. This is an 8GB image/volume, for the remainder of your data, it’d be a good idea to make one or two other volumes, and on these you store the services you want. This could be websites, your data files, configurations and whatever you might need. If you ever have to reinstall your server because of something going wrong. You simply mount these volumes on your new server and symlink or bind mount to your services to your data on there, and within a very short time, you’re ready to go again. We’re looking at 10 minutes from taking down old server until everything is back up and running again with all the fixings. In a case where you start mounting extra drives, add them to fstab using their partuuid and not their direct device name (/dev/xvdbX). Can save you a lot of grief.
Spot Instances are very nice, if you want to try out something that requires more processing, or just want to have a bigger server to work on for little money. It’s possible to get 4vCPU, 16GB RAM with 90% discount. Beware tho, I’ve had a spot instance up for 3 months without any down time, but I’ve also had spot instances that ran for 6 hours, and then were down for 18 hours. These instances are running on leftover server power. So if you’ve created your server in an availability group (more on this in a bit) with high traffic, you can expect for full paying customers to eat the extra resources that were available, and your instance will therefore be shut down until resources free up. There are two different calculators in your management console in regards of Spot Instances, there you can see pricing and uptime over the last months and get a feel for the zone.
Most Zones (data center in for instances Frankfurt, Ireland, Ohio), are divided into availability groups. My servers are located in Frankfurt, so I’ll be using that as reference, has three groups, A, B and C. A and B are quite well saturated, and therefore have very little resources left over, so for instance starting a spot instance in one of these will have greater down time than if you created your server in group C.
There is loads more to AWS, but this should be ok to at least get started a bit. If you have any more questions, feel free to ask. Glad to help.