Last active
August 30, 2018 15:32
-
-
Save chaspy/526b6fa1eec1c36bae59c3dbd5c46dc5 to your computer and use it in GitHub Desktop.
get ip-addr of instances in ASG(searched by peco)
This file contains 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
aws autoscaling describe-auto-scaling-groups |\ | |
jq -r '.AutoScalingGroups[].AutoScalingGroupName' |\ | |
peco |\ | |
xargs -I{} aws autoscaling describe-auto-scaling-groups --auto-scaling-group-names {} |\ | |
jq -r '.AutoScalingGroups[]|.Instances[]|select(.LifecycleState == "InService")|select(.HealthStatus == "Healthy")|.InstanceId' |\ | |
xargs aws ec2 describe-instances --instance-ids |\ | |
jq -r '.Reservations[].Instances[]|select(.State.Name == "running")|.PrivateIpAddress' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment