SSH over Session Manager 

vi ~/.ssh/config
Copy the below command to your ssh config file.
host i-* mi-*
ProxyCommand sh -c "aws ssm start-session --target %h --document-name AWS-StartSSHSession --parameters 'portNumber=%p'"
View ssh.config file to confirm the changes:
cat ~/.ssh/config
Connect to your EC2 instance:
ssh <instance-id>