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.
- Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.
- In the left navigation pane, choose Instances, and select the instance.
- Choose Actions, Instance Settings, Get 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.
- get-console-output (AWS CLI)
- Get-EC2ConsoleOutput (AWS Tools for Windows PowerShell)
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.
- Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.
- In the left navigation pane, choose Instances.
- Select the instance to capture.
- Choose Actions, Instance Settings.
- 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.
- get-console-screenshot (AWS CLI)
- GetConsoleScreenshot (Amazon EC2 Query API)
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.
- Back up any important data on your instance store volumes to Amazon EBS or Amazon S3.
- Stop the instance.
- Start the instance.
- Restore any important data.
- [EC2-Classic] If the instance had an associated Elastic IP address, you must reassociate it with the instance.
- Create an AMI from the instance.
- Upload the image to Amazon S3.
- Back up important data to Amazon EBS or Amazon S3.
- Terminate the instance.
- Launch a new instance from the AMI.
- Restore any important data to the new instance.
- [EC2-Classic] If the original instance had an associated Elastic IP address, you must associate it with the new instance.
No comments:
Post a Comment