I have been using session manager to connect to my django project on ec2 instance. Recently, I connected to the server using session manager. After making changes on settings.py, I ran the command sudo python3 manage.py runserver as usual so as to make sure there is no error found in my code. However, the check did not complete and pressing ctrl c did not terminate the process, so after several minutes I decided to reload the page. Immediately I reloaded the browser page I was blocked from assessing the server using session manager. When I try to connect, I getting the follow error:
We weren’t able to connect to your instance. Common reasons for this include:
1. SSM Agent isn't installed on the instance. You can install the agent on both Windows instances and Linux instances.
2. The required IAM instance profile isn't attached to the instance. You can attach a profile using AWS Systems Manager Quick Setup.
3. Session Manager setup is incomplete. For more information, see Session Manager Prerequisites.
I don't know why I was suddenly blocked from assessing the server and the error seems not to be helpful. Please how do I go about this? I activated the session manager when I started having issues connection with ssh. Now I lost assess to the server completely.
After some check I was able to fix the error. I noticed that the
status checksof the instance was 1/2. The System reachability check showedpassedbut Instance reachability checkfailed. What I did was to enable the instance termination protection (this appears to be the solution) and then reboot the instance.