Why EC2 new instance is created when I try to terminate it? - amazon-web-services

Good morning,
I had a free tier EC2 instance, now I want to stop it and delete it. The problem is that when I am trying to terminate running EC2 Instance, then AWS terminates it but it creates new one (same as terminated). How can I fully terminate and delete AWS EC2 instance?
As you can see it should delete on termination:

The "Delete on Termination" flag is for the volume attached to the instance which indicates whether you want to keep the storage after terminating your ec2-instance.
The only way I think of here is where the ec2-server is attached to auto-scaling group with min =1, you need to check the auto-scaling group and decrease the min to : 0

Related

AWS autoscaling detached instance terminated

No Code here.
I am building solution based on EC2 using AutoScaling.
I have created the solution where instance will get detached from AutoScaling group before they are stopped and they will be added back to AutoScaling group when in use.
Now what if the instance that I have deteched from AutoScaling has terminated, now I am left with nothing to attach to AutoScaling ( that particular instance id does not exist anymore).
How to handle this , if instance has terminated then at time of attachment AutoScaling should know that Instance does not exist anymore and create a new instance.
From here i am planning to create a event bridge which will take Instance-Id of new instance and update it SSM.
I think you might want to use standby instead of detaching/attaching. Any time you have an instance exit standby, the desired will get incremented by 1. No healthchecks are happening on the instance while its in standby, so if the instance got terminated while in standby the ASG wouldn't know about it until you remove the instance from standby.
Since the desired has already been increased at that point, a new instance would be launched to replace the old one as part of a healthcheck replacement

Terminating AWS EC2 instance fails - the instance is still running

it seems that I have a technical issue regarding terminating the EC2 instance.
When I terminate it, a new instance is being created with the same name.
I terminate an EC2 instance. After a refresh, another instance was running so I started to terminate it.
After one another refresh of the page, a new instance started to run.
Do you maybe have any tips regarding this?
This instance seems to be a part of the autoscaling group which is continuously trying to meet the minimum capacity requirements. Delete that Autoscaling group first and then stop the instance or update Min capacity in autoscaling group to 0 it will be automatically terminated.

Need backup of terminated AWS instances

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.

AWS - EC2 stop instances not working properly

I'm very new on AWS and now I have two EC2 instances. In order to avoid waste the free tier plan I'm trying to stop instances when I'm not working with them.
This is what my EC2 Management console shows. As you can see there are two instances running and two instances terminated. I did not terminate swipe-dev, I have just stop it. But for any reason now is terminated plus new same instance with same source code was started. Why?
What I'm doing wrong? I just want stop instances.
Edit
I have decide keep just one project so I terminate eb-flask-demo-dev and stop swipe-dev instance. After few minutes instace state was stoped and I thought finally everything is fine. But I rejoin to EC2 console and this is what it shows.
Why swipe-dev is running again? and Why there is another terminated instance?
This is possible if your instance is a member of an Autoscaling group with desired capacity = 1 and set minimum size to 0. To maintain the number of healthy instances, Auto Scaling performs a periodic health check on running instances within an Auto Scaling group. When it finds that an instance is unhealthy (in this case because you stopped it), it terminates that instance and launches a new one.

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.