Can I delete the Terminalted Instance by AWS EC2? - amazon-ec2

I have created one AWS EC2 ubuntu instance to host my backend.
I mark it as Terminated.
Can I delete the Terminated Instance by AWS EC2?
Or the instance is stay in my dashboard.
Thank you in advanced.

Quick Answer: After terminattion, it will be deleted automatically after some time.
Terminating your instance is essentially deleting it, it will take
some time to get reflected on your dashboard (meaning it won't appear
on your instance list table)
There is no use of terminated instances.
Once you terminated your instances, it means you have completely lost
that particular instance.
But during the time of creation of your instance if have you had enabled the option called Protect against accidental termination. Then you will not be able to terminate without disabling this option.
But in your instance table if the Instance State column has the value terminated it means your instance is deleted and you can no longer use it.
Note By default, Amazon EC2 deletes the Amazon EBS root device volume at instance termination. Additional volumes that were attached when the instance launched and any volumes that were attached after instance launch persist. For more information, see Preserving Amazon EBS Volumes on Instance Termination in the Amazon EC2 User Guide for Linux Instances.

You really don't need to delete the instance.
From Documentation
After you terminate an instance, it remains visible in the console for a short while, and then the entry is automatically deleted. You cannot delete the terminated instance entry yourself.

Related

Storage from a terminated EC2 instance not getting automatically added to any existing instances

I had three EC2 instances of a total of 30GiB and ran out of space on the instance running Cloud9, so I terminated one to reclaim storage, however even after 10 hours, the storage from the terminated instance has not been added to either of the other two instances.
Shouldn't the storage reclaimed from the terminated instance be automatically added to either of the active instance?
The terminated is confirmed terminated, does not display on the EC2 instances' dashboard.
I explored the AWS Docs and realized:
The storage isn't added (aka attached) automatically!
If you have terminated your EC2 instance, like I had, then you need to create a new EC2 instance, then detach the storage from this newly created instance and attach it to your existing instance and then mount this to an existing mount point or to a new one.
Deep appreciation for the thorough, detailed and abundant official documentation of AWS.

How to replace an Amazon EC2 instance with a new one?

How to replace a Amazon EC2 instance with a new instance without removing tomcat7, mysql and other setting done on the instance?
Simple:
Stop the instance.
Detach the volume(s) - if you just have one volume (the boot volume) detach that.
Take a snapshot of the volume(s) for safekeeping (not strictly necessary in this case, but no-one ever got fired for taking backups of critical systems).
Terminate the instance.
Spin-up a new instance of the desired type (must be the same platform, i.e. x86 or x64, as the original).
Wait until it's running, then stop it.
Detach its' volume and delete it.
Attach your original volumes to it (the boot volume must be /dev/sda1).
Restart the new instance and re-assign Elastic IP if appropriate.

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

During hardware failure, do EBS-based EC2 instances terminate or stop?

Amazon's new EBS-based EC2 instances have two options to shutdown: terminate or stop. Stopped instances can be later started again, automatically continuing from the same EBS root disk state they had when they were stopped.
But what happens when an Amazon datacenter has a hardware failure, and the EC2 instance is forced to shutdown. Does it terminate or stop? If the instance has been configured to stop by default on shutdown, can I rely on it being stopped also in this situation, and being able to start it again later?
An EC2 instance can be terminated at any time and one must account for this indeed, as already mentioned in David's answer (+1). You can arrange for a failed instance's Elastic Block Store (EBS) to remain available regardless though, see e.g. the respective FAQ What happens to my data when a system terminates?:
The data stored on a local instance store will persist only as long as
that instance is alive. However, data that is stored on an Amazon EBS
volume will persist independently of the life of the instance. If you
are using an Amazon EBS volume as a root partition, then you have set
the Delete On Terminate flag to "N" for your Amazon EBS volume to
persist outside the life of the instance. [emphasis mine]
This is explained in more detail in section 2. Delete on Termination within Eric Hammond's recommended article Three Ways to Protect EC2 Instances from Accidental Termination and Loss of Data:
Though EBS volumes created and attached to an instance at
instantiation are preserved through a “stop”/”start” cycle, by default
they are destroyed and lost when an EC2 instance is terminated. This
behavior can be changed with a delete-on-termination boolean value
buried in the documentation for the --block-device-mapping option of
ec2-run-instances.
He is referring to the ec2-run-instances documentation, and all this is meanwhile illustrated in more detail within Amazon EC2 Root Device Storage Concepts as well:
By default, the root device volume and the other volumes created when
an Amazon EBS-backed instance is launched are automatically deleted
when the instance terminates [...]. You can change
the default behavior by setting the DeleteOnTermination flag to the
value you want when you launch the instance. For an example of how to
change the flag at launch time, see Using Amazon EC2 Root Device Storage.
I assume you mean the CPU related hardware fails, rather than the network disk. The way I treat EC2 is to create a system that can go up and down without data loss. Anything important you should use an S3 bucket, not EBS.

If i Stop an Amazon EC2 instance, is this saved?

If I stop an EC2 instance, rather than terminate, will this image be saved in my account and be available to be used at a later stage? ..as I noticed terminated instances eventually dissappear, would a stopped instance be available to boot up and start when ever?
Also regarding charging, I assume the cost for having a stopped instance would be charged per GB similar to a custom AMI?
Also another possibly simple question, if I shutdown a machine over SSH or via a script, does this initiate a termination or just a stop an instance (I assume it terminates the instance).
Thanks
If you terminate the EBS backed instance, it will remove it from the list of running instance, including it's allocated EBS volume. Unless you set the instance attribute not to delete the volume.
If you only stop, it will changed to stopped status and you can start it again later.
If you shutdown a machine, it default's to stop.
A good read to protect your instance see: http://alestic.com/2010/01/ec2-instance-locking
If you stop an instance based on EBS, then the instance will terminate automatically but you'll be charged for EBS storage until you delete the EBS.

Resources