aws autoscaling describe-auto-scaling-instances \
| jq '.AutoScalingInstances[] | {AutoScalingGroupName, InstanceId}'
list instance IDs for a particular ASG
#!/bin/sh | |
# Enable/Disable LLDP on vSwitch ports on VMWare ESXi | |
# Tested with ESXi 6.0.0 3620759 | |
# Doesn't need vCenter, only SSH access to the ESXi machine | |
# (c) Pekka "raspi" Jarvinen 2016 http://raspi.fi/ | |
SWITCH=$1 | |
OPERATION=$2 | |
if [ "$SWITCH" = "" ] || [ "$OPERATION" = "" ]; then |
VSISH_VSWITCH_PATH=/net/portsets | |
for vSwitch in $(vsish -e ls ${VSISH_VSWITCH_PATH}); | |
do | |
VSWITCH=$(echo ${vSwitch} | sed 's/\///g') | |
for port in $(vsish -e ls ${VSISH_VSWITCH_PATH}/${vSwitch}ports); | |
do | |
PORT=$(echo ${port} | sed 's/\///g') | |
PORTINFO=$(vsish -e get ${VSISH_VSWITCH_PATH}/${vSwitch}ports/${port}status | sed 's/^[ \t]*//;s/[ \t]*$//'); | |
CLIENT=$(echo ${PORTINFO} | sed 's/ /\n/g' | grep "clientName:" | awk -F ":" '{print $2}') | |
MACADDRESS=$(echo ${PORTINFO} | sed 's/ /\n/g' | grep "unicastAddr:" | uniq | sed 's/unicastAddr://;s/\(.*\)./\1/') |
wget http://stedolan.github.io/jq/download/linux64/jq | |
aws ec2 describe-instances --filters "Name=tag:Name,Values=$NAME" \ | |
"Name=instance-state-name,Values=running" \ | |
| jq -r \ | |
".Reservations[] | .Instances[] | .InstanceId" \ | |
aws ec2 describe-volumes --filters \ | |
"Name=status,Values=available" \ | |
| jq -r ".Volumes[] | .VolumeId" \ |