Gcloud CLI
How to filter results
- gcloud cli has
--filterflag 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-central1region

- Lets apply filter to get all subnets of
us-central1andus-east1regions

- We can apply comparision operators
>=,'<=,!=,= - We have combination operators
ANDOR

-
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>
- Usage
- Create a ingress firewall rules
- Usage
createingressfirewall.sh <vpc-name> <tag-name> <ports> <source>
- Usage
