Created
July 11, 2019 14:00
-
-
Save lbjay/c34785cbaf6df3c9ecdf3f3d9c1bde9c to your computer and use it in GitHub Desktop.
oc ssh andele andele
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
function oc-ips { | |
aws_profile=${1:-test} | |
cluster_name=$(sed -n 's/cluster=cluster_config-\([^\.]\+\)\.json/\1/p' .ocopsworks.rc) | |
aws --profile $aws_profile ec2 describe-instances \ | |
--output text \ | |
--filters "Name=tag:opsworks:stack,Values=$cluster_name" \ | |
--query "Reservations[].Instances[].[Tags[?Key=='opsworks:instance']|[0].Value,PublicIpAddress]" \ | |
> .oc-ips | |
} | |
function ssh_to { | |
hostname=$1 | |
ip=$(grep "^$hostname" .oc-ips | cut -f 2) | |
ssh -A -t $ip | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment