AWS ASAP

So given a working local Docker configuration, as outlined last time, what does it take to go live on AWS? Actually not all that much, so long as you don’t yet worry about downtime.

The first step was to obtain a new EC2 instance. I know ECS is the real solution here, but I didn’t want to learn another config language this weekend. And I don’t care about downtime yet. So instead I created a vanilla Amazon Linux AMI and proceeded to install Docker per Amazon’s instructions.

Next was to get my Docker image onto the instance. Since I’m using Docker Hub as a repository, the instructions above covered this part too. Transporting the image to the cloud was a simple `docker push`, and getting it back down was easy given an SSH session to the EC2 instance: `docker login` and `docker pull`. A quick SCP to push my secret WordPress config onto the instance, and I was ready to `docker run`. Sure, my deployment process won’t scale, but at least I got it running! Sorta.

In reality, there is always more configuration that needs doing. Always. In this case I hadn’t yet configured the RDS database to allow connections from anywhere, but especially EC2. After much poking around the AWS Console, I found my target under the VPC Dashboard. Apparently there are lots of ways to manage Security Groups. Mine are VPC flavored, so the VPC Dashboard is where I need to manage them. Having found the right spot, it was easy to add an Inbound Rule to the RDS group that made it friendly to the EC2 group.

Now it works! But only on my development machine. Other computers around the apartment will load the original blog post, but the page is slow and the styles are gone. A glance at Chrome’s network debugger reveals the problem: WordPress is still trying to use the IP address of the local VM where I set it up. I guess it memorized that during configuration. And it kept working locally because I’d left that VM running and the cross-domain fetches actually worked. So I visited the local WordPress admin, pointed it at the AWS address, and tried again. At last everything worked.

Since I already had a URL I wanted to point here I also set up an Elastic IP and configured my registrar to point this way. At least that part of the configuration went smoothly, though I did have to redo the WordPress URLs again. Always more configuration.

Leave a Reply

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