Using AWS Session Manager you can connect to your instances via Web Console instead of SSH. This is similar to what was always offered by Azure and Google Cloud.
Then Select Session Manager
If you see that its greyed out, you need to still configure it.
So instead go to ssm manager Quick Start
Now select get started on the left side, If you dont see get started in correct home region, it’s because you have set it up before.
Select Host Management , then next
Select Like in the following image, or suit your own needs, this keeps instances safe, Towards the bottom I selected Add required IAM policies, as well as “current account” for targets choose regions, I like to select all, and leave all instances selected., then click create. It might take a few minutes.
Selecting just the region you need now is much quicker than selecting all.
At the end of this you will now have an IAM role named AmazonSSMRoleForInstanceQuickSetup
Now when you select connect to Session Manager the Connect Button should now be Orange
Now you can run stuff, If using Amazon Linux , you will even have sudo access.