De Wiki inetshell
Saltar a: navegación, buscar

Listar imagenes

https://stackoverflow.com/questions/54778825/where-would-i-get-a-listing-of-the-actual-compute-engine-image-names

gcloud compute images list

Instalar gcloud

https://inetshell.mx/instalar-gcloud-cloud-sdk/

Iniciar por SSH

https://inetshell.mx/ssh-y-redireccion-de-puertos-gcp/

Desactivar google startup-scripts al arranque

CentOS 7

systemctl disable google-startup-scripts.service
systemctl disable google-shutdown-scripts.service


Google Container Registry

Enable

https://stackoverflow.com/tags/gcloud/hot?filter=year

 gcloud services enable containerregistry.googleapis.com 

https://medium.com/google-cloud/google-container-registry-4aca1fc6cf74

https://cloud.google.com/sdk/gcloud/reference/container/images/delete

Google Cloud DNS

Exportar zona

https://cloud.google.com/sdk/gcloud/reference/dns/record-sets/export

gcloud dns record-sets export records.yaml --zone zone-name --project project-id

Importar zona

https://cloud.google.com/sdk/gcloud/reference/dns/record-sets/import

gcloud dns record-sets import records.yaml --zone zone-name --project project-id

Crear zona

1. on project, create dns zone:
gcloud beta dns --project=example-id managed-zones create example-com --description="hello world" --dns-name=zone.example-com

2. get NS records:
gcloud dns record-sets list --zone=example-com --name=zone.example-com. --type=NS --format="table[no-heading](rrdatas)"

3. add DNS records on hosting zone
gcloud dns --project=host-example-com record-sets transaction start --zone=example-com
gcloud dns --project=host-example-com record-sets transaction add ns-cloud-d1.googledomains.com. ns-cloud-d2.googledomains.com. ns-cloud-d3.googledomains.com. ns-cloud-d4.googledomains.com. --name=zone.example.com. --ttl=60 --type=NS --zone=example-com
gcloud dns --project=host-example-com record-sets transaction execute --zone=example-com

Storage

Generar Encryption Key SHA256

https://stackoverflow.com/questions/46518657/how-is-encryption-key-sha256-computed-on-google-cloud-storage/56581188#56581188

export encryption_key=yxCPz7MD1bLjcBJXiXAlu6obBAAn2leIebkTtnxtB+U=
echo "${encryption_key}" | base64 -d |  openssl dgst -binary -sha256 | base64

Generar llave CSEK

https://cloud.google.com/compute/docs/disks/customer-supplied-encryption

read -sp "String:" ; [[ ${#REPLY} == 32 ]] && echo "$(echo -n "$REPLY" | base64)" || (>&2 echo -e "\nERROR:Wrong Size"; false)

The following is an example of a base64 encoded key, generated with the string "Hello from Google Cloud Platform"

SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=