1
0
mirror of https://github.com/dcarrillo/prezto.git synced 2024-11-10 19:31:11 +00:00

[aws] Improve ssh_aws_any function

This commit is contained in:
Daniel Carrillo 2020-04-13 15:45:08 +02:00
parent f427a567d7
commit 2da4774473

View File

@ -112,7 +112,8 @@ function aws_ssm_session_any {
--filter "Name=tag:Name,Values=$1" "Name=instance-state-name,Values=running" \ --filter "Name=tag:Name,Values=$1" "Name=instance-state-name,Values=running" \
--query 'Reservations[0].Instances[0].InstanceId') --query 'Reservations[0].Instances[0].InstanceId')
if [[ $2 == "ssh" ]]; then if [[ $2 == "ssh" ]]; then
AWS_PROFILE=$profile ssh $id shift 2
AWS_PROFILE=$profile ssh $id $@
else else
aws ssm start-session --profile $profile --target $id aws ssm start-session --profile $profile --target $id
fi fi
@ -138,7 +139,10 @@ function aws_cf {
# ProxyCommand sh -c "aws ssm start-session --target %h --document-name AWS-StartSSHSession --parameters 'portNumber=%p'" # ProxyCommand sh -c "aws ssm start-session --target %h --document-name AWS-StartSSHSession --parameters 'portNumber=%p'"
# User <your_user> # User <your_user>
function ssh_aws_any { function ssh_aws_any {
aws_ssm_session_any $1 ssh host=$1
shift
extra_params=$@
aws_ssm_session_any $host ssh $extra_params
} }
function aws_switch_profile { function aws_switch_profile {