Google Cloud Associate Certified Engineer — 100daysoflearning (Part 2)
Day 33 & 34
In continuation to the course for Google Cloud Associate Certified engineer lets move on with next set of learning topics.
Billing Accounts : Billing accounts can be setup of multiple projects or one billing account can also be used for multiple projects. Generally different teams will have different budgets and based on that different billing accounts can be created and assigned to respective teams.
This is how Billing account dashboard looks like, you can change the name of the billing account by clicking the highlighted option also you can add new accounts:
When we click on Manage billing page it will take us the page where we can see all our billing accounts :
when we click create account we need to enter new billing account name :
when we click continue it takes us to the same page when we selected our country and provided the payment information when we first setup the google cloud account .
For now I am not setting up multiple billing accounts but this is how it is done.
Next if you go back to the billing dashboard you can see the permission section where you can define permission for the user like what level of billing user can a user see.
you have billing Administrators which can be a valid role for CTO , then Account user which can be used by the finance team and the developers can have Account Viewer role. So depending on the needs different users can have different permissions for the billing accounts.
Now lets setup the Budget and alerts for our billing account :
From billing account dashboard select Budgets and Alerts and click on create budget :
here we provide the budget name, select the budget amount (it can also be set based on previous month usage), set different alerts by default google has 3 alerts on 50–90–100 percent usage and you can then select the programmatic notification if you want the result in JSON on alerts. when you click save your budget and alert are set for particular billing account .
Lets move on to Billing Exports :
again form the billing dashboard you can select Billing exports —
this gives two options one is BigQuery and another is FileExport , now bigquery one a much more informative and it does its report analysis as well which giving the reports which can be very useful for resource utilization optimization for production environment and for dev like environments we can go ahead with the file export.
before creating the file Export we need a bucket where all these reports will be stored so select object storage from the menu :
click create bucket >> provide globally unique name>> select region and click create.
then in the Billing export you can create a File Export :
Once you have enough data you will be seeing reports on daily basis which tells you about the account info usage etc. in the form of a CSV as selected by us earlier.
Next we will setup a cloud server(Linux academy for my case you can create from google cloud account compute as well) and install cloud SDK to interact with our Google cloud Account :
For the latest installation steps go to : https://cloud.google.com/sdk/docs/quickstarts
ssh into your linux ubuntu terminal which I am using in my case and start running the following commands:
there are two kinds of installations present one is native installation and one is via Docker so if you have multiple things running like python different versions, go different version and you do not want any version conflict then go for docker installation but since I have brand new cloud server so I will go ahead with the native installation .
- export CLOUD_SDK_REPO=”cloud-sdk-$(lsb_release -c -s)”
- echo “deb http://packages.cloud.google.com/apt $CLOUD_SDK_REPO main” | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
- curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
- sudo apt-get update && sudo apt-get install google-cloud-sdk
After running above commands the google cloud sdk will be installed and we can test it by simply typing gcloud command. Now lets configure it for our cloud environment:
run gcloud init
Once you do it it will ask you to copy paste a link in browser and allow the Google cloud SDK and provide you with the code/key .
Next it asks you to set the default project for the cloud sdk so that you can run the commands without specifying the project name each time so by specifying this it will configure according the the project selected.
There are other things as well that we can do with the Google cloud SDK:
Google Cloud SDK have different set of components which can be installed as well, some of them are preinstalled and some needs to be installed a s per the requirement eg: Alpha, Beta, BQ, GSUTIL etc.
gcloud config configurations list gives you below details:
NAME IS_ACTIVE ACCOUNT PROJECT DEFAULT_ZONE DEFAULT_REGION
man commands helps to get the detailed documentation about a particular command eg. man gcloud_config_configurations will give you the documentation and the functionality of gcloud config configurations command.
You can also set configurations for various components in Google Cloud like for compute :
gcloud config set compute/zone us-east1
gcloud config unset compute/zone us-east1
There are lot of other stuffs that can be done using Cloud console and for the certification its an important aspect as well to get well versed with Google Cloud SDK . I will keep on telling you more and more things that we can do with the SDK as we progress.