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
  • Lets apply filter to get all subnets of us-central1 and us-east1 regions
  • We can apply comparision operators >=, '<=, !=, =
  • We have combination operators AND OR
  • We can use regular expressions with ~
  • We can use –format to Customize output

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

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 comment

Turn on JavaScript to leave a comment.

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

Please turn AdBlock off
Floating Social Media Icons by Acurax Wordpress Designers
Exit mobile version
%%footer%%