• Skip to main content

Uly.me

cloud engineer

  • Home
  • About
  • Archives

gcloud

GCP Extend ext4 Boot Volume

July 28, 2022

Here’s how to extend an ext4 boot volume.

gcloud compute disks resize DISK_NAME --size DISK_SIZE --zone ZONE --project PROJECTID

gcloud compute disks resize DISK_NAME --size DISK_SIZE --zone ZONE --project PROJECTID

Resize the file system. Example / is on sda3.

growpart /dev/sda 3
resize2fs /dev/sda3

growpart /dev/sda 3 resize2fs /dev/sda3

Filed Under: Cloud, Linux Tagged With: boot, ext4, extend, gcloud, gcp, growpart, resize2fs, volume

GCP Project Quotas

March 8, 2022

Here’s how to get your project quotas in GCP.

gcloud compute project-info describe --project your-project-id

gcloud compute project-info describe --project your-project-id

Filed Under: Cloud Tagged With: gcloud, gcp, project, quotas

GCP Regional Quotas

March 8, 2022

Here’s how to get Regional Quotas for your project in GCP.

gcloud compute regions describe us-central1 --project your-project-id

gcloud compute regions describe us-central1 --project your-project-id

Filed Under: Cloud Tagged With: gcloud, gcp, project, quotas, regional

GCP Windows Password Reset

February 14, 2022

Instead of the GCP Console, you can reset Windows Server password via gcloud.

gcloud compute reset-windows-password server-name \
--zone us-central1-a \
--project project-id

gcloud compute reset-windows-password server-name \ --zone us-central1-a \ --project project-id

Username and password will generated.

Filed Under: Cloud Tagged With: gcloud, gcp, password, reset, windows

GCP Compute Startup Script

February 12, 2022

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'

Filed Under: Cloud Tagged With: compute, gcloud, metadata, script, startup

Set Terminal Browser to Firefox

February 7, 2022

Every time I log in to Google Cloud, it’s using the Chromium.

Set BROWSER env to Firefox instead.

export BROWSER=/usr/bin/firefox

export BROWSER=/usr/bin/firefox

Login to GCP. It should open up Firefox browser instead of Chromium.

gcloud auth login

gcloud auth login

Add it your .bashrc or .bashprofile if you want it to be permanent.

Filed Under: Cloud Tagged With: auth, browser, chromium, firefox, gcloud, login, terminal

GCP gcloud compute scp

January 31, 2022

Here’s how to download/upload files using gcloud compute scp.

Make sure you are authenticated.

gcloud auth login

gcloud auth login

How to download.

gcloud compute scp --recurse your-server:/home/username/yaml.tar.gz . \
--project your-project-id \
--zone us-central1-a \
--internal-ip

gcloud compute scp --recurse your-server:/home/username/yaml.tar.gz . \ --project your-project-id \ --zone us-central1-a \ --internal-ip

How to upload.

gcloud compute scp --recurse yaml.tar.gz your-server:/home/username/ \
--project your-project-id \
--zone us-central1-a \
--internal-ip

gcloud compute scp --recurse yaml.tar.gz your-server:/home/username/ \ --project your-project-id \ --zone us-central1-a \ --internal-ip

Filed Under: Cloud Tagged With: compute, download, files, gcloud, scp, upload

GCP list firewall rule by name

November 10, 2021

Here’s how to list a GCP firewall rule by name.

gcloud compute firewall-rules list \
--filter="name=('wowza-rtmp')" \
--format=json

gcloud compute firewall-rules list \ --filter="name=('wowza-rtmp')" \ --format=json

You can use different formats. Supported formats are:

config, csv, default, diff, disable, flattened, get, json, list, multi, none, object, table, text, value, yaml

Filed Under: Cloud Tagged With: firewall, gcloud, gcp, list, name

  • Go to page 1
  • Go to page 2
  • Go to page 3
  • Go to page 4
  • Go to Next Page »
  • Home
  • About
  • Archives

Copyright © 2023