Gcloud Init


ketan_patel@cloudshell:~ (new-user-learning)$ gcloud init

Welcome! This command will take you through the configuration of gcloud.

Settings from your current configuration [cloudshell-27741] are:
accessibility:
  screen_reader: 'True'
component_manager:
  disable_update_check: 'True'
compute:
  gce_metadata_read_timeout_sec: '30'
core:
  account: ketan.patel@supernal.aero
  disable_usage_reporting: 'True'
  project: new-user-learning
metrics:
  environment: devshell

Pick configuration to use:
 [1] Re-initialize this configuration [cloudshell-27741] with new settings 
 [2] Create a new configuration
Please enter your numeric choice:  1

Your current configuration has been set to: [cloudshell-27741]

You can skip diagnostics next time by using the following flag:
  gcloud init --skip-diagnostics

Network diagnostic detects and fixes local network connection issues.
Checking network connection...done.                                                                                                                                                           
Reachability Check passed.
Network diagnostic passed (1/1 checks passed).

Choose the account you would like to use to perform operations for this configuration:
 [1] ketan.patel@supernal.aero
 [2] Log in with a new account
Please enter your numeric choice:  1

You are logged in as: [ketan.patel@supernal.aero].

Pick cloud project to use: 
 [1] dosmic350
 [2] d-dev
 [3] dv
 [4] new-user-learning

 [11] Enter a project ID
 [12] Create a new project
Please enter numeric choice or text value (must exactly match list item):  4

Your current project has been set to: [new-user-learning].

Do you want to configure a default Compute Region and Zone? (Y/n)?  Y

Which Google Compute Engine zone would you like to use as project default?
If you do not specify a zone via a command line flag while working with Compute Engine resources, the default is assumed.
 [1] us-east1-b
 [11] us-west1-b
 [12] us-west1-c
 [13] us-west1-a
 [50] asia-northeast3-a

Did not print [66] options.
Too many options [116]. Enter "list" at prompt to print choices fully.
Please enter numeric choice or text value (must exactly match list item):  13

Your project default Compute Engine zone has been set to [us-west1-a].
You can change it by running [gcloud config set compute/zone NAME].

Your project default Compute Engine region has been set to [us-west1].
You can change it by running [gcloud config set compute/region NAME].

Your Google Cloud SDK is configured and ready to use!

* Commands that require authentication will use ketan.patel@supernal.aero by default
* Commands will reference project `new-user-learning` by default
* Compute Engine commands will use region `us-west1` by default
* Compute Engine commands will use zone `us-west1-a` by default

Run `gcloud help config` to learn how to change individual settings

This gcloud configuration is called [cloudshell-27741]. You can create additional configurations if you work with multiple accounts and/or projects.
Run `gcloud topic configurations` to learn more.

Some things to try next:

* Run `gcloud --help` to see the Cloud Platform services you can interact with. And run `gcloud help COMMAND` to get help on any gcloud command.
* Run `gcloud topic --help` to learn about advanced features of the SDK like arg files and output formatting
* Run `gcloud cheat-sheet` to see a roster of go-to `gcloud` commands.

ketan_patel@cloudshell:~ (new-user-learning)gcloud cheat-sheet



NAME
    gcloud cheat-sheet - display gcloud cheat sheet

SYNOPSIS
    gcloud cheat-sheet [GCLOUD_WIDE_FLAG ...]

