EC2 インスタンスでオフラインになっている SSM Agent のトラブルシューティング

“SSM Agent is not online”、“Connection Lost”、"Instance is not connected to Session Manager" というエラーや、マネージドインスタンスではない Amazon Elastic Compute Cloud (Amazon EC2) インスタンスを解決したいです。