FIRST LAB
1. Creating cloud storage bucket
gsutil mb gs://<BUCKET_NAME>
gsutil mb -l US gs://$DEVSHELL_PROJECT_ID
2. Uploading file to storagebudget
gsutil cp [MY_FILE] gs://[BUCKET_NAME]
3. To list available regions
gcloud compute regions list
4. To create a directory
mkdir [DIRECTORY NAME]
5. To create a file directory in the directory
touch [DIRECTORY NAME]/[FILE NAME]
6. Create a variable example
INFRACLASS_PROJECT_ID=[YOUR_PROJECT_ID]
7. Calling a variable example
echo $INFRACLASS_PROJECT_ID
8. Append the environment variable to a file
echo INFRACLASS_PROJECT_ID=$INFRACLASS_PROJECT_ID >> ~/[DIRECTORY NAME]/[FILE NAME]
9. Modify the bash profile to create persistence
nano .profile
source infraclass/config
-----------------------------------------------------------------------------------
-----
10. In the SSH window, enter command to shut down all the running services
sudo /opt/bitnami/ctlscript.sh stop
11. To restart service
sudo /opt/bitnami/ctlscript.sh restart
-----------------------------------------------------------------------------------
-----
12. to switch projects in cloud shell
gcloud config set project $[project id]
-----------------------------------------------------------------------------------
-------
13. To create the VPC network named privatenet
gcloud compute networks create privatenet --subnet-mode=custom
14. To create the privatesubnet-us subnet
gcloud compute networks subnets create privatesubnet-us --network=privatenet
--region=us-central1 --range=172.16.0.0/24
15. To list the available VPC networks
gcloud compute networks list
16. To list the available VPC subnets (sorted by VPC network)
gcloud compute networks subnets list --sort-by=NETWORK
17. To create the privatenet-allow-icmp-ssh-rdp firewall rule
gcloud compute firewall-rules create privatenet-allow-icmp-ssh-rdp
--direction=INGRESS --priority=1000 --network=privatenet --action=ALLOW
--rules=icmp,tcp:22,tcp:3389 --source-ranges=0.0.0.0/0
18. To list all the firewall rules (sorted by VPC network)
gcloud compute firewall-rules list --sort-by=NETWORK
19. To create a vm instance called privatenet-us-vm instance
gcloud compute instances create privatenet-us-vm --zone=us-central1-c --machine-
type=f1-micro --subnet=privatesubnet-us --image-family=debian-10 --image-
project=debian-cloud --boot-disk-size=10GB --boot-disk-type=pd-standard --boot-
disk-device-name=privatenet-us-vm
20. To list all the VM instances (sorted by zone)
gcloud compute instances list --sort-by=ZONE