DESCRIPTION
    A roster of go-to gcloud commands for the gcloud tool, Google Cloud's
    primary command-line tool.

  Getting started
    Get going with the gcloud command-line tool

      o gcloud init: Initialize, authorize, and configure the gcloud tool.
      o gcloud version: Display version and installed components.
      o gcloud components install: Install specific components.
      o gcloud components update: Update your Google Cloud CLI to the latest
        version.
      o gcloud config set project: Set a default Google Cloud project to work
        on.
      o gcloud info: Display current gcloud tool environment details.

  Help
    Google Cloud CLI is happy to help

      o gcloud help: Search the gcloud tool reference documents for specific
        terms.
      o gcloud feedback: Provide feedback for the Google Cloud CLI team.
      o gcloud topic: Supplementary help material for non-command topics like
        accessibility, filtering, and formatting.

  Personalization
    Make the Google Cloud CLI your own; personalize your configuration with
    properties

      o gcloud config set: Define a property (like compute/zone) for the
        current configuration.
      o gcloud config get: Fetch value of a Google Cloud CLI property.
      o gcloud config list: Display all the properties for the current
        configuration.
      o gcloud config configurations create: Create a new named
        configuration.
      o gcloud config configurations list: Display a list of all available
        configurations.
      o gcloud config configurations activate: Switch to an existing named
        configuration.

  Credentials
    Grant and revoke authorization to Google Cloud CLI

      o gcloud auth login: Authorize Google Cloud access for the gcloud tool
        with Google user credentials and set current account as active.
      o gcloud auth activate-service-account: Like gcloud auth login but with
        service account credentials.
      o gcloud auth list: List all credentialed accounts.
      o gcloud auth print-access-token: Display the current account's access
        token.
      o gcloud auth revoke: Remove access credentials for an account.

  Projects
    Manage project access policies

      o gcloud projects describe: Display metadata for a project (including
        its ID).
      o gcloud projects add-iam-policy-binding: Add an IAM policy binding to
        a specified project.

  Identity & Access Management
    Configuring Cloud Identity & Access Management (IAM) preferences and
    service accounts

      o gcloud iam list-grantable-roles: List IAM grantable roles for a
        resource.
      o gcloud iam roles create: Create a custom role for a project or org.
      o gcloud iam service-accounts create: Create a service account for a
        project.
      o gcloud iam service-accounts add-iam-policy-binding: Add an IAM policy
        binding to a service account.
      o gcloud iam service-accounts set-iam-policy: Replace existing IAM
        policy binding.
      o gcloud iam service-accounts keys list: List a service account's keys.

  Docker & Google Kubernetes Engine (GKE)
    Manage containerized applications on Kubernetes

      o gcloud auth configure-docker: Register the gcloud tool as a Docker
        credential helper.
      o gcloud container clusters create: Create a cluster to run GKE
        containers.
      o gcloud container clusters list: List clusters for running GKE
        containers.
      o gcloud container clusters get-credentials: Update kubeconfig to get
        kubectl to use a GKE cluster.
      o gcloud container images list-tags: List tag and digest metadata for a
        container image.

  Virtual Machines & Compute Engine
    Create, run, and manage VMs on Google infrastructure

      o gcloud compute zones list: List Compute Engine zones.
      o gcloud compute instances describe: Display a VM instance's details.
      o gcloud compute instances list: List all VM instances in a project.
      o gcloud compute disks snapshot: Create snapshot of persistent disks.
      o gcloud compute snapshots describe: Display a snapshot's details.
      o gcloud compute snapshots delete: Delete a snapshot.
      o gcloud compute ssh: Connect to a VM instance by using SSH.

  Serverless & App Engine
    Build highly scalable applications on a fully managed serverless platform

      o gcloud app deploy: Deploy your app's code and configuration to the
        App Engine server.
      o gcloud app versions list: List all versions of all services deployed
        to the App Engine server.
      o gcloud app browse: Open the current app in a web browser.
      o gcloud app create: Create an App Engine app within your current
        project.
      o gcloud app logs read: Display the latest App Engine app logs.

  Miscellaneous
    Commands that might come in handy

      o gcloud kms decrypt: Decrypt ciphertext (to a plaintext file) using a
        Cloud Key Management Service (Cloud KMS) key.
      o gcloud logging logs list: List your project's logs.
      o gcloud sql backups describe: Display info about a Cloud SQL instance
        backup.
      o gcloud sql export sql: Export data from a Cloud SQL instance to a SQL
        file.

EXAMPLES
    To view this cheat sheet, run:

        $ gcloud cheat-sheet

GCLOUD WIDE FLAGS
    These flags are available to all commands: --access-token-file, --account,
    --billing-project, --configuration, --flags-file, --flatten, --format,
    --help, --impersonate-service-account, --log-http, --project, --quiet,
    --trace-token, --user-output-


ketan_patel@cloudshell:~ (new-user-learning)$ gcloud source repos clone simulation --project=new-user-learning

