According to the AWS documentation "any data stored in the RAM of the host computer or the instance store volumes of the host computer is gone." Does this mean that the web application I installed on my EC2 instance will be deleted if I stop running my instance?
I apologize for the naive question. I am new to this and worried I might make a mistake.
An Amazon EC2 instance is just like a normal computer. If you turn it off, anything in RAM is lost. Also, if you reboot either computer, the contents of RAM is lost (well, more like 'forgotten', but effectively the same).
Just like your home computer, if you reboot or stop/start an EC2 instance, it boots up again. Whatever software you have installed on the computer is still there. However, applications you were running will only start if you have configured a startup script to run the app again.
Typically, when software such as a web server is installed on a computer, it is configured to automatically start again when the computer is turned on/rebooted in future.
Elastic Block Store (EBS) disk volumes act just like a disk in a normal computer. If an EC2 instance is stopped and later started again, the contents of the disk is still there, unchanged.
Bottom line: It's just like a home computer. Don't panic.
Adding to John's answer, as long as you do not use an Instance Store volume, to store your web application, you are good to go.
The data in an instance store persists only during the lifetime of its
associated instance. If an instance reboots (intentionally or
unintentionally), data in the instance store persists. However, data
in the instance store is lost under the following circumstances:
The underlying disk drive fails
The instance stops
The instance terminates
If however you are using an EBS volume, these conditions do not apply and you are free to start and stop your instance any number of times you want.
Yes unless you have EBS volume attached to EC2. If you are using an EBS-backed instance, you can stop and restart that instance without affecting the data stored in the attached volume
Related
I am facing a challenge to scale an existing Amazon EC2 instance from t2.micro to t2.medium.
Can someone suggest me about the best practice to do this, without losing any data which stored on the t2.micro instance?
Follow these steps:
Stop the EC2 instance.
Change the instance type (e.g. t2.micro to t2.medium).
Start the EC2 instance.
Note: You will not lose the data.
When you stop an EC2 instance, what AWS does is the following:
It (AWS) shuts down the machine. So, the CPU, RAM, etc, are available for someone else to use.
It preserves the hard disk(s). Hence, your data is always with you.
In the shut-down state, you can change the machine type. This only logically links the CPU, RAM, etc. When you start the machine, AWS allocates the actual machine to you and connects your hard disk to that machine.
Note: In the shut-down state, you don't pay for CPU, RAM etc but since you keep the disk, you continue to pay a little amount towards the disk.
If you do not want to use the machine in the future select option menu > Instance State > Terminate.
The answer is simple, stop the EC2 instance, change its instance type and start it.
Note: Stopping and restarting the instance erases any data on instance store volumes. Be sure that you back up any data on the instance store volume that you want to keep. Instance store volumes are different from EBS volumes.
Reference: Back Up an Instance Store Volume to EBS
What is AWS EC2 Bundle Tasks?
Could any one please help me to understand what it is?
And any one help in showing a sample demo of it by steps or screenshot?
In the old days, before Amazon Elastic Block Store (Amazon EBS), Amazon EC2 instances were booted from Instance Store.
Instance Store is a disk that is directly connected to the host computer, which means that when an instance is turned off, the contents of the disk is lost (because the disk will be assigned to the next user who uses a Virtual Machine on that host).
This also meant that instances could not be stopped and started again, because the boot disk is lost.
These days, Amazon EBS provides network-attached storage, which persists even when an instance is stopped (and, if desired, even after an instance is terminated).
According to this article, Bundle Tasks is/was a process designed to get a Windows instance ready for booting from Instance Store:
See: Bundle Tasks in Amazon | Zeeshan Ali Shah's Blog
There is little reason to use this process these days.
I have just launched the micro instance with Centos AMI image. I have heard that if i stop the instance then my chnages will be lost. So i have read that if i use EBS then chnages will be saved.
But Its not clear to me how to do that. I want that if i stop or restart the machine then my chnages are still there.
DO i need to chnage my hard drive to EBS. How can i do that
My Root Device is comming as EBS with 10GB EBS volume. Is that ok
Yes, the micro instances always use EBS root, so you don't have to do anything special.
If you 'stop' your instance, and later start, it's moving your hard drive to another computer and rebooting.
If you terminate your instance, your EBS drive will be fine as long as "delete EBS drive on termination" is not set on your drive.
When you use other instances, you'll have to verify the AMI type. Not all AMIs are available in all combinations:
EBS vs ephemeral
64 bit vs 32bit
PVM vs HVM (Everything is PVM except the really high-end Compute Cluster)
When you first get started in the cloud, EBS is a big deal. But as you get to be a cloud expert, you'll prefer non-EBS instances. EBS will only be used on a few servers, like your database or your syslog server. Most of your app should be stateless. Your app servers should only store their data in the database, and only write their logs to a central logging server, and only get their code from github or a package repository. So so there is no need to 'backup' your app server boxes, since they can be re-created at any time from external sources using something like Puppet or Chef.
Only your 'stateful' boxes like databases need backing up, and EBS helps there.
I thought I clearly understood the difference between instance-store and EBS backed AMIs.
But http://aws.amazon.com/maintenance-help/ says "if you are running an EBS-backed AMI, you can stop and then restart your instance in order to easily re-launch it. This will cause the loss of any data you have saved on the local instance store of the instance,"
Stop/start does NOT lose the sysvol data, so this confuses me.
I'm assuming that here, by "local instance store", they mean the backing EBS volume (the sysvol), and I'm thinking that they meant to say "terminate" instead of stop. Am I correct?
Terminating an EBS-backed instance will not cause your data to be deleted. You can still access the EBS volume until you delete it (unless you set it to delete when your instance is terminated).
Local instance store refers to hard drive space on the actual physical server that is running your instance. You can see the available instance store by doing sudo fdisk -l. Some images come with some instance store volumes already mounted (see df -h). Otherwise you'll have to mount and format the instance store volumes before you can use them.
Data on an instance store volume is lost when you stop (not terminate) your instance because it is local to a physical server, and your instance might start up on a new server.
Quite simply, EC2 is running your virtual server on some physical server. The root filesystem can either be on a local disk (ephemeral storage) or on network attached storage (EBS). With EBS, they can snapshot it for backups or to make a copy, so EBS is far more flexible, although not as fast as a local disk in the server where your instance is running.
In order to make this all work, when you shutdown an ephemeral server, amazon wipes the disk in order to reallocate it to the next customer. There is no need or reason for them to do that with EBS, since it was not physically attached to that server in the first place.
You might note, that even EBS backed instances (depending on size) come with an allocation of ephemeral storage (2-500gig+) which can be used for swap, logs, or whatever else you want to do with them. The only issue of course is that should the server be shutdown, or should there be a catastrophic disk or hardware error, you'll lose that data. You can still manually back it up, in the same way people have backed up traditional servers over the years.
Making your own AMI from an EBS backed server is trivial now, and can be done easily through the AWS web interface. Making a non-EBS backed AMI is a very complicated task the last time I tried to do it. With that said, there are certain use cases where it makes a lot of sense to consider using purely ephemeral storage. Computation or memory/cache nodes that have no need to persist data will be faster and cost less.
I've launched an instance of the Basic 32-bit Amazon Linux AMI which has an 8GB volume as it's root device. If I terminate it, the EBS volume is destroyed as well. What I'd like to know is whether or not my data is protected (for example, the apache document root, or MySQL data) if the server crashes? A lot of tutorials seem to indicate that another EBS volume should be created and my data stored on that, but I'm not really seeing why two EBS volumes are needed?
Or is the current setup okay for a web server setup?
Many thanks in advance for your help!
When you spin an EC2 instance up, the root volume is ephemeral - that is, when the instance is terminated, the root volume is destroyed** (taking any data you put there with it). It doesn't matter how you partition that ephemeral volume and where you tuck your data on it - when it is destroyed, everything contained in that volume is lost.
So if the data in the volume is entirely transient and fully recoverable/retrievable from somewhere else the next time you need it, there's no problem; terminate the instance, then spin a new one up and re-acquire the data you need to carry on working.
However, if the data is NOT transient, and needs to be persisted so that work can carry on after an instance crash (and by crash, I mean something that terminates the instance or otherwise renders it inoperable and unrecoverable) then your data MUST NOT be on the root volume, but should be on another EBS volume which is attached to the instance. If and when that instance terminates or breaks irretrievably, your data is safe on that other volume - it can then be re-attached to a new instance for work to continue.
** the exception is where your instance is EBS-backed and you swapped root volumes - in this case, the root volume is left behind after the instance terminates because it wasn't part of the 'package' created by the AMI when you started it.
The other volume would be needed in case your server gets broken and you cannot start it. In such case you would just remove initial server, create a second one and attach the additional storage to the new server. You cannot attach root volume of one server to another.