I’m having trouble logging in using Google SDK Compute SSH on a Mac Terminal.
Here’s the fix.
gcloud compute ssh USERNAME@SERVER --zone ZONE --project PROJECTID --internal-ip 2>&1 |
There was an issue with a redirect to another shell.
cloud engineer
I’m having trouble logging in using Google SDK Compute SSH on a Mac Terminal.
Here’s the fix.
gcloud compute ssh USERNAME@SERVER --zone ZONE --project PROJECTID --internal-ip 2>&1 |
gcloud compute ssh USERNAME@SERVER --zone ZONE --project PROJECTID --internal-ip 2>&1
There was an issue with a redirect to another shell.
How to add startup and shutdown scripts on GCP Compute Engine.
Startup Script
gcloud compute instances add-metadata servername \ --project project-id \ --zone us-central1-c \ --metadata=startup-script='#! /bin/bash sudo -i echo "Time: $(date)" >> /tmp/date.txt' |
gcloud compute instances add-metadata servername \ --project project-id \ --zone us-central1-c \ --metadata=startup-script='#! /bin/bash sudo -i echo "Time: $(date)" >> /tmp/date.txt'
Shutdown Script
gcloud compute instances add-metadata servername \ --project project-id \ --zone us-central1-c \ --metadata=shutdown-script='#! /bin/bash # Shuts down Apache server /etc/init.d/apache2 stop' |
gcloud compute instances add-metadata servername \ --project project-id \ --zone us-central1-c \ --metadata=shutdown-script='#! /bin/bash # Shuts down Apache server /etc/init.d/apache2 stop'
How to reset password of a GCP Compute Engine running on Windows OS.
gcloud compute reset-windows-password servername \ --zone us-central1-a \ --project your-project-id |
gcloud compute reset-windows-password servername \ --zone us-central1-a \ --project your-project-id
Output
This command creates an account and sets an initial password for the user [firstname_lastname] if the account does not already exist. If the account already exists, resetting the password can cause the LOSS OF ENCRYPTED DATA secured with the current password, including files and stored passwords. For more information, see: https://cloud.google.com/compute/docs/operating-systems/windows#reset Would you like to set or reset the password for [firstname_lastname] (Y/n)? y Resetting and retrieving password for [firstname_lastname] on [servername] Updated [https://www.googleapis.com/compute/v1/projects/your-project-id/zones/us-central1-a/instances/servername]. WARNING: Instance [servername] does not appear to have an external IP address, so it will not be able to accept external connections. To add an external IP address to the instance, use gcloud compute instances add-access-config. password: xxxxxxxxxxxxxxx username: firstname_lastname |
This command creates an account and sets an initial password for the user [firstname_lastname] if the account does not already exist. If the account already exists, resetting the password can cause the LOSS OF ENCRYPTED DATA secured with the current password, including files and stored passwords. For more information, see: https://cloud.google.com/compute/docs/operating-systems/windows#reset Would you like to set or reset the password for [firstname_lastname] (Y/n)? y Resetting and retrieving password for [firstname_lastname] on [servername] Updated [https://www.googleapis.com/compute/v1/projects/your-project-id/zones/us-central1-a/instances/servername]. WARNING: Instance [servername] does not appear to have an external IP address, so it will not be able to accept external connections. To add an external IP address to the instance, use gcloud compute instances add-access-config. password: xxxxxxxxxxxxxxx username: firstname_lastname