Need backup of terminated AWS instances - amazon-web-services

I accidentally terminated one aws instance. is there any way to get backup of AWS terminated instance?. I couldn't find the volume attached with instance

No. If the Amazon EBS disk volume is no longer visible in your console, then it is gone and cannot be recovered.
When launching an Amazon EC2 instance, you can specify a Delete on Termination flag that indicates whether to delete the EBS volume(s) when the instance is terminated. If you wish to keep the disks after instances are terminated, make sure you do not have this option selected.

Related

Launching AWS spot instance with an old EBS volume

I do not now much about spot instances but I'm wondering whether I have to create a new EBS volume with every instance or is it possible to start an instance with a previously launched EBS volume ?
Amazon provides an option to do the same.
Delete on termination false spot instances

An unknown AWS EC2 instance running which recreates even after termination

I am running amazon AWS ECS container which creates one single instance of EC2. I made sure that it is 1 instance when I created ECS.
My issue is that I have another instance running in EC2 and amazon has sent me an email that I am using double of the free quota and will be charged.
But I am not sure why this second EC2 instance is coming from.
I have terminated it many times but it is recreated. When I terminate it, this is the prompt i receive which advises me that it is created from EBS but there is no app in EBS
On an EBS-backed instance, the default action is for the root EBS volume to be deleted when the instance is terminated.
Storage on any local drives will be lost.
This name of the instance is.
ECS Instance - amazon-ecs-cli-setup-ecs-cricketscorer
Please help.
check if you have any Auto Scaling Groups that you do not recognize. It is most probably being created because of it. If not, change your account password and deactivate/delete your existing AccessKeys.

Are the ebs volumes used by the instances launched by an autoscaling group deleted when the instances are replaced/terminated?

I have an auto-scaling group with 2 instances.
Every time an instance is launched an EBS volume is attached to it. When it is replaced/terminated is the EBS volume deleted ?
I want to keep a tight budget on my account and I dont want to have volumes lingering and pay for them.
You can configure it both ways. If you are using the web interface to configure the launch configuration when you get to Storage you will see this:
You just need to check the "Delete on Termination" checkbox on the right, whenever an instance is terminated the EBS volume associated will be deleted as well.

Is it possible to modify an existing AMI to change delete on termination settings on the EBS volumes?

I have several AMIs that developers use to spin up instances. These AMI do not have "delete on termination" set on all their EBS volumes. At times terminating instances launched using these AMIs has the unintended consequence of leaving behind orphan EBS volumes. Unfortunately, "blessing" a new AMI for general use is quite an ordeal. Is it possible to edit an existing AMI to turn on "delete on termination" or is the only way forward to create a new AMI with the proper settings?
It is not possible to modify the "Delete on termination" value on an existing AMI.
So you have 2 choices:
Launch an EC2 instance from your AMI and produce a new AMI with the appropriate "Delete on Terminate" value, or
Modify the value when you launch the new EC2 instance.
Once the instance is running you can call modifyAttribute (modify-instance-attribute in the CLI) on the attribute blockDeviceMapping.
aws ec2 modify-instance-attribute --instance-id i-a3ef245 --block-device-mappings "[{\"DeviceName\": \"/dev/sda\",\"Ebs\":{\"DeleteOnTermination\":false}}]"
You can see an example here: http://www.petewilcock.com/how-to-modify-deletion-on-termination-flag-for-ebs-volume-on-running-ec2-instance/
There is no such features.
In addition, I think you misundestand the purpose of AWS web console EC2 EBS Volumes vs snapshot.
When you launch an instances, a EBS Volume is assign to the instance(if it is a EBS base instance like t2., c3.) , once you terminate it, that assoicated volume will be deleted.
Unless you create a EBS volumes that attach to a instances, that is another story. An attached volumes will stay even the instance it attached to is deleted, this is intended design as EBS volumes is network storage anyway, it should allow you to detach/attach to different instances dynamically.
On the other hand, your user may create snapshot(s) for their instances, which store under the Snapshot portion. This is part that will stay, even you terminate the original instance. Once you deleted the original instance, the volume it point do will be "orphaned".
It is a good practice to create a snapshot for instance as backup, but it will go wilds if you don't have a standard policy to handle it. No automation can help a process nature issues.
You MUST enforce a policy and standard for your developer to follow as well, e.g. backup cycle, tag for snapshot, etc.

How to delete instance in EC2?

How can I delete instance in Amazon EC2. I have terminated the instance but still it was showing in instance list table. I want to know few things related to this
1: Is there any significant difference b/w Delete and Terminate?
2: what is the use of terminated instance?
3: what are the cases at which instance gets terminated?
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 if, during the time of creation of your instance, 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.
The only thing you can do is terminating an instance. It stops everything.
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.
More info here http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/terminating-instances.html
Shuts down one or more instances. This operation is idempotent; if you terminate an instance more than once, each call succeeds.
Terminated instances remain visible after termination (approximately one hour).
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.