How to access Windows Event Log in terminated Elastic Beanstalk instance - amazon-web-services

We have a ASP.NET MVC web application that is deployed to elastic beanstalk. There is an issue that is causing an instance to be identified as unhealthy and terminated. I suspect there's some information in the windows event logs that is going to help me diagnose the issue but once the instance is terminated, the logs are gone.
Any ideas how we could preserve the instance or the logs so that we can have a look at the windows event log?

Related

Can't request logs in elastic beanstalk

I want to request logs of my elastic beanstalk environment and I'm using the UI for it. However, upon requesting the logs, there's a loading period after which the logs don't show up. How can I fix this?

AWS Elastic beanstalk custom image IIS deployment failing

I have created a custom image in AWS elastic beanstalk and configured IIS and Management Services as well. but when using the said custom image to deploy an application. the instance spins up and i can see the IIS welcome page but the deployment never completes and the environment stays in pending (grey) state forever. Any help on how i can resolve this is much appreciated.

Spontaneous shutdowns in AWS EC2 instance

I have hosted a web server in an EC2 instance running Windows Server 2012 R2, and suddenly the instance became not available. I ran into the issue couple of times and when I checked the AWS Console, status of the instance has changed to Stop.
Interestingly when I checked for system logs in Event Viewer, I found this error message.
The process C:\Program Files\Amazon\XenTools\LiteAgent.exe
(EC2AMAZ-******) has initiated the shutdown of computer EC2AMAZ-******
on behalf of user NT AUTHORITY\SYSTEM for the following reason: No
title for this reason could be found Reason Code: 0x8000000c
Shutdown Type: shutdown Comment:
Any idea why it happened and what does LiteAgent.exe do?
This is Amazon's management service. This is the message you would get if someone shuts the machine down via the Web UI or if Amazon's infrastructure shut the machine down (for autoscaling etc).
If you need to know who's doing this you should consider enabling AWS Cloud Trail on the EC2 instances.

Elastic Beanstalk 502 errors during autoscaling

I have an Elastic Beanstalk app running on Docker set up with autoscaling. When another instance is added to my environment as a result of autoscaling, it will 502 while the instance goes through the deployment process. If I ssh into the relevant box, I can see (via docker ps) that docker is in the process of setting itself up.
How can I prevent my load balancer from directing traffic to the instance until after the instance deployment has actually completed? I found this potentially related question on SuperUser, but I think my health check URL is set-up properly -- I have it set-up to point at the root of the domain, which definitely 502s when I navigate to it in my browser, so I suspect that's not the cause of my problem.

Why isn't elastic beanstalk restarting my unresponsive instance?

I have a java spring application with a memory leak. I've actually resolved the cause of the memory leak (not properly closing jdbc connections), but I noticed that when my application became unresponsive, elastic beanstalk did not restart my instance and I had to do it manually. Why didn't it restart on its own?
As you can see, all of the requests are failing. From the aws docs
If a health check URL is configured, Elastic Load Balancing expects a GET request that it sends to return a response of 200 OK. The application fails the health check if it fails to respond within 5 seconds or if it responds with any other HTTP status code. After 5 consecutive health check failures, Elastic Load Balancing takes the instance out of service.
I assumed that "takes the instance out of service" means that it terminates the instance and replaces it with a new one. Is this not the case? What's going on here?