Thursday, December 15, 2016

Getting Console Output and Rebooting Instances



Getting Console Output and Rebooting Instances
Console output is a valuable tool for problem diagnosis. It is especially useful for troubleshooting kernel problems and service configuration issues that could cause an instance to terminate or become unreachable before its SSH daemon can be started.
Similarly, the ability to reboot instances that are otherwise unreachable is valuable for both troubleshooting and general instance management.
EC2 instances do not have a physical monitor through which you can view their console output. They also lack physical controls that allow you to power up, reboot, or shut them down. Instead, you perform these tasks through the Amazon EC2 API and the command line interface (CLI).
Instance Reboot
Just as you can reset a computer by pressing the reset button, you can reset EC2 instances using the Amazon EC2 console, CLI, or API. For more information, see Reboot Your Instance.
Caution
For Windows instances, this operation performs a hard reboot that might result in data corruption.
Instance Console Output
For Linux/Unix instances, the instance console output displays the exact console output that would normally be displayed on a physical monitor attached to a computer. This output is buffered because the instance produces it and then posts it to a store where the instance's owner can retrieve it.
For Windows instances, the instance console output displays the last three system event log errors.
The posted output is not continuously updated; only when it is likely to be of the most value. This includes shortly after instance boot, after reboot, and when the instance terminates.
Note
Only the most recent 64 KB of posted output is stored, which is available for at least 1 hour after the last posting.
Only the instance owner can access the console output. You can retrieve the console output for your instances using the console or the command line.
To get console output using the console
  1. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.
  2. In the left navigation pane, choose Instances, and select the instance.
  3. Choose ActionsInstance SettingsGet System Log.
To get console output using the command line
You can use one of the following commands. For more information about these command line interfaces, see Accessing Amazon EC2.
For more information about common system log errors, see Troubleshooting System Log Errors for Linux-Based Instances.
Capture a Screenshot of an Unreachable Instance
If you are unable to reach your instance via SSH or RDP, you can capture a screenshot of your instance and view it as an image. This provides visibility as to the status of the instance, and allows for quicker troubleshooting.
There is no data transfer cost for this screenshot. The image is generated in JPG format, no larger than 100kb.
To access the instance console
  1. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.
  2. In the left navigation pane, choose Instances.
  3. Select the instance to capture.
  4. Choose ActionsInstance Settings.
  5. Choose Get Instance Screenshot.
Right-click on the image to download and save it.
To capture a screenshot using the command line
You can use one of the following commands. The returned content is base64-encoded. For more information about these command line interfaces, see Accessing Amazon EC2.
Instance Recovery When a Host Computer Fails
If there is an unrecoverable issue with the hardware of an underlying host computer, AWS may schedule an instance stop event. You'll be notified of such an event ahead of time by email.
To recover an Amazon EBS-backed instance running on a host computer that failed
  1. Back up any important data on your instance store volumes to Amazon EBS or Amazon S3.
  2. Stop the instance.
  3. Start the instance.
  4. Restore any important data.
  5. [EC2-Classic] If the instance had an associated Elastic IP address, you must reassociate it with the instance.
For more information, see Stop and Start Your Instance.
To recover an instance store-backed instance running on a host computer that failed
  1. Create an AMI from the instance.
  2. Upload the image to Amazon S3.
  3. Back up important data to Amazon EBS or Amazon S3.
  4. Terminate the instance.
  5. Launch a new instance from the AMI.
  6. Restore any important data to the new instance.
  7. [EC2-Classic] If the original instance had an associated Elastic IP address, you must associate it with the new instance.
For more information, see Creating an Instance Store-Backed Linux AMI.

No comments:

Post a Comment