If we want to create anything in the cloud, we can just navigate and go to click, and then we can create its ok in the dev environment and prod environment, but what about UAT and PROD env that where we need to create any reasoures by using code
A form automation tool for Iaac is Terraform
And then why do we need a service account in GCP instead of an individual account? because if we leave the team, the work which I left or incase of one person absence other person and able to do that.
The service account is designed in the Principle of Least Privilege, so it means its automatically restricts the user by their role.
The resources:
For example, if we want to create the GCP bucket just need to create one resource for it, likewise to any biquery , composer, etc.. we can access through terraform using resource, likewise in airflow DAGS .
resource "google_storage_bucket" "my_bucket" {
name = "my-unique-bucket-name"
location = "US"
}
Always refer Terraform official documentation to know the syntax for creating any resources for anything.
To install Terraform, just use CMD in Mac, use brew(package installer) like wise Choco in Windows
if we want to connect from our local machine to GCP using gcloud commands instead of logging into the cloud and giving these commands in google Cloud Shell.
examples:
gcloud compute instances create my-instance --zone=us-central1-a --machine-type=e2-medium --image-family=debian-11 --image-project=debian-cloud
my-instance
: Name of the instance.--zone
: Specifies the zone.--machine-type
: Sets the machine type.
--image-family
and --image-project
: Specify the OS image.
Comments
Post a Comment