Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.90 KB | None | 0 0
  1. function oc-ips {
  2. aws_profile=${1:-test}
  3. cluster_name=$(sed -n 's/cluster=cluster_config-\([^\.]\+\)\.json/\1/p' .ocopsworks.rc)
  4. aws --profile $aws_profile ec2 describe-instances \
  5. --output text \
  6. --filters "Name=tag:opsworks:stack,Values=$cluster_name" \
  7. --query "Reservations[].Instances[].[Tags[?Key=='opsworks:instance']|[0].Value,PublicIpAddress]" \
  8. > .oc-ips
  9. }
  10.  
  11. function ssh_to {
  12. hostname=$1
  13. ip=$(grep "^$hostname" .oc-ips | cut -f 2)
  14. ssh -A -t $ip
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement