Setting up an AWS EC2 instance for Gastropoda
It all started with a cool little PHP script that someone posted on /r/gamedev this morning to publish completed Trello tasks easily to a change log of sorts.
I had just re-started using Trello, creating a public Gastropoda board to keep track of my progress (starting with the migration to Laravel).
So I was excited to try out the script and have some sort of automated progress log. What I conveniently forgot was that my Octopress host - AWS S3 - only hosts static sites. PHP is out of the question. And I figured…I could probably generate the actual page and publish it as a static site just like I do with Octopress, but I’m going to need to host Gastropoda somewhere anyway and I wanted the whole Trello-link thing to be real time. I may as well set up the whole shebang now.
Well, I didn’t end up setting up the whole shebang because I didn’t want to pay for RDS while only hosting one PHP file. I did, however, set up an EC2 instance through Elastic Beanstalk and point a subdomain to it. You can now find a simple progress log (taken from my Trello “Done” column) at gastropoda.liza.io
My worry with this thing is how much it’ll cost. S3 instance is ridiculously cheap, but it seems as soon as you migrate to the world of ec2 and databases the costs go up substantially. If you just want to host a static site, S3 is way cheaper than a regular shared host. However EC2 with RDS can be considerably more expensive than a shared host (although the service is of course better). We’ll see what the first bill is for this one simple low-traffic PHP page. The setup looks like this:
- Set up through Elastic Beanstalk
- One application with so far one environment
- t2.micro (so with VPC)
- No RDS (yet, though I'll obviously need it when it comes time to host the actual simulation)
- Continuing to use Route 53 for domain management
- Hosting actual site files on S3 (of course as it's auto-uploaded to the designated bucket during deployment)
There are some bugs with the script (like labels having to be applied in a certain order if there are multiples on one task), which I might take the time to fix myself later. For now though it works.
In the meantime, I’m now porting the racing implementation from vanilla PHP to Laravel. I’d say I’m about 75% of the way there. Slowly but surely.