Amazon AWS EC2 instance relaunches when terminated - amazon-web-services

I have an instance that I have never actually launched myself that tends to start each time once I terminate it. This is annoying, as I would need to pay for it and customer service does not reply. Had anyone got a similar question before?

With the aid of help of the Amazon Support the problem was resolved. It appears that is you have an instance constantly appearing after being terminated and you have no active Autoscale groups, you should cancel it via the new Spot console (beta, the one you access via "Try it out" button), as most likely it is the fleet instance. I'll leave it here in case it is helpful to the others having the same issue.

Related

Logging solution for aws spot instances

Is there any solution or way, which can help me to get live/real-time logs?
I have 100s of Spot instances that come and go frequently, So we need to configure a setup that captures the logs despite this spot life cycle, which means whenever new spot instance launches we will get the respective instance to log immediately.
please help/suggested the way.

What causes an EC2 instance to stop?

I suddenly started having issues connecting to my EC2 instance, and in the AWS console, I noticed the instance status was stopped.
I am not very familiar with AWS EC2, but if I understand correctly, EC2 instances don't stop on their own, so I must have triggered it somehow. How could this happen? Could it have errored out somehow, or did someone have to explicitly stop it?
AWS doesn't take any action by own; there might a possibility you have triggered it by mistake. Since you can start it again also you can set one cloudwatch alarm to get more notification about the running Instance.
At the same time, you can create one topic for SNS and subscribe to it via email. so that if anything happens with your instance it will notify you or you can set the action for all the available events

EC2 spawning from nowhere, no autoscaling group found

I'm having an issue with AWS boxes (EC2) where I terminate the box and it re-spawns. To give context, there is no autoscaling group. Anywhere I can search for some config that might be triggering the launch?
I would make sure you don't have a persistent spot request active in your account, and also check to see if you perhaps installed the AWS Instance scheduler - either or both of those could be starting instances on your behalf - (double check the autoscaling group, that is the most obvious reason though)
If you terminate a running Spot Instance that was launched by a
persistent Spot request, the Spot request returns to the open state so
that a new Spot Instance can be launched. To cancel a persistent Spot
request and terminate its Spot Instances, you must cancel the Spot
request first and then terminate the Spot Instances. Otherwise, the
persistent Spot request can launch a new instance.
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-requests.html#terminating-a-spot-instance
https://aws.amazon.com/solutions/instance-scheduler/
So I found out the culprit, maybe it can help more people. Apparently, there is a service from AWS called OpsWorks that automates things like Cheff of Puppet, which my company had configured some time ago. That would be checking for instances running and triggering re-provisioning when it didn't see the instance running. OpsWorks is here

monitor ec2 instances lifecycle

Hi I am new to AWS and I started learning now. In my environment I noticed all the issues are getting raised by autoscaling only. Whenever new instances comes up there are some small issues happening in environment. So I thought if we have a script to trigger a alert whenever any ec2 instance get reboots or terminates or any new instance spins up but I do not have a idea how to achieve it.
While checking with AWS support they are pointing cloudwatch where we need to trigger alarm for each instance. When we have huge number of instances and multiple environments, setting up a alarm for individual instance is hectic job. Can anyone suggest how can I get information about a instance reboot, termination and new instance spin up. Thanks in advance.
You can create SNS notification whenever auto scaling scales.
Read AWS documentation
You can write your script in your favourite language which can subscribe to the particular SNS topic.

Amazon EC2 spot instance request creates itself

I created a spot instance request with my custom AMI (based on Amazon Linux AMI, EBS backed.) When my request was fulfilled, I have another spot instance request created by itself with amzn-ami-pv-2015.09.0.x86_64-ebs (ami-50978202) as AMI with the same bid pricing as the one I created. I didn't really pay attention at the time and since my bid was low ($0.005 per hour) and I only used it for a couple of hours, so I didn't pay attention to it that much.
When I terminated the instance and cancel the request (both the one I created and the one that creates itself,) a new spot instance request with ami-50978202 keeps creating itself no matter how many times I keep canceling it and terminate the instance that was fulfilled. I thought it was because I still have the custom AMI on my account so I tried copying the AMI to another region, but the spot instance creating itself doesn't happen in that region, so I'm quite lost with what's happening here. Any help would be appreciated.
I had the same issue, cancelling the spot instance would just have it recreate.
At the time of speaking though (2011-12-11) there's an option within EC2 -> Spot Requests which looks like a blue speech bubble. Click on that and use the new version.
From there I've been able to cancel the spot request. I just lodged a support ticket asking for a refund for time not used.
This isn't going to solve your problem but I can confirm that I'm having the exact same issue and I haven't been able to get Amazon to fix the problem all week. It started when I used their new spot instance request system on November 7th. I'm assuming that the system has a bug in it that causes the spot request (not just the instance) to recreate itself. I haven't had problems like this before when creating a spot request. Amazon also thought that I was using an Auto scaling group but I've never set that up either.
The problem is now, trying to get Amazon to respond to this problem. I've opened multiple tickets. They have only responded one time in a week. At least they gave me a $12 refund for the time used by the spot instances so far. :-(
If you didn't create an ASG (as Zoran mentioned) you probably created a persistent spot request:
If the request is a persistent request, the request is opened again after your Spot instance is terminated.
Simply cancel the open spot request if you don't want it.
I confirm the answer of #Naypam is the correct one.
I had exactly the same behaviour than #user1274757, #Naypam and #deltaray:
created a persistent spot request.
upon cancelation of the "Spot request" from the AWS Web Console by selecting the spot request and pressing the "Cancel" Button:
The Spot request is cancelled,
a fews minutes later, a new Spot Request is automatically recreated with a new "Request ID" and a new creation timestamp.
This is most probably a bug on the AWS Console.
The work around is the following:
On the Web AWS Console, select "Instance > Spot Request"
Select the "New Spot Request Console" by clicking the blue bubble on the top-right toolbar and clicking on the "try it out" link that appears.
Select the spot request
Selection Actions > Cancel Spot Request.
The Spot Request is then really cancelled.
I Have open a case with Amazon and i invite you to do the same.