Cloning into '/home/ketan_patel/simulation'...
remote: Total 5 (delta 0), reused 5 (delta 0)
Receiving objects: 100% (5/5), 4.25 KiB | 4.25 MiB/s, done.
Project [new-user-learning] repository [simulation] was cloned to [/home/ketan_patel/simulation].
l

ketan_patel@cloudshell:~ (new-user-learning)$ cd simulation/

ketan_patel@cloudshell:~/simulation (new-user-learning)$ ls

plannerlite.py  planner.m  planner_types.py
ketan_patel@cloudshell:~/simulation (new-user-learning)$

Create and Configure Cloud Source Repositories by generating SSH Keys and uploading from Windows Powershell.

PS C:\Users\Ketan.Patel\Downloads\planner\planner_lite> ls

    Directory: C:\Users\Ketan.Patel\Downloads\planner\planner_lite

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----         8/28/2023  10:44 AM            783 planner.m
-a----         8/28/2023  10:44 AM           9485 plannerlite.py
-a----         8/28/2023  10:44 AM           2682 planner_types.py

PS C:\Users\Ketan.Patel\Downloads\planner\planner_lite> git status

fatal: not a git repository (or any of the parent directories): .git

PS C:\Users\Ketan.Patel\Downloads\planner\planner_lite> git init

Initialized empty Git repository in C:/Users/Ketan.Patel/Downloads/planner/planner_lite/.git/

PS C:\Users\Ketan.Patel\Downloads\planner\planner_lite> git status

On branch master

No commits yet

Untracked files:
  (use "git add <file>..." to include in what will be committed)
        planner.m
        planner_types.py
        plannerlite.py

nothing added to commit but untracked files present (use "git add" to track)

PS C:\Users\Ketan.Patel\Downloads\planner\planner_lite> git add .

PS C:\Users\Ketan.Patel\Downloads\planner\planner_lite> git status
On branch master

No commits yet

Changes to be committed:
  (use "git rm --cached <file>..." to unstage)
        new file:   planner.m
        new file:   planner_types.py
        new file:   plannerlite.py

PS C:\Users\Ketan.Patel\Downloads\planner\planner_lite> git commit -m "first planner commit"

[master (root-commit) 17a9789] first planner commit
 3 files changed, 348 insertions(+)
 create mode 100644 planner.m
 create mode 100644 planner_types.py
 create mode 100644 plannerlite.py

PS C:\Users\Ketan.Patel\Downloads\planner\planner_lite> git status

On branch master
nothing to commit, working tree clean

PS C:\Users\Ketan.Patel\Downloads\planner\planner_lite> git remote -v

PS C:\Users\Ketan.Patel\Downloads\planner\planner_lite> git remote add google ssh://ketan.patel@supernal.aero@source.developers.google.com:2022/p/new-user-learning/r/simulation

PS C:\Users\Ketan.Patel\Downloads\planner\planner_lite> git remote -v

google  ssh://ketan.patel@supernal.aero@source.developers.google.com:2022/p/new-user-learning/r/simulation (fetch)
google  ssh://ketan.patel@supernal.aero@source.developers.google.com:2022/p/new-user-learning/r/simulation (push)

PS C:\Users\Ketan.Patel\Downloads\planner\planner_lite> git push --all google

The authenticity of host '[source.developers.google.com]:2022 ([142.251.2.82]:2022)' can't be established.
ECDSA key fingerprint is SHA256:AGvEpqYNMqsRNIviwyk4J4HM0lEylomDBKOWZsBn434.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '[source.developers.google.com]:2022' (ECDSA) to the list of known hosts.
ketan.patel@supernal.aero@source.developers.google.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

PS C:\Users\Ketan.Patel> ssh-keygen -t rsa -C "ketan.patel@supernal.aero"

