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
--Athena Query | |
SELECT extract(hour | |
FROM cast(pickup_datetime AS timestamp)) AS Hour, ROUND(AVG(cast(trip_distance AS double) / date_diff('second', cast(pickup_datetime AS timestamp), cast(dropoff_datetime AS timestamp))) * 3600,1) | |
FROM taxinyc | |
WHERE cast(dropoff_datetime AS timestamp) > cast(pickup_datetime AS timestamp) | |
AND cast(fare_amount AS double)/cast(trip_distance AS double) | |
BETWEEN 2 | |
AND 10 | |
AND cast(trip_distance AS double) > 0 |
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
#Get the list of the server names behind the instanstce group using gcloud compute and grep the initial words of the instance group and output to a file. | |
gcloud compute instance-groups managed list-instances prod-app-utoo-grp --zone asia-east1-a | grep -o "prod-app-utoo[^ ]*" > servername | |
#Get the IP addresses for the above server names and output to a file. Clean up the IP list file which may already be there from previous deployments | |
cat /dev/null > iplist | |
for app in `cat servername` | |
do | |
gcloud compute instances describe $app --zone asia-east1-a | grep 'natIP' | cut -f2 -d : >> iplist |