I was reviewing my AWS console and found that there are 7 EBS volumes that are not in use and other 5 are in use attached to ec2 instances. I was thinking to delete those not in use volumes but was not sure if they have any required data or not and there is no way to check it unless you attach it with ec2. Earlier the account was managed by other person who is not available so I am not sure if free volumes were ever used/attached with any instance. I will go ahead and delete those if someone can help me to understand following
1.Can I delete not in use volumes ?
2.If they were attached ever with any ec2 instance then will deleting the volume effect my system and is there any change that I will lose my current live data ?
3.If I will lose data then is there any way to take backup of these volumes
I tried to communicate with AWS support but didn't get any help, they just suggest same like attache it ec2 and then check the data etc but never answered if I will lose data or not.
Any help will be appreciated.
Thanks
You can delete not in use volumes, in fact you can only delete those. (if not in used means not attached to an instance).
Only you or someone with access to your system knows if the data you have on your volume is needed. If they are not in use then they unlikely to hold any "current live data".
You can create a snapshot, but it's not the kind of backup you need.
You should really just attach it and see what's in there for yourself. No one else can do that for you or really answer if you will lose data without knowing what is in there.
Related
If you use EC2 and launch instances, you can add EBS volumes. So a storage option. However, what I still don't understand exactly is why. Why is there or does EC2 even need a storage option like EBS or Instance Store? What does EC2 store anyway? And why it makes sense that there is EBS?
I know that EBS volume is persistent block storage and data is not lost after exit, unlike instance store. I just don't really understand what EBS is useful for. For which cases and applications is EBS used? Or does using EBS have more to do with creating snapshots that you can create to cache data and then save it to S3?
I've already read a lot and tried to make it understandable somehow, but somehow I can't get any further here. I would be really happy if someone could shed some light on this for me.
Thank you already!
Think of an Amazon EC2 instance as a normal computer. Inside, there is CPU, RAM and (perhaps) a hard disk.
When an EC2 instance has a hard disk, it is called Instance Storage and it behaves just like a normal hard disk in a computer. However, when you turn off the instance and stop paying for it, the EC2 instance can give that computer to somebody else. Rather than giving your data to somebody else, the disk is erased. So, anything you stored on Instance Store is gone! (In truth, instance store is also a virtualised disk, but this is close enough.)
In fact, in the early days of EC2, this was the only storage available. If you wanted to keep data after the instance was turned off, you first had to copy it to Amazon S3. People didn't like this, so they invented Amazon EBS.
If you want to keep your data so that it is still there when you turn on the instance in future, it needs to be stored on a network disk and that is what Amazon EBS provides. Think of it a bit like a USB drive that you can plug into one computer, then disconnect it and plug it into another computer. However, rather than being a physical device, it uses a storage service that keeps multiple copies of the data (in case a disk fails) and lets you modify the size of the disk. You are charged based on the amount of storage space assigned and how long the data is kept ("GB-Month").
Amazon EBS Snapshots are simply a backup of the disk. A snapshot contains all the data currently on the disk, allowing you to create a new disk anytime that will contain an exact copy of the disk as it was when the snapshot was created. This is great for backups, but is also very useful for creating multiple EC2 instances with the same disk content. An Amazon Machine Image (AMI) is actually just an Amazon EBS Snapshot plus a bit of metadata. When a new EC2 instance is launched, it uses an AMI to populate the boot disk rather than loading the operating system from scratch every time.
It is possible to create an AMI that populates an Instance Store disk. This way, you don't actually need to use an Amazon EBS volume. This is good for instances that don't need to permanently keep any data -- they could simply store information in a database or Amazon S3 instead of saving it on disk. Instance Store disks can be very fast since they don't send data across the network, so this is very useful in some situations.
In summary:
Instance Store is a normal disk in a computer (but it gets erased when the instance turns off so nobody else sees your data)
Amazon EBS volumes are network-attached storage that stays around until you delete it
I’m using the g2.2xlarge instance type. This pricing table shows that the instance has “60 SSD Instance Storage.” The Best Practices for Amazon EC2 tells us that “the data stored in instance store is deleted when you stop or terminate your instance.” However, I have stopped the instance and the data on it remained. So does that mean that the data is on EBS or… I'm relatively new to EC2 and I just want to know whether I need to back up my data.
Yes, you should.
Here's why:
The data in an instance store (i.e. your 60 SSDs) are guaranteed to persist only during the associated instance's lifetime. This means that data is guaranteed to persist over reboots, but not if you were to STOP or TERMINATE the instance. In this scenario the underlining hardware may be replaced and you might lose everything. You are also subject to disk drive fails that can corrupt your data.
You said you did not lose anything when you stopped the instance, but you could have.
Therefore, you should use EBS or S3 or something else to backup your data.
Bonus points: you cannot detach your instance storage, what can be a problem if you ever need to change your instance - which you are very likely to do at one point.
Source: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/InstanceStorage.html
Cheers!
Backing-up is ALWAYS a good policy.
In the case of AWS EC2, however, you have the option to creating a snapshot. Follow This link:
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSSnapshots.html
Do you need to backup your instance?
In a purist sense - No, always assume your EC2 could fail at any time, so don't put anything on there you don't have elsewhere (ie. source code, data, etc)
If you stopped your instance and the data is still there, it's likely it's mounted on an EBS, not ephemeral storage.
Do you need to backup your EBS?
Depends on your requirement. EBS is distributed over an AZ which gives you pretty good durability, so just think about what's on there and how bad it would be if you lost it
We are working with an EC2 instance in Amazon Web Services but we have lost our .pem.
In order to create a new one, we are following this guidance:
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html#replacing-lost-key-pair
However, we are a bit worried because of this warning:
When you stop an instance, the data on any instance store volumes is
erased. Therefore, if you have any data on instance store volumes that
you want to keep, be sure to back it up to persistent storage.
We cannot access the instance, therefore we cannot really make a proper backup. Instead, we have make a snapshot of the volumes in Elastic Block Store.
We are wondering if this is enough and we can indeed stop the instance to proceed to the pair key recover or we need to do something else in order not to lose any data.
It depends on the type of instance.
If it's EBS backed you are probably safe to proceed as the volume will be reattached.
If it's instance store backed and you lost access to it you basically have lost what's on that machine.
By the sounds of it it's EBS backed. If it's instance store backed and you later created and attached an EBS volume and used that, you're going to be able to restore/reattach that volume just fine - but it's going to be to another machine.
Depending on how many instances we are talking about you should also be able to take an AMI Image of the running instance which will take snapshot of the EBS but also the exact state of the instance.
However if the instance's root device type is using a EBS backed store all the data should be safe so saving a snapshot and relaunching a new instance with the snapshot should have the data.
Good luck.
I am trying to clean up some old AWS accounts to reduce costs, and need to get rid of unnecessary EBS volumes that are not attached to anything.
aws ec2 describe-volumes --volume-ids "blah" "blah"
does return a list of volumes, but doesn't provide info on which VM it might have been attached to.
Before I delete a whole bunch and we lose data that might be needed, I was wondering if there is a good approach to get that info?
Looked into cross referencing with Snapshot Id's and seeing what was there, but almost all have been deleted. Only one volume so far has tags that describe the old VM.
Is there a way to get instance root volume id in CloudFormation template? Instance was created from AMI image. I want to specify volume id for Cloudwatch Alarm. Fn::GetAtt function can't return it, after reading documentation a lot i found only one way to do it: "custom resource", but it's too complicated.
You should try creating the volume first (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ebs-volume.html) and then attaching it to /dev/sda1 (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ebs-volumeattachment.html).
Although the doc doesn't rule this out, I'm not completely confident it will work. I assume you will at least need the right snapshot ID from the desired AMI.
If it happens to work, the example under the second link shows how to then reference and get the volume id. And to suggest an alternative, I do believe instance metrics provide aggregate IO for ephemeral disks (see EC2 under http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/ec2-metricscollected.html).
I realize you're not asking for ideas in reengineering your stack... but depending on what this disk IO actually represents, you might realize additional benefits by switching to instance store (free and very fast) or additional EBS (many down-the-road benefits when e.g. mounted for data directories for databases). Both of these would also solve your immediate problem.