Hi, new poster here in the forum. Last night I’ve created a new EC2 instance, attached SG, Storage, Instance type, same VPC & Subnet as the main instance but after realizing I should’ve spun up an Ubuntu AMI, I terminated it. AS IT WAS TERMINATED, IT ALSO TERMINATED THE MAIN SITE ALONG WITH IT. I’ve noticed there are 3 snapshots namely “Moodle Backup” dated Jan 13 and since then I’ve been trying to restore them.
How can I restore Moodle to it’s state from the snapshots? Has anyone done this before? I am a completely Linux noob so this is a total nightmare.
Edit: Looks like there are multiple backup sites I can refer to so my boss is actually pretty chill about it. (FYI THIS IS NOT THE PRODUCTION SITE I BLEW UP)
Thanks for the help guys!
Edit2: Looks like, I was let off the hook since we have multiple backup sites. Biggest lesson is to enable termination protection. and to snapshot (as a noob) whenever anything happens, because I can just restore via EBS volume.
Hello, you mentioned you created a new EC2 instance. How were you able to run your website with that? The reason I ask is, You were able to run it (so you should be able to deploy your app etc) and terminating shouldn’t be an issue. Anyway, you can send me a DM and happy to help.
In the console put a check in the snapshot and under actions choose create image. Give it a name. In the EC2 console launch instance, change it to my images, your image should be there, choose the defaults and launch it.
Like wave said. You create an image and then launch the ec2 instance from that image. But you still have to point to the new ip address of ec2 unless you ha e static reserved ip.
Should I be able to hit the site with the public IP? I’ve tried it both Public and with an elastic IP and it still didn’t seem to go anywhere… I’m kind of worried the snapshot is broken…
Check your subnet and Security group settings. You won’t be able to hit an instance at all unless the Subnet routing allows for Internet access (Default 0.0.0.0/0 route poinitng to an Internet Gateway or NAT Gateway). Also, the attached Security Group((s) need to allow for access. Restoring an instance from an AMI does not restore the original SGs.
You said there were multiple snapshots. Did the original insurance have multiple volumes attached to it? If so you need to make sure you’re restoring all of the volumes and attach them to the correct location on the new instance.
Tried both port 80 and index.html. Didn’t take me anywhere. I just noticed that I can’t even ping the elastic IP, so I wonder if the snapshot is actually broken.
Yep, I’ve used the same security groups, VPC, port ranges etc, from the original instance that was deleted. (This was setup prior) Still pooched and not sure why it didn’t work.
I’ve created the brand new EC2 Linux 14 instance with a T2.Medium. Gave it base storage, SG, VPC, and other settings that were from the main instance. (Perhaps something was tied to the main instance). Realized that the main instance was hosted on Ubuntu 20 so I terminated the test instance. As I looked for the main instance to mimic information, I noticed the status was ALSO “Terminated”… I’m fortunate this is a backup Moodle instance tied to an RDS (so the RDS is still intact and I can grab info from the production site) but I’m in my first week into this job so this is a clear bad impression
I’ve attempted this step as well. I wanted to launch the instance from the snapshots, but I’ve never attached multiple EBS volumes before. I’ve tried attaching multiple volumes and I’ve got a bounce back error the location was invalid. I’m not sure where else I should be placing the snapshot volumes besides /dev/sda1 or /dev/sda2 etc.
It sounds like the OS is not in that snapshot. Is it possible the moodle snapshot is just the volume moodle was on, and the OS was on a separate volume? If so, you need to stand up a new instance(or restore the os snapshot like Some_IT_dude is saying), then create a volume from the moodle snapshot, and attach it to the new instance.
This looks like the solution tbh. I’m scratching my head wondering why there were 3 snapshots… I’m just a little clueless wondering how I can attach all 3 snapshots together in 1 instance since I’ve never done this before.
Attaching them is pretty easy in AWS (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-attaching-volume.html). You are going to have to make sure they mount properly, which is the more difficult part, since you may not have access to the information to how the original system was setup. Unlike windows which shows the mounted volumes in disk management, you have to modify the fstab to mount your volume properly . In the fstab you specify the mount point, like /web, the file system, and other options. It’s key to know this stuff.