diff --git a/modules/aws/init.zsh b/modules/aws/init.zsh index 48822d1..18d589c 100644 --- a/modules/aws/init.zsh +++ b/modules/aws/init.zsh @@ -105,6 +105,18 @@ function aws_ssm_session_any { id=$(aws ec2 describe-instances --profile $profile --output text \ --filter "Name=tag-value,Values=$1" "Name=instance-state-name,Values=running" \ --query 'Reservations[0].Instances[0].InstanceId') - - aws ssm start-session --profile $profile --target $id + if [[ $2 == "ssh" ]]; then + AWS_PROFILE=$profile ssh $id + else + aws ssm start-session --profile $profile --target $id + fi +} + +# ~/.ssh/config +# +# Host i-* +# ProxyCommand sh -c "aws ssm start-session --target %h --document-name AWS-StartSSHSession --parameters 'portNumber=%p'" +# User +function ssh_aws_any { + aws_ssm_session_any $1 ssh }