I'm currently running critical services on an End of Life Amazon Linux 1 EC2 instance (AMI 2018.03). The services include dovecot (with emails stored on a 500GB EBS volume), postfix (which my MX record points to), and a LAMP stack (including PHP, Apache, and MySQL for vimbadmin). I'm looking for the safest way to migrate to a newer version of Amazon Linux while preserving my existing configurations for these services. Any advice?
3 Answers
Consider spinning up a new instance using a configuration management tool like Ansible. It might also be wise to separate your email services onto one instance and the LAMP stack onto another. Upgrade the LAMP side while pointing to the old instance to minimize the upgrade risks. It's best not to attempt an in-place upgrade; instead, build and test your new setup alongside the old one.
A good strategy would be to take an EBS snapshot of your current instance and use that to set up a new server. Once you have the new server configured and running, you can cut over to it smoothly.
For easier future maintenance, it's a good opportunity to adopt CI/CD practices. Instead of manually installing and configuring software, write scripts to automate these processes and use UserData or SSM documents, depending on what fits your setup best. This way, if your EC2 instance fails, you can recreate it quickly without having to recollect your past configurations.
Sounds intriguing! I haven't used AWS CDK before. Does it handle package installations and dependencies too?

Absolutely! And remember to keep your OS up to date. If this is for a business, follow good InfoSec practices and audit guidelines. Always run a current operating system, apply patches regularly, and automate your configurations to make everything repeatable.