Launch Instance with smaller root volume storage - amazon-web-services

I want to launch an instance with custom size of root volume on Amazon EC2.
At step no.4 - Add Storage, the root volume default setting came with a default snapshot and a default 10 size (GiB). Then I lowered the size into 5GiB.
But at the final step, it wouldn't allow me to launch the instance because of only 5GB root volume.
Any idea or solution that I can lower the size when launching an instance?

You cannot create an Amazon EBS volume that is smaller than the snapshot that you want loaded.
You could attempt to make your own AMI by launching with 10GB, attaching a 5GB volume, copying files across, turning it into an AMI, etc but frankly it isn't worth the bother.
If you are merely wishing to save money, then at 10¢ per GB per month, it would only save 50¢ per month.

Related

Why AMI creation is taking long time?

I am trying to create a AMI from an instance with a root device of 160GB in size. This root volume is of type io1 with an iops of 1250.
In my AWs account, creating an AMI takes about 5 minutes. This is with data about more than 100GB.
On the customer's AWS account, the same configuration takes over 20+ minutes.
I have tested this with many repetitions and I get almost similar results all time.
Any idea why the AMI creation varies so much between multiple AWS accounts?
An AMI consists of snapshots of Amazon EBS volumes attached to the instance.
Snapshots consist of "differences" from the previous snapshot (including the original AMI that was used to launch the instance).
For example, if you were to launch a new instance from an AMI and then immediately create a new AMI from the instance, very little data would have changed on the disk volume. Thus, the AMI and its underlying snapshot would be very quick to create.
If, over time, a lot of information was added/modified on the disk volume(s), then creating an AMI will take longer because more disk blocks have changed.
Creating Snapshots and AMIs can be made faster by taking more frequent snapshots, since this will copy modified blocks to Amazon S3. Thus, each successive snapshot/AMI will require fewer blocks to be copied.
The speed of a snapshot/AMI is not impacted by the assigned IOPS to a volume. The snapshot process takes place in the back-end, which does not consume the IOPS allocated to a volume.

How to reduce root EBS volume size of an EC2 instance?

I got my website running on an EC2 instance with 1 EBS of 50 GB attached as root volume. My requirement is to reduce the size of this EBS volume to 20 GB from currently 50 GB. I tried lot of ways like creating an image and launching a new instance with EBS volume as 20GB but in the end launch fails with message saying that volume size can only be increased from current size (i.e. 50GB) and cannot be reduced.
May I know if there is any workaround to handle this issue. I have data in root volume but I do not require whole bunch of 50GB space on my root volume. Please assist.
Thank you,
You would need to create a new volume and copy everything across, making sure that the volume remains bootable.
Then: Stop instance, detach volume, attach new volume, boot.
At 10c/GB/month, the reduction of 30GB will save you $3/month. It isn't worth your time.

AWS change EBS root volume on data collection system

I have the following use case:
I have an EC2 instance running with an 1000GB io1 SSD EBS root volume attached
It is used for a data collection service which accumulates data every minute
I like to change the volume for a cheaper storage system (as the specs of the process are not IOPS intensive)
I've read through the AWS documentation and found the following articles:
https://aws.amazon.com/about-aws/whats-new/2017/02/amazon-elastic-block-store-amazon-ebs-enables-live-volume-modifications-with-elastic-volumes/
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-expand-volume.html#console-modify
Which indicate that (from february 2017) for Current Generation Instances a volume type change is possible on the fly in the console without stopping the instance. However, when I go to my console I can only choose between io1 (current) or gp2 (also SSD), I'd like to choose sc1 (cold storage) for this instance. The video clearly shows this option (go from io1 to sc1).
Am I missing something? Is there a restriction to go from SSD to HDD?
(im in Asia Sydney region).
Alternatively, if the option is not possible and i have the requirement that data collection continues, it seems that my only option is:
re-create a similar instance with the data collection scripts deployed with an EBS sc1 volume as root attached
get the data collection running (now collecting double)
stop the old instance and take a snapshot of the io1 EBS volume
create a EBS sc1 volume with the snapshot
attach the EBS sc1 volume to the new instance (as additional volume, not root)
Would this be the right way to do so? (if I can't change the volume type to sc1 while it's running)
tldr;
The 2 main reasons why amazon will not propose sc1/st1 type when editing the EBS volumes are:
the current volume is used as root device of the ec2 instance
the current storage is less than 500 Gb
I guess the volume you want to change is used as root device of the instance; in this case you cannot have boot volume of magnetic type st1 or sc1.
Note also the sc1 volume must be at least 500 Gb
You can read more about EBS Volume Types
Unfortunately, you cannot change the root device of a running instance, you can do that while the instance is stopped.
so you can follow your steps proposed but you can make the change of the EBS after it will be detached from the first ec2 instance
re-create a similar instance with the data collection scripts deployed with an EBS sc1 volume as root attached (You cannot have sc1/st1 drive as boot volume; if you want magnetic storage you need to select standard Magnetic storage; but ideally you should have a low volume ssd drive as boot volume and the large magnetic drive as additional ebs volume)
get the data collection running (now collecting double)
stop the old instance and detach the EBS volume
make the modification of the EBS volume (type/storage)
attach the EBS sc1 volume to the new instance (as additional volume, not root)

How to preserve data when stopping EC2 instance

I created a m3.large EC2 instance for data processing, I modified it to a 40GB root drive and it comes with a 3OGB additional drive. I only need to use it for a few days a month so the idea was to stop it when not in use and start it when required.
When I stopped it I was warned that
Emphermal storage data would be lost
on restarting this turned out to be a way of cryptically saying that everything on the 30Gb volume would be wiped which it has been, whereas the root volume that uses the 4OGB is untouched.
So why does it do this and if I hadn't increased the size of my root volume would all my changes on that be lost as well ?
There 2 types of Volumes ( Disk ) provided by AWS
EBS Volumes
Ephemeral ( Instance Store )
EBS Volumes :
Your root volume is always EBS volume ( you can safely assume this point; almost all of the AMIs EBS based these days). The data in EBS volume would persist even if the instance is stopped or terminated; with this you can quickly remove the EBS volumes from one instance and reattached it to other.
Ephemeral ( Instance Store ) :
Ephemeral volumes are the temporary drives provided for the instance, the size ( 10 GB or 80 GB ), the count ( 2 disks or 5 disks ) the type ( Magnetic or SSD ) depends with each instance size.
The data in these drive would be wiped off during the event of instance stop and start. You may use this disk for non critical application activities like temporary file storage and processing, application log. If you need persistence of the content in this drive then you would need to move it to EBS based volumes or store it in S3 from time to time to prevent data loss.
There wont be any loss of data when you increase the size of the volume of an EBS Volume; you need take the snapshot of the volume and restore it again back to a volume of your required size ( increased size ). I have tried this couple of times; I haven't encountered any data loss during the process; but if you little concerned about this, you can upload the content to S3 for backup.

how to clone an Amazon EBS volume into another one of smaller size

I have two amazon ec2 instances, (1) using SLES and running my current site, and (2) a new one using Amazon Linux. I am simply trying to move my site from the SLES and then retire it.
I have a 100GB EBS volume attached to the SLES server of which only about 20GB is actually used. What's the best way to bring the data over to the new instance?
create a new EBS volume of about 30GB and attach to new instance, use unix cp?
create a new EBS volume of about 30GB and attach to new instance, temporarily also attach the 100GB original volume the new instance, use unix cp?
something smarter/simpler, such as create a snapshot(?) of the 100GB EBS volume, somehow? create a new 30GB EBS volume out of it, and then attach that to the new instance? The extra benefit will be that I won't have to take down my site
Thanks a lot
It is easy to increase the size of a target volume, but the only way you're going to be able to make it smaller is to create a blank volume of the size you want. Then, either mount the new one to the old instance and do a copy or detach the old volume and reattach it to the new and do a copy. Basically, of the options you listed, only the first and second ones would work. The reason making a snapshot won't work is because creating a snapshot from a volume makes the snapshot the same size as the volume it was created from. You would get an error trying to create a volume from snapshot that is smaller than the original.