juanba1984
juanba1984

Reputation: 357

Data loss after upgrading instance type in AWS EC2

I upgraded an AWS EC2 machine 10 days ago (from t2-medium to t2-large). Again, I just upgraded today the same AWS EC2 machine (from t2-large to t2-xlarge) and after rebooting I noticed a massive loss of data (10 days of work). In fact, after changing instance type I found out it reverted to the same "state" of the machine just after doing the upgrade 10 days ago. Not less important, I have been doing snapshots periodically (twice a day), and when I try to recover from the last one, each snapshot is an exact copy of the machine after the first upgrade.

This is not the first project I have in AWS, and everytime I did a snapshot, it would always keep the very last copy of the machine. But NOT in this case. So I am really dazzled.

Can you give some hint on what could happen? Is it normal that AWS deletes data (DDBB + folder and files) when changing instance type? Do you think it might have to do with IAM policies?

Thank you

Upvotes: 0

Views: 2554

Answers (1)

matsev
matsev

Reputation: 33789

The EC2 user guide has information about the EC2 Storage options. To summarise:

  • The EC2 instance store volume is erased when the instance is stopped or terminated.
  • In contrast, EBS (Elastic Block Storage) can be mounted to a running EC2 instance (c.f. a physical hard drive). EBS volumes can be detached from one instance and attached to another instance. Moreover, you can create a snapshot of an EBS volume that is stored in S3 and you can recreate EBS volumes from that snapshot that can be attached to other EC2 instances.

The EC2 user guide provides step by step instructions:

  1. Restoring an Amazon EBS Volume from a Snapshot
  2. Attaching an Amazon EBS Volume to an Instance

Lastly, no, this behaviour is not related to IAM policies.

Upvotes: 2

Related Questions