Created
January 29, 2015 06:06
-
-
Save maimai-swap/24cd61e5074bf1303e15 to your computer and use it in GitHub Desktop.
elasticbeanstalk elb autoscaling 使うときのシェルとかqueryがめんどくさいのでメモ
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
#!/bin/sh | |
asname=$1 | |
private_key_path="~/.ssh/your-private-key.pem" | |
instances=$(aws autoscaling describe-auto-scaling-instances --query "AutoScalingInstances[?AutoScalingGroupName==\`$asname\`][InstanceId]" --output text) | |
query_private_ip='Reservations[].[Instances[][NetworkInterfaces][][][PrivateIpAddresses][][][PrivateIpAddress]]' | |
dnslist=`aws ec2 describe-instances --instance-ids $instances --query "$query_private_ip" --output text` | |
for hostname in $dnslist | |
do | |
echo "ssh -i $private_key_path ec2-user@$hostname" | |
done | |
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
#!/bin/sh | |
asname=$1 | |
private_key_path="~/.ssh/your-private-key.pem" | |
instances=$(aws autoscaling describe-auto-scaling-instances --query "AutoScalingInstances[?AutoScalingGroupName==\`$asname\`][InstanceId]" --output text) | |
dnslist=`aws ec2 describe-instances --instance-ids $instances --query 'Reservations[][Instances[][PublicDnsName]]' --output text` | |
for hostname in $dnslist | |
do | |
echo "ssh -i $private_key_path ec2-user@$hostname" | |
done | |
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
#!/bin/sh | |
aws autoscaling describe-auto-scaling-groups --query 'AutoScalingGroups[][AutoScalingGroupName]' --output text | |
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
#!/bin/sh | |
aws elasticbeanstalk describe-environments --query Environments[][EnvironmentName] --output text | |
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
#!/bin/sh | |
envname=$1 | |
aws elasticbeanstalk describe-environment-resources --environment-name $envname | |
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
#!/bin/sh | |
private_key_path="~/.ssh/your-private-key.pem" | |
lbname=$1 | |
instances=`aws elb describe-load-balancers --load-balancer-names $lbname --query 'LoadBalancerDescriptions[][Instances[][InstanceId]]' --output text` | |
query_private_ip='Reservations[].[Instances[][NetworkInterfaces][][][PrivateIpAddresses][][][PrivateIpAddress]]' | |
dnslist=`aws ec2 describe-instances --instance-ids $instances --query "$query_private_ip" --output text` | |
for hostname in $dnslist | |
do | |
echo "ssh -i ~/.ssh/aws-lockad.pem ec2-user@$hostname" | |
done |
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
#!/bin/sh | |
lbname=$1 | |
private_key_path="~/.ssh/your-private-key.pem" | |
instances=`aws elb describe-load-balancers --load-balancer-names $lbname --query 'LoadBalancerDescriptions[][Instances[][InstanceId]]' --output text` | |
dnslist=`aws ec2 describe-instances --instance-ids $instances --query 'Reservations[][Instances[][PublicDnsName]]' --output text` | |
for hostname in $dnslist | |
do | |
echo "ssh -i $private_key_path ec2-user@$hostname" | |
done |
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
#!/bin/sh | |
aws elb describe-load-balancers --query 'LoadBalancerDescriptions[][LoadBalancerName]' --output text |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://wp.me/p2Tl24-52 ブログはこちら