Attach EBS volume to this AWS ec2 instance? - amazon-ec2

I’m running a website on an m3.2xlarge AWS ec2 instance which is EBS backed.
I want to change the instance type to m2.2xlarge instance.
This new instance already has instance storage of 850 gb hdd.
My question is: can I attach the existing EBS drive to the new m2.2xlarge instance? and boot to the website?

There are 2 possibilities
1
stop your running Instance, Detach the volume (or take a snapshot of it)
Now while launching the new Instance you can add additional volume along with your Root volume (of new Instance). Just keep in mind you cannot delete or exclude the Root volume of new Instance while Launching, its just that you can add an extra volume along with the root volume
2
Stop your running Instance
Go to actions and then Select Insatnce Setting and then click on Change Instance Type
Select your desired Type of Instance
after changing the Type of instance, you can restart the Instance

Your existing EBS will remain attached after resizing. You will not get to see instance store which comes with m2.2xlarge. This won't get add up to resized instance. This is based on the documentation here:
When you resize an instance, the resized instance usually has the same
number of instance store volumes that you specified when you launched
the original instance. If you want to add instance store volumes, you
must migrate your application to a new instance with the instance type
and instance store volumes that you need

Related

Will An EC2 Snapshot backup An Instance That Does Not Have A Volume?

I create an instance but do not add additional storage / a volume, will a snapshot backup the instance and the changes I have made to the config or does it only backup data from the volumes?
I am making some training material and would like to do the following:
Create an instance
Create users
Make a few more config/program installation changes
At this point, I would have a "clean copy".
I then would like to take a Snapshot of the state of the instance.
fool around, possibly break stuff
Then restore the instance to the "clean copy" after the instance has been created but before I started messing around.
Is this possible with snapshots?
Let's clarify some terminology:
A Snapshot can be made of an Amazon EBS volume. This makes a backup of the specific disk volume. The snapshot can be used later to create a new EBS Volume.
Or, you can create an Amazon Machine Image (AMI) of an Amazon EC2 instance. This creates an EBS Snapshot of all associated volumes and also stores some metadata about the AMI.
You can then Launch a new Amazon EC2 instance from the AMI. This will include a copy of the disks.
If you wish to restore the instance to the "clean copy", then it is best to launch a new instance from the AMI rather than trying to 'reset' the instance to an earlier state. The instance will have a different Instance ID and a different IP address, but will otherwise be the same as the instance from which the AMI was created.

EC2 m1.Medium instance type states the Instance Storage to be 410GB

When I launch the instance, it automatically comes with a 30GB "C: Drive" and some "Ephemeral" drives.
My question is
"...where is the expected 410GB hard drive?"
I noticed you can change the default 30GB to be some other size.
Is this where one can increase to up to 410GB?
Instance storage is not enabled by default:
Instances that use Amazon EBS for the root device do not, by default,
have instance store available at boot time. Also, you can't attach
instance store volumes after you've launched an instance. Therefore,
if you want your Amazon EBS-backed instance to use instance store
volumes, you must specify them using a block device mapping when you
create your AMI or launch your instance.
You will find this quote and more info about how to enable it in the AWS-EC2 User Guide. See the section "Making Instance Stores Available on Your Instances".

Are files saved on EBS volume? Are they not supposed to be saved? I'm confused

So I create an instance using one of the Public AMI EBS Ubuntu flavors. I create an EBS volume and attach it to the instance. I format the volume and add an entry to /etc/fstab to mount it on /vol. I add mysql to the AMI and move the data files to the EBS volume I formatted and mounted at /vol. I then create an AMI from the running instance. Then I terminate the running instance.
I start a new instance using the freshly created AMI (with mysql on it). The /vol is mounted has the mysql data files - good, I expect that. Here's where I am confused. When I create any directory or files on the EBS volume /vol they aren't there any more after I terminate the instance and create a new one. The mysql stuff is there but no new stuff I created. Aren't those files and directory supposed to be there? Or am I misunderstanding how this works?
When you create an AMI, "Amazon EC2 powers down the instance, takes images of any volumes that were attached, creates and registers the AMI, and then reboots the instance." -Amazon. When the AMI is used to launch an instance, the images (snapshots) of the attached drives are used to create new volumes. It is these new volumes that are attached to the new instance, not your original EBS. (This generates lots of orphan volumes and snapshots with ongoing use.)
There is no automatic attaching of the EBS volume you created. What is automatically attached is the volume it creates at the time of launching the instance from your AMI! It creates this volume from the snapshot it made of your EBS at the time of the AMI creation!
The way to avoid clone volumes from being created and attached to new instances is simple: detach your volumes before making AMIs. You need to attach your EBS volumes manually with the EC2 Web Control Panel, or programmatically with .net or Java programming, scripting or command line tools.
EBS volumes are not tied to an AMI, only to the literal instance you attach them to. When you created your AMI and a new instance from that, the EBS is not cloned, nor does it follow you to the new instance.
You could move the EBS drive to the new instance manually. Alternately you could snapshot the EBS volume & clone a new drive from that.

Mount amazon instance store to another instance - it is possible? how?

Due to system crash after update i set up new instance with ebs(old instance has an instance store). But i need to copy some data form old instance to new. It`s possible to mount instance store from old instance to new? How to do this?
Have you come across this thread: Mounting Old EBS Volume to the new Instance - Amazon EC2
I'm not sure if that's what you're looking for, but the answer on that thread details the process of mounting the old EBS volume to the new one on an Amazon EC2 instance.

amazon ec2, is mount information stored in ami or snapshot?

I have ec2 instance set up where mysql DB is mounted on separate volume.
(as detailed in http://aws.amazon.com/articles/1663 )
I want to duplicate this instance set up where my application servers on duplicated instances share the DB volume which is attached to the already running ec2 instance.(I can specify mysql ip through configuration file)
Since almost every set up except the mysql ip is identical, i'd like to create an ami from the first instance and slightly modify to create 2nd,3rd instances.
The question is, the mount information stored in the first instance will take effect when I launch the 2nd instance.
I can elaborate the question,
1. I read that a volume can not be attached to more than one ec2 instance at the same time.
2. the running instance attaches/mount an volume to itself on start up.(so it seems)
3. if I were to create an ami from first instance and use that to initiate other instances, how would auto attach/mount information(which I assume, will be stored in the ami) will affect the other instances.
Eugene,
Mounting the same device to several servers is not possible, so you better forget about this option.
The best solution is to:
Create a copy of your master instance.
Detach the created mount volume. We are going to create an image from this new instance, and you don't want the useless drive copy to be re-created every time.
Change the settings that you need to change, in order to make this server rely on the remote (master) mysql server.
Once you are satisfied with the outcome, create an image from this instance.
Good luck!
Dotan

Resources