Fri, 10 Feb 2023 14:08:37 +0000

Those that use SSM to access EC2 instances may find this zsh function useful.

myssm() {
ID=$(aws ec2 describe-instances --query "Reservations[*].Instances[*].{InstanceID:InstanceId,Name:Tags[?Key=='Name']|[0].Value,PrivateIP:PrivateIpAddress,Status:State.Name}" --filters Name=instance-state-name,Values=running --output text | fzf-tmux -p -w 75% |awk '{printf $1}')
aws ssm start-session --target $ID
}