How to replace an Amazon EC2 instance with a new one?
-
21-06-2021 - |
Question
How to replace a Amazon EC2 instance with a new instance without removing tomcat7
, mysql
and other setting done on the instance?
Solution
Simple:
- Stop the instance.
- Detach the volume(s) - if you just have one volume (the boot volume) detach that.
- Take a snapshot of the volume(s) for safekeeping (not strictly necessary in this case, but no-one ever got fired for taking backups of critical systems).
- Terminate the instance.
- Spin-up a new instance of the desired type (must be the same platform, i.e. x86 or x64, as the original).
- Wait until it's running, then stop it.
- Detach its' volume and delete it.
- Attach your original volumes to it (the boot volume must be /dev/sda1).
- Restart the new instance and re-assign Elastic IP if appropriate.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow