Can't access AWS EC2 instance after storage expansion - amazon-web-services

My EC2 instance had 8GB max storage but it was not enough so I decided to expand it to 15GBs (i am using the free tier). I waited process to finish but I lost whatever Access i had to the instance. Connection times out.
I waited several hours more but no change. Accessibility checks are ok and when I choose instance snapshot i see that it stays on the login screen.

I couldn't fix my issues - I tried restarting the instance multiple times, I checked the network settings everything was ok there. I changed volumes of the instance and I noticed that the volume maybe was corrupted because the same instance with different volume the SSH was working fine. I ended up setting up a new instance.

Related

Google Compute Engine: can't start VM, GCE is not ready

After an account verification and payment method update, my VM can't start.
After my account has been unblocked, I went to my projects, had to activate billing (which I don't get why coz my vms were working before).
One of my project went smooth, vm restarted etc.
On the other one, waited 1h and tried again, got the same error as above..
I can create a new vm IF, and only if, I use a non default VPC. (don't understand why)
So I detached my vm's disk and tried to create a new vm with the old disk attached and a custom VPC, with no chance. The disk seems linked to a default VPC.
Any idea on what can be done?

Cannot start or move a VM Instance

I am fairly new to Google Cloud platform and cloud computing as a whole. I had af1-micro (1 vCPU, 0.6 GB memory) type of instance running. GCP gave me a warning that the instance was overutilized and I should change it to g1-small (1 vCPU, 1.7 GB memory) type of instance. When I went to upgrade, it began to restart my instance but gave me the error
Starting VM instance '<instance name>' failed. Error: The zone 'projects/<project id>/zones/asia-south1-a' does not have enough resources available to fulfill the request. Try a different zone, or try again later.
I have waited for some time (more than 12 hours) to start it again and getting the same error. I edited the instance manually and changed it to g1-small (1 vCPU, 1.7 GB memory) but still getting the same error.
I tried moving the instance to a different zone in same region using move instances in google cloud SDK Shell, but got an error and found out that instances in terminated state cannot be moved.
I just need to get my instance up and running, so please help here.
Did some further investigation. Indeed the resource shortage is still ongoing in the region. However changing the machine type to E2-micro/small then starting the instance should work for you.
I faced the same issue and I am still facing it. What I ended up doing is I switched to asia-south1-c.
Finally was able to create a snapshot of a terminated instance from the web console and then create a new VM using that snapshot in a different region. Then deleted the old VM and snapshot.

How can I debug an AWS EC2 instance randomly becoming unreachable

We have an EC2 instance which becomes unreachable randomly. It has only started recently, and seems to only happen outside of business hours.
We are finding that the instance websites, WHM, SSH, even a terminal ping is all unreachable. However, the instance is running and health checks are fine in AWS console.
We used to have this with another instance but that just randomly stopped doing it at some point.
I have checked the CPU usage and the last 2 weeks, it has hit 100% 4 times but the times when that happened, are not when the instance goes down and I'm not sure they're even related.
The instance has WHM/cPanel installed, has not reached disk usage limit, nor bandwidth usage limit. We have cPHulk Brute Force Protection installed and running so surely can't be brute force attack?
It is resolved by stopping, then starting the instance, but we have clients viewing links and with the server going down outside of business hours and clients in different timezones.
I recommend you try installing a CloudWatch Agent to the EC2 instance in order to get the metrics and be able to analyze them further.
https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Install-CloudWatch-Agent.html

Will my web app be deleted if I stop my EC2 instance?

According to the AWS documentation "any data stored in the RAM of the host computer or the instance store volumes of the host computer is gone." Does this mean that the web application I installed on my EC2 instance will be deleted if I stop running my instance?
I apologize for the naive question. I am new to this and worried I might make a mistake.
An Amazon EC2 instance is just like a normal computer. If you turn it off, anything in RAM is lost. Also, if you reboot either computer, the contents of RAM is lost (well, more like 'forgotten', but effectively the same).
Just like your home computer, if you reboot or stop/start an EC2 instance, it boots up again. Whatever software you have installed on the computer is still there. However, applications you were running will only start if you have configured a startup script to run the app again.
Typically, when software such as a web server is installed on a computer, it is configured to automatically start again when the computer is turned on/rebooted in future.
Elastic Block Store (EBS) disk volumes act just like a disk in a normal computer. If an EC2 instance is stopped and later started again, the contents of the disk is still there, unchanged.
Bottom line: It's just like a home computer. Don't panic.
Adding to John's answer, as long as you do not use an Instance Store volume, to store your web application, you are good to go.
The data in an instance store persists only during the lifetime of its
associated instance. If an instance reboots (intentionally or
unintentionally), data in the instance store persists. However, data
in the instance store is lost under the following circumstances:
The underlying disk drive fails
The instance stops
The instance terminates
If however you are using an EBS volume, these conditions do not apply and you are free to start and stop your instance any number of times you want.
Yes unless you have EBS volume attached to EC2. If you are using an EBS-backed instance, you can stop and restart that instance without affecting the data stored in the attached volume

AWS EC2 instance becomes inaccessible via SSH after

Issue : after a given period of time (usually the time it takes for the initial status checks to complete) I can no longer access my EC2 instance via SSH. More specifically during the initial period, I have normal access to my instance via SSH, then it drops, and the machine becomes completely unreachable, even when trying to ping it.
I have double checked Security Group, VPC settings etc. but don't think that can be the issue as at one point in time I can access the machine.
The issue occurs on "vanilla" instances from very basic standard AMIs as well as with AMIs I run on other AWS accounts. I have tried various instance types / sizes, but the issue occurs again and again.
Any ideas welcome! Thanks in advance
Dan
There are many things that can cause this. Specifically, if you're supplying user data during startup it could encounter an issue and eliminate your ability to SSH if it is modifying the file system and mounts or changing permissions.
If you can save the underlying system volume you can remount it and check /var/log/boot.log and /var/log/cloud-init-output.log