Generating public/private rsa key pair.
Enter file in which to save the key (C:\Users\Ketan.Patel/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in C:\Users\Ketan.Patel/.ssh/id_rsa.
Your public key has been saved in C:\Users\Ketan.Patel/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:MuYhOj0OmqXVwNawvIlHdEIaGp7QY/f4WHt+/LDWbKY ketan.patel@supernal.aero
The key's randomart image is:
+---[RSA 3072]----+
|+..              |
|+== .            |
|o++o.o           |
| + *. o          |
|  B o+=.S        |
| + B.+o+.        |
|. X + .o ..o     |
| B + .  . +o=    |
|+   .    oE=.    |
+----[SHA256]-----+

PS C:\Users\Ketan.Patel> cd .ssh

PS C:\Users\Ketan.Patel\.ssh> ls

    Directory: C:\Users\Ketan.Patel\.ssh

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----         8/28/2023  11:00 AM           2610 id_rsa
-a----         8/28/2023  11:00 AM            580 id_rsa.pub
-a----         8/28/2023  10:58 AM            741 known_hosts
-a----         8/26/2023  10:28 AM            368 known_hosts.old

PS C:\Users\Ketan.Patel\.ssh> pwd

Path
----
C:\Users\Ketan.Patel\.ssh

PS C:\Users\Ketan.Patel\.ssh> cat id_rsa.pub

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDCIdjrFxQyvTDX/ivpB8BgEG2TDRYmS2tCA6KUBviZ0uGpfjcwlmmk0xQVlDR511O8j86kvVzW7J48idkm5BE4fQqbIgjPx49YYfCE6oOqqg5nIBLGrQ1bBDSjkKAsAif6+jhjkp7+ku/h/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+SR/FnYvlsr7O6NDfsnDS4DT40qyJEBf3FAeV/TbfikWOzKAvWUJXaAr5pUhuBUlKagzLqSQDBltSlpgSnzEjTzSrLv5ONM= ketan@abc.com
PS C:\Users\Ketan.Patel\.ssh>


https://source.cloud.google.com/user/ssh_keys





 

REGISTER THE SSH KEY FROM DESKTOP:












PS C:\Users\Ketan.Patel\Downloads\planner\planner_lite> dir

Directory: C:\Users\Ketan.Patel\Downloads\planner\planner_lite

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----         8/28/2023  10:44 AM            783 planner.m
-a----         8/28/2023  10:44 AM           9485 plannerlite.py
-a----         8/28/2023  10:44 AM           2682 planner_types.py

PS C:\Users\Ketan.Patel\Downloads\planner\planner_lite> git push --all google

Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 12 threads
Compressing objects: 100% (5/5), done.
Writing objects: 100% (5/5), 4.25 KiB | 2.12 MiB/s, done.
Total 5 (delta 0), reused 0 (delta 0), pack-reused 0
remote: Waiting for private key checker: 3/3 objects left
To ssh://supernal.aero@source.developers.google.com:2022/p/new-user-learning/r/simulation
 * [new branch]      master -> master
PS C:\Users\Ketan.Patel\Downloads\planner\planner_lite>



CLONE REPO TO CLOUD SHELL :






ketan_patel@cloudshell:~ (new-user-learning)$ gcloud source repos clone simulation --project=new-user-learning

Cloning into '/home/ketan_patel/simulation'...
remote: Total 5 (delta 0), reused 5 (delta 0)
Receiving objects: 100% (5/5), 4.25 KiB | 4.25 MiB/s, done.
Project [new-user-learning] repository [simulation] was cloned to [/home/ketan_patel/simulation].

ketan_patel@cloudshell:~ (new-user-learning)$ cd simulation/

ketan_patel@cloudshell:~/simulation (new-user-learning)$ ls

plannerlite.py  planner.m  planner_types.py
ketan_patel@cloudshell:~/simulation (new-user-learning)$

notes

 


















What is API

 What is an API?
An API is a set of programming code that enables data transmission between one software product and another. It also contains the terms of this data exchange.









An API, which stands for application programming interface, is a set of protocols that enable different software components to communicate and transfer data. 

Developers use APIs to bridge the gaps between small, discrete chunks of code in order to create applications that are powerful, resilient, secure, and able to meet user needs. 

Even though you can't see them, APIs are everywhere—working continuously in the background to power the digital experiences that are essential to our modern lives.












GCP Fundamentals - Cloud Storage





































 

AppEngine - Python

tudent_04_347b5286260a@cloudshell:~/python-docs-samples/appengine/standard_python3/hello_world (qwiklabs-gcp-00-88834e0beca1)$ sudo apt upda...