Gcloud: Difference between revisions

From Fundamental Ramen
Jump to navigation Jump to search
No edit summary
 
(14 intermediate revisions by the same user not shown)
Line 5: Line 5:
*# Check VPC firewall rules
*# Check VPC firewall rules
* Set default region
* Set default region
* SSH <syntaxhighlight lang="sh">gcloud</syntaxhighlight>
* SSH <syntaxhighlight lang="sh">gcloud compute ssh <vm-instance-name></syntaxhighlight>
 
= Config default SSH Key =
 
A new key pair will be generated, using existed key is not recommended.
 
'''The existed private key would be overwritten.'''
 
bash
 
<syntaxhighlight lang="sh">
# Setup
gcloud compute config-ssh \
  --ssh-config-file=~/.ssh/config.09-xxx/config \
  --ssh-key-file=~/.ssh/config.09-xxx/private_key.pem
 
# Remove
gcloud compute config-ssh \
  --ssh-config-file=~/.ssh/config.09-xxx/config \
  --remove
</syntaxhighlight>
 
Power Shell
 
<syntaxhighlight lang="powershell">
# Setup
gcloud compute config-ssh `
  --ssh-config-file=~/.ssh/config.09-xxx/config `
  --ssh-key-file=~/.ssh/config.09-xxx/private_key.pem
 
# Remove
gcloud compute config-ssh `
  --ssh-config-file=~/.ssh/config.09-xxx/config `
  --remove
</syntaxhighlight>
 
= Install Docker =
 
The docker package is not in apt by default. Ask claude first is good.

Latest revision as of 02:32, 13 November 2025

SSH Login

  • Check Firewall
    1. Navigator VPC Network -> Firewall
    2. Check VPC firewall rules
  • Set default region
  • SSH
    gcloud compute ssh <vm-instance-name>
    

Config default SSH Key

A new key pair will be generated, using existed key is not recommended.

The existed private key would be overwritten.

bash

# Setup
gcloud compute config-ssh \
  --ssh-config-file=~/.ssh/config.09-xxx/config \
  --ssh-key-file=~/.ssh/config.09-xxx/private_key.pem

# Remove
gcloud compute config-ssh \
  --ssh-config-file=~/.ssh/config.09-xxx/config \
  --remove

Power Shell

# Setup
gcloud compute config-ssh `
  --ssh-config-file=~/.ssh/config.09-xxx/config `
  --ssh-key-file=~/.ssh/config.09-xxx/private_key.pem

# Remove
gcloud compute config-ssh `
  --ssh-config-file=~/.ssh/config.09-xxx/config `
  --remove

Install Docker

The docker package is not in apt by default. Ask claude first is good.