shell-whiz-toolkit/gcloud/get_public_ips.sh
2019-02-20 11:37:28 -08:00

8 lines
286 B
Bash
Executable file

#!/bin/bash
for x in $(gcloud projects list | tail -n +2 | awk '{ print $1}');
do
ip_list=$(gcloud compute instances list --project $x --format json)
gcloud compute instances list --project $x --format json | jq -r '.[] | .networkInterfaces[] | .accessConfigs[] | .natIP';
done