GCP
How to interact with GCP
You can choose from the below options to interact with your GCP.
- Cloud Platform Console,
- Cloud Shell
- SDK
To access Google Cloud through the command line, and in order to do so, you do need to install the Google Cloud SDK if you want to run the commands from your laptop
- Cloud Console Mobile App
- Rest API
Download the Google Cloud CLI installer from below https://cloud.google.com/sdk/docs/install
- PowerShell command
(New-Object Net.WebClient).DownloadFile("https://dl.google.com/dl/cloudsdk/channels/rapid/GoogleCloudSDKInstaller.exe", "$env:Temp\GoogleCloudSDKInstaller.exe") & $env:Temp\GoogleCloudSDKInstaller.exe
How to log in through terminal
gcloud auth login
How to check Configuration details
gcloud config list
How to check Account details associated
gcloud auth list
How to check the project associated
gcloud projects list
How to set up the project
gcloud config set project admin-tform
Versioning
gsutil versioning get gs://<storage-bucket-name>
gsutil versioning set on gs://<storage-bucket-name>
How to copy files to the storage account
gsutil cp README-cloudshell.txt gs://s<storage-bucket-name>/
gsutil ls gs://<storage-bucket-name>/
gsutil ls -a gs://<storage-bucket-name>
gsutil rm gs://<storage-bucket-name>/README-cloudshell.txt
How to copy files from one storage account to another
gsutil cp gs://<storage-bucket-name>/** gs://<storage-bucket-name>/
how to change permission to public
gsutil acl ch -u AllUsers:R gs://<storage-bucket-name>/gcp-docs.png gsutil acl ch -u AllUsers:R gs://<storage-bucket-name>/gcp-docs.png Gsutils acl ch –u AllUsers:R
Azure
- Download the installer below
- https://aka.ms/installazurecliwindows
- Powershell
- Run as an administrator ISC
$ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest -Uri https://aka.ms/installazurecliwindows -OutFile .\AzureCLI.msi; Start-Process msiexec.exe -Wait -ArgumentList '/I AzureCLI.msi /quiet'; rm .\AzureCLI.msi
Azure Tenant
az login
az login --tenant
How to create Service Principle?
az ad sp create-for-rbac --role="Contributor" --scopes="/subscriptions/SUBSCRIPTION_ID"
az ad sp create-for-rbac --name "" --role contributor --scopes /subscriptions/
How to authenticate with the service Principle
az login --service-principal -u CLIENT_ID -p CLIENT_SECRET --tenant TENANT_ID
how to check subscriptions
az account show -o table
how to set Subscriptions
az account set -s sub_ib
How to find images in azure cloud
Linux
az vm image list --offer Debian --all --output table az vm image list --location westeurope --offer Deb --publisher credativ --sku 8 --all --output table az vm image list-publishers --location westus --output table az vm image list-offers --location westus --publisher Canonical --output table az vm image list-skus --location westus --publisher Canonical --offer UbuntuServer --output table az vm image list --location westus --publisher Canonical --offer UbuntuServer --sku 18.04-LTS --all --output table
Windows
az vm image list --offer WindowsServer --all -o table az vm image list --offer WindowsServer --publisher MicrosoftWindowsServer --all -o table az vm image list --offer WindowsServer --publisher MicrosoftWindowsServer --sku 2019-Datacenter --all -o table az vm image list –location westus --offer WindowsServer --publisher MicrosoftWindowsServer --sku 2019-Datacenter --all -o table
AWS
Download and run the AWS CLI MSI installer for Windows (64-bit): https://awscli.amazonaws.com/AWSCLIV2.msi
Very good write-up. I absolutely appreciate this site. Thanks!