Upgrade AWS ec2 ebs instance to a reserved instance - amazon-ec2

Just upgraded and have no idea how to migrate my existing m1.small instance to a reserved m3.medium instance.
I upgraded because my server was running slow. Would it be possible to give me a step by step on how to migrate my original instance over to the reserved one?
I'm using the ec2 dashboard. From what I've read I create a snapshot, but that's how far I've got. Thanks in advance

A Reserved Instance on Amazon EC2 is a means of reducing the hourly cost of using EC2. In exchange for an up-front payment, the hourly charge for EC2 is reduced.
A Reserved Instance has several components:
Instance type (the size of EC2 instance, consisting of an family, CPU count and RAM size)
Operating System (eg costs vary for Windows vs Linux)
Availability Zone (used to ensure that capacity has been allocated)
Each hour, the AWS billing system looks for any running instances in an account that owns Reserved Instances. If any of the running instances match the above three attributes, then the instance will receive the pricing discount. (Only one instance will receive a discount per Reserved Instance per 'running' hour.)
It is not possible to select a specific Amazon EC2 instance and designate it as a Reserved Instance. The billing system does this automatically. Thus, an instance could be discounted one hour and not another hour, depending upon what other instances are running. Think of it as a billing discount rather than a particular instance being "the" Reserved Instance.
Reserved Instances are also shared across AWS Accounts that are connected via consolidated billing. If there is no matching instance to receive a discount in the AWS Account that owns the Reserved Instance, the billing system will attempt to allocate it to a matching running instance in a linked AWS Account for that hour.
Therefore, to make use of your new m3.medium Reserved Instance via the AWS management console:
Stop your existing m1.small instance
From the Actions menu, select Instance Settings / Change Instance Type
Select m3.medium
Start your instance
Make sure that your instance matches the Instance Type, Availability Zone and Operating System listed in your Reserved Instance and you will automatically receive the billing discount. If multiple running EC2 instances match the profile of the Reserved Instance, only one will receive the discount.
There is no need to create an EBS snapshot or create a new instance. Simply changing the instance attributes to match the Reserved Instance is sufficient.
Note: The Reserved Instance itself will not provide any speed improvement. It is just a billing discount. It is your choice of a larger instance type will provide the benefit.
See also:
Reserved Instance documentation
Resizing your instance

Related

Unique and constant ID from Amazon EC2 instance

I'm looking for a unique ID associated with an Amazon EC2 instance. This ID must not change across reboots/poweroff-on/etc, and the ID must not be able to be duplicated (by cloning the instance) etc.
Can someone confirm if the instance id (i-XXXXXX) is such a number? If not, I suspect I could use the MAC address (if the instance has ENI option which makes MAC permanent).
Is there another number to use?
Your instance IDs are globally unique, for as long as you have access to the resource.
source: https://forums.aws.amazon.com/message.jspa?messageID=319825
By access, I mean so long as the instance is in your console / assigned to your account.
If you can't see the instance in your console, you can assume you no longer have access to that resource (and as such, can't expect you'll ever get another instance with the same ID).
If you see the instance in your console, regardless of state (other than terminated, which takes some minutes to be cleaned up from the console), the instance is "yours" and the unique ID will not change. This includes reboots.
If your instance needs to be "re-provisioned" or some other terminology in a notice from AWS, you can expect the instance will come up with a different unique ID. This sometimes happens if the underlying host that's servicing what you see as your "instance" needs maintenance work done that can not avoid a restart / tearing down of the instances that machine hosts, etc. Typically, this will not occur without ample notice from AWS.

Ensure the availability of a pool of stopped ec2 instances

I want to maintain a pool of stopped amazon ec2 instances. Whenever the amount is below the threshold, I would like to be able to create new instances and then immediately stop them once they are running. Is this possible within the amazon infrastructure alone?
You can certainly create Amazon EC2 instances and then Stop them, making the available to Start later. As you point out, this has the benefit that instances will Start faster than they take to Launch a new instance.
There is no automated method to assist with this. You could have to code a solution that does the following:
Monitor the number of Stopped instances
If the quantity is below the threshold, launch a new instance
The new instance could automatically stop itself via User Data (either via a Shutdown command to the Operating System, or via a StopInstances call to EC2)
Some things you would have to consider:
What triggers the monitoring? Would it be on a schedule?
The task that launches a new instance would need to wait for the new instance to Launch & Stop before launching any more instances
What Starts the instances when they are needed?
Do instances ever get Stopped when they are no longer required?
The much better choice would be to use Auto Scaling, with a scale-out alarm based on some metric that says your fleet is busy, and a scale-in alarm to remove instances when the fleet is not busy. The scale-out alarm could be set to launch instances once a threshold is passed (eg 80% CPU) that should allow the new instance(s) to launch before things are 100% busy. The time difference between launching a new instance and starting an existing instance is quite small (at least for Linux).
If you're using Windows, the biggest time delay when launching a new instance is due to Sysprep, which makes a "clean" machine with new Unique IDs. You could cheat by creating an AMI without Sysprep, which would boot faster.
Perhaps I am misunderstanding your objective... you can't "ensure availability" of instances without paying for them.
Instances in the stopped state are only logical entities that don't physically exist anywhere -- hardware is allocated on launch, deallocated on stop, reallocated on the next start. In the unlikely condition where an availability zone is exhausted of capacity for given instance class, stopped instances of that class won't start, because there is no hardware available for them to be deployed onto.
To ensure that instances are always available, you have to reserve them, and you have to specify the reservations in a specific availability zone:
Amazon EC2 Reserved Instances provide a significant discount (up to 75%) compared to On-Demand pricing and provide a capacity reservation when used in a specific Availability Zone. [emphasis added]
https://aws.amazon.com/ec2/pricing/reserved-instances/
Under most plans, reserved instances are billed the same rate whether they are running or not, so there would be little point in stopping them.

