GCP Classroom notes 25/Aug/2024

Gcloud CLI

How to filter results

  • gcloud cli has --filter flag that allows you to specify conditions to narrow down the output
  • The –filter allows us to narrow down output by
--filter='field=value'
  • Lets apply basic filter to get all subnets of us-central1 region
    Preview
  • Lets apply filter to get all subnets of us-central1 and us-east1 regions
    Preview
  • We can apply comparision operators >=, '<=, !=, =
  • We have combination operators AND OR
    Preview
  • We can use regular expressions with ~
    Preview
  • We can use –format to Customize output
    Preview

Creating shell scripts with gcloud cli

  • Refer Here for bash cheat sheets
  • Refer Here for scripting gcloud cli commands
  • Refer Here for an article to automate gcp tasks with shell
  • Lets create a vpc if there is no existing vpc with same name Refer Here for the changes done
  • getting specific fields
    Preview

CREATE a shell script which does the following

  • creates vpc with Refer Here for solution
    • firewall rules to allow icmp by default
    • Usage createvpc.sh <name>
  • Create a subnets in vpc according to region, range and name passed Refer Here for solutions
    • Usage createsubnet.sh <vpc-name> <subnet-name> <range> <region>
  • Create a ingress firewall rules
    • Usage createingressfirewall.sh <vpc-name> <tag-name> <ports> <source>

Published
Categorized as Uncategorized Tagged

By continuous learner

devops & cloud enthusiastic learner

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Please turn AdBlock off
Social Network Integration by Acurax Social Media Branding Company

Discover more from Direct DevOps from Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading

Visit Us On FacebookVisit Us On LinkedinVisit Us On Youtube