I needed to get lpaulriddle.com moved off an old EC2 instance running Ubuntu 16.04, which has been EOL since 2021. About a year ago, I started the process by moving all of the services to Docker containers. Then I moved all of the persistent data (web pages, images, etc) to a EFS filesystem, and I moved my MariaDB database to RDS. After that, I kind of forgot about it until just recently. I saw that AWS was doing a promotion for its new t4g.small instances for 750 free compute hours per month through 2024, so I spun one up and worked on moving the services over. It went more smoothly than I had expected. This is what I did:
- Installed Docker and docker-compose on the new instance
- Tweaked AWS security groups to allow the new instance to mount the EFS filesystem and connect to the RDS database
- Copied my Github ssh credentials over to the new instance
- Cloned my Git repo to the new instance
- Copied secrets (.env) into the git tree
- Built all of my images (docker-compose build)
- Started containers (docker-compose up -d) – I actually did these one at a time, but this would have worked as well
- Tested everything out by modifying my /etc/hosts file
- Disassociated my elastic IP address from the old EC2 instance and assigned it to the new instance
This all went off without a hitch, and everything seems to be working. Functionally, the new instance is ARM vs x64, and the OS is Amazon Linux 2023, which is yum based, vs Ubuntu, which is based on apt/dpkg. This post will serve as a test that I can create blog posts using the new infrastructure.
Next, I think I’m going to move my database off RDS and back onto a MariaDB container with the database in EFS. RDS has turned out to be a little bit pricier than I had expected, and I think it’s overkill for my rather modest needs (basically a single WordPress blog and a MediaWiki instance).