Skip to content

Instantly share code, notes, and snippets.

@Kouni
Last active May 26, 2022 00:54
Show Gist options
  • Save Kouni/01f0e383ae16be49b1f2377e2c84abd4 to your computer and use it in GitHub Desktop.
Save Kouni/01f0e383ae16be49b1f2377e2c84abd4 to your computer and use it in GitHub Desktop.
$HOME/.ssh/
Include config.d/fa/fa.conf
HashKnownHosts yes
StrictHostKeyChecking no
# UserKnownHostsFile /dev/null
TCPKeepAlive yes
ServerAliveInterval 120
ServerAliveCountMax 5
Compression yes
ControlMaster auto
ForwardAgent yes
# LogLevel ERROR
# Template
# Host short_hostname
# HostName $HOSTNAME
# Port $PORT
# User $USERNAME
# Password $PASSWORD
# IdentityFile $SSH_KEY_PATH
# ProxyJump $PROXYHOST
# Bastion
Host mb-alpha
User ec2-user
HostName 3.3.3.3
IdentityFile ~/.ssh/config.d/fa/privatekey/alpha.pem
# Production
Host host1 host2
User ec2-user
ProxyCommand ssh mb-alpha nc `aws ec2 describe-instances --region us-east-1 --filters Name=tag:Name,Values=%h Name=instance-state-code,Values=16 --output text | grep PRIVATEIPADDRESSES | awk '{print $4}' | tail -1` 22
IdentityFile ~/.ssh/config.d/fa/privatekey/prod.pem
Host i-*
User ec2-user
ProxyCommand ssh mb-alpha nc `aws ec2 describe-instances --region us-east-1 --filters Name=instance-id,Values=%h Name=instance-state-code,Values=16 --output text | grep PRIVATEIPADDRESSES | awk '{print $4}' | tail -1` 22
IdentityFile ~/.ssh/config.d/fa/privatekey/prod.pem
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment