• Что бы вступить в ряды "Принятый кодер" Вам нужно:
    Написать 10 полезных сообщений или тем и Получить 10 симпатий.
    Для того кто не хочет терять время,может пожертвовать средства для поддержки сервеса, и вступить в ряды VIP на месяц, дополнительная информация в лс.

  • Пользаватели которые будут спамить, уходят в бан без предупреждения. Спам сообщения определяется администрацией и модератором.

  • Гость, Что бы Вы хотели увидеть на нашем Форуме? Изложить свои идеи и пожелания по улучшению форума Вы можете поделиться с нами здесь. ----> Перейдите сюда
  • Все пользователи не прошедшие проверку электронной почты будут заблокированы. Все вопросы с разблокировкой обращайтесь по адресу электронной почте : info@guardianelinks.com . Не пришло сообщение о проверке или о сбросе также сообщите нам.

GCP + Terraform: Intro

Lomanu4 Оффлайн

Lomanu4

Команда форума
Администратор
Регистрация
1 Мар 2015
Сообщения
1,481
Баллы
155
Google Cloud Platform (GCP) provides tons of services like storage, compute, databases, etc.. and it's a mess to go through all of them.

Terraform is a IAC (infrastructure as code) tool, so you write config (similar to Dockerfile for example), and define what services you need, so it creates that service on your account.

Using them together is a superpower, Terraform works with major providers like Azure, AWS & GCP so anything works.

So let's start with understanding some basic services, later I'll show how to use them in detail, but fundamentals are important.

There's hundreds of services, but I'll go through only the main ones, after that the rest is similar and easy to get used to when needed.



.

GCP Services



Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.



1. Compute Engine


Every server, client or any type of machine is a computer. This is the most basic thing you can get, a machine you get access to, where you can run any type of service, just like your local machine.

There's different family such as:

  • E2 – cost-effective, good for general workloads.
  • N2 / N2D – better performance than E2, with N2D offering AMD CPUs.
  • N1 – older generation, still widely used.
  • C3 – Newest, highest performance
You don't really need to remember this by the way, just an overview
Depending on your task, you can choose the physical requirements, the memory, CPU cores, disk, etc.. you're in full control.

2. Storage Bucket


Think of it as Google Drive for your backend. Used to store any kind of static assets – images, videos, logs, backups, etc. Fully managed, cheap, and scalable.

You can set permissions, make files public, and connect it to a CDN.
Great for serving assets or storing backups/logs.

3. Cloud Run -> serverless execution


Let’s you run containers without managing any servers. You just give it a Docker image, and it handles the rest – scaling, routing, and more.

Pay-per-use. No traffic? No cost.
Good for APIs, webhooks, or any small backend service.

4.. Firestore -> NoSQL DB


A scalable NoSQL document database. Stores data in collections of documents (like JSON).

Best for quick-moving apps where you don’t need SQL.
What Terraform does?



Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.


Initially, you have the

Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.

, but using the web console when a lot of services comes to be, its hard to manage.

With terraform you have three steps only:

  • Init: Install the provider support (in our case, GCP)
  • Plan: Similar to commit in git, mark changes.
  • Apply: pretty self-explanatory, no?

Simply by writing config such as:


resource "google_compute_instance" "vm-instance" {
name = "vm-instance-tf"
machine_type = "f1-micro"
zone = "asia-south2-a"

boot_disk {
initialize_params {
image = "ubuntu-os-cloud/ubuntu-2204-lts"
}
}

network_interface {
network = google_compute_network.vpc_network.name
access_config {}
}

tags = ["allow-web-ssh"]
}

and using this, you can just create a service easily (this is for a compute engine).
Updating, deleting, making changes also becomes very easy.

For now, let's do setup:


This was to just get familiar with what is what, I'll show a hands on with compute engine + terraform in the next one!


Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.

 
Вверх Снизу