Created
June 15, 2025 08:47
-
-
Save dex4er/c01f40eb79c26101a96bf6767dd120a5 to your computer and use it in GitHub Desktop.
ssh ssm
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Host i-* mi-* | |
User root | |
ProxyCommand sh -c "instance=\$(echo %h | cut -d. -f1); profile=\$(echo %h | cut -d. -f2); profile=\${profile:-\$AWS_PROFILE}; region=\$(echo %h | cut -d. -f3); region=\${region:-\${AWS_REGION:-\$(aws configure get region --profile \${profile:-\$AWS_PROFILE})}}; aws ec2-instance-connect send-ssh-public-key --profile \${profile} --region \${region} --instance-id \${instance} --instance-os-user %r --ssh-public-key file://\${HOME}/.ssh/id_rsa.pub; aws ssm start-session --profile \${profile} --region \${region} --target \${instance} --document-name AWS-StartSSHSession --parameters 'portNumber=%p'" | |
ServerAliveInterval 60 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment