amazon-ec2instancetype

How to change instance type without losing data on attached EBS volume


I am using an Amazon EC2 instance and I have attached an EBS volume /dev/xvdf of about 3TB to it.

[centos@myec2ip ~]$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/xvda1      8.0G  3.5G  4.6G  43% /
devtmpfs         16G     0   16G   0% /dev
tmpfs            16G     0   16G   0% /dev/shm
tmpfs            16G  161M   16G   2% /run
tmpfs            16G     0   16G   0% /sys/fs/cgroup
tmpfs           3.2G     0  3.2G   0% /run/user/1000
/dev/xvdf       2.9T  2.0T  825G  71% /mnt/toil_20k

My instance type is currently m4.2xlarge and I want to increase it to m4.4xlarge.

As you can see, I have about 2TB data on my EBS volume which is mounted on /mnt/toil_20k. I saw a couple posts on how to change the instance type but just want to make sure as I cannot risk losing the data. How can I change my instance type without losing any data?


Solution

  • You would only lose the data if you deleted the EBS volume. Just stop the instance, change the instance type, and restart it. The EBS volume will remain unchanged.

    If you care about the data on the EBS volume you should be taking EBS snapshots regularly anyway. Take a snapshot before you make any other changes to ensure that you have a backup.