How can I perform autoscaling in amazon ec2 instance?

I would like to know how can I perform autoscaling in amazon ec2 instance. Do amazon support vertical autoscaling or not?
Is there any option of memory based or CPU based autoscaling?
Thanks in advance
I would lik eto know if it can increase the CPU or memory based on user defined threshhold on a single instance?
No, it does not. Not at-least at the time of writing this. They might add that feature in the offing.
In current situation, the only way to ad more CPU/MEM to an instance is to shut it down and then change instance type. This option is available in AWS Console and I am not sure of APIs.
While changing the instance type, you can choose a bigger type of instance which will eventually get you more CPU/MEM.
There is no way to add more CPU/MEM to a running instance at the moment. In fact, there is no way to add CPU/MEM to a current instance without changing its instance type.
Autscaling does not do this either.

AWS instance storage pricing and selection & Reserved Instance

Storage
Trying to launch an Ubuntu 13.10 Amazon AWS instance I’ve started with a General Purpose m1.medium instance with 1x410 GB instance storage. When I come to tab 4: Add Storage it says 8 GB on the root device and N/A on another device called Instance Store 0. However I can increase the root device to up to 1024 GB. I can also change the Instance Store 0 to an EBS and get 1024 GB there.
How am I able to select more space than I have available (410GB)? Am I charged for that? Where can I see how much of each of my instances are costing? If I set the root device to 410GB will I then be charged exactly as on the Amazon list?
Reserved Instance
I also have purchased a Reserved Instance. How can I verify that the EC2 instance I have just created is actually using my reserved instance?
Storage
You have two storage options with instances. EBS and Instance storage:
EBS is somewhat like an SAN volume. It exists outside of the instance and is accessed via dedicated ethernet (This is shared between instances based on IO priority). Volumes are billed based on the provisioned size. It does have some benefits over instance storage in that it can be easily snapshotted and moved from instance to instance. EBS limits are practical ones, while you can attach quite a few volumes (up to 1TB each) the available bandwidth will likely be saturated before you can take advantage of all of them.
Instance storage is a disk attached directly to the host hardware. Its included in the instance cost. But it should not be treated as persistent. You will loose any data stored on this volume if your instance is stopped or fails for any reason. This is because at each boot, your instance is assigned to available host in a pool instead of being locked to a specific host.
You can use both types of storage on any instance (Except micro, no instance storage available). Instance storage options however need to be set at launch and can't be changed later. EBS volumes can be added/removed at any time. In most cases, instance storage is disabled by default and needs to be explicitly enabled. Helps avoid the situation of "Why did all my data get deleted?"
Reserved Instance
Reservations are a billing feature. As long as your instance matches the parameters of the reservation you will be billed at the reservation rates. Should be able to verify this with account activity.

Stopping an Amazon EC2 Instance

If I stop an instance, I understand that I am not charged. However, I've installed several items on my machine in the last few hours (Mysql uploaded a db, Apache, PHP, etc...). I assume that when I stop the instance I retain these software installations, correct? Are these things stored in EBS? If so, where is the pricing listed for EBS, as I guess I will be charged every hour of every day for the whole year for my EBS storage given that it can never "stop"...
Thanks in advance.
From http://aws.amazon.com/ec2/pricing/, the current rates are:
$0.10 per GB-month of provisioned storage
$0.10 per 1 million I/O requests
Your data will persist if the root device is EBS backed, which is default now. You can check in the EC2 control panel.
So stopping the instance (if 8GB EBS) will cost about $0.80 per month for storage if it is never running.
If your instance is EBS backed all data is safe. You will be charged for EBS storage only. Amazon EBS storage charged on per-month basis. Currently it's $0.10 per GB-month.

Resources