22
33The GCP Compute Engine backend of Lithops can provide a serverless user experience on top of GCE where Lithops creates new Virtual Machines (VMs) dynamically at runtime and scales Lithops jobs against them (create and reuse modes). Alternatively Lithops can start and stop an existing VM instance (consume mode).
44
5- The backend key is ` gcp_compute_engie ` (matches the Lithops module name).
5+ The backend key is ` gcp_compute_engine ` (matches the Lithops module name).
66
77## Choose an operating system image for the VM
88
9- Any VM needs an operating system image. By default Lithops uses Ubuntu 24.04 (` ubuntu-2404-lts-amd64 ` ). Lithops installs required dependencies on the VM on first use (this can take a few minutes).
9+ Any VM needs an operating system image. By default Lithops uses Ubuntu 24.04 (` projects/ubuntu-os-cloud/global/images/family/ubuntu-2404-lts-amd64 ` ). Lithops installs required dependencies on the VM on first use (this can take a few minutes).
10+
11+ For faster startups, build a pre-configured custom image (see [ runtime/gcp_compute_engine] ( https://github.com/lithops-cloud/lithops/tree/master/runtime/gcp_compute_engine ) ):
12+
13+ ``` bash
14+ lithops image build -b gcp_compute_engine
15+ ```
16+
17+ This creates ` lithops-ubuntu-2404-lts-amd64-server ` in your project; Lithops uses it automatically when present.
1018
1119To list available images:
1220
1321``` bash
14- lithops image list -b gcp_compute_engie
22+ lithops image list -b gcp_compute_engine
1523```
1624
17- Use the ** Image ID** column as ` source_image ` in your config.
25+ Use the ** Image ID** column as ` source_image ` in your config when using a custom image name .
1826
1927## Installation
2028
@@ -54,12 +62,12 @@ gcloud projects add-iam-policy-binding <PROJECT_ID> \
5462
5563``` yaml
5664lithops :
57- backend : gcp_compute_engie
65+ backend : gcp_compute_engine
5866
5967gcp :
6068 credentials_path : <FULL_PATH_TO_SERVICE_ACCOUNT_JSON>
6169
62- gcp_compute_engie :
70+ gcp_compute_engine :
6371 project_name : <GCP_PROJECT_ID>
6472 zone : <ZONE>
6573 exec_mode : reuse
@@ -78,29 +86,29 @@ Lithops attaches the service account from `credentials_path` to master and worke
7886
7987|Group|Key|Default|Mandatory|Additional info|
8088|---|---|---|---|---|
81- |gcp_compute_engie | project_name | |yes | GCP project ID |
82- |gcp_compute_engie | zone | |yes | Compute Engine zone, for example `us-east1-b` |
83- |gcp_compute_engie | region | derived from zone |no | Region used for subnet and NAT |
84- |gcp_compute_engie | service_account | |no | Service account email attached to VMs. Default : ` client_email` from `credentials_path` |
85- |gcp_compute_engie | network_name | |no | Existing VPC name. If not provided, Lithops creates a new network |
86- |gcp_compute_engie | subnet_name | |no | Existing subnet name when using a custom VPC |
87- |gcp_compute_engie | source_image | ubuntu-2404-lts-amd64 |no | Boot image reference |
88- |gcp_compute_engie | master_instance_type | e2-small |no | Master VM machine type |
89- |gcp_compute_engie | worker_instance_type | e2-standard-2 |no | Worker VM machine type |
90- |gcp_compute_engie | ssh_username | ubuntu |no | Username to access the VM |
91- |gcp_compute_engie | ssh_password | |no | Password for worker VMs. If not provided, it is created randomly |
92- |gcp_compute_engie | ssh_key_filename | ~/.ssh/id_rsa |no | SSH private key for the master VM. If not provided, Lithops creates one |
93- |gcp_compute_engie | request_spot_instances | False |no | Use Spot VMs for workers |
94- |gcp_compute_engie | delete_on_dismantle | True |no | Delete worker VMs when stopped. Master VM is never deleted when stopped |
95- |gcp_compute_engie | max_workers | 100 |no | Max number of workers per `FunctionExecutor()` |
96- |gcp_compute_engie | worker_processes | AUTO |no | Parallel Lithops processes per worker. Default : CPUs of `worker_instance_type` |
97- |gcp_compute_engie | runtime | python3 |no | Runtime name. Default : python3 on the VM |
98- |gcp_compute_engie | auto_dismantle | True |no | If False, VMs are not stopped automatically |
99- |gcp_compute_engie | soft_dismantle_timeout | 300 |no | Seconds to stop the VM after a job **completed** |
100- |gcp_compute_engie | hard_dismantle_timeout | 3600 |no | Seconds to stop the VM after a job **started** |
101- |gcp_compute_engie | exec_mode | reuse |no | One of : **consume**, **create** or **reuse** |
102- |gcp_compute_engie | extra_apt_packages | [] |no | Extra apt packages on master/worker VMs during setup |
103- |gcp_compute_engie | extra_python_packages | [] |no | Extra pip packages on master/worker VMs after Lithops |
89+ |gcp_compute_engine | project_name | |yes | GCP project ID |
90+ |gcp_compute_engine | zone | |yes | Compute Engine zone, for example `us-east1-b` |
91+ |gcp_compute_engine | region | derived from zone |no | Region used for subnet and NAT |
92+ |gcp_compute_engine | service_account | |no | Service account email attached to VMs. Default : ` client_email` from `credentials_path` |
93+ |gcp_compute_engine | network_name | |no | Existing VPC name. If not provided, Lithops creates a new network |
94+ |gcp_compute_engine | subnet_name | |no | Existing subnet name when using a custom VPC |
95+ |gcp_compute_engine | source_image | ubuntu-2404-lts-amd64 |no | Boot image reference |
96+ |gcp_compute_engine | master_instance_type | e2-small |no | Master VM machine type |
97+ |gcp_compute_engine | worker_instance_type | e2-standard-2 |no | Worker VM machine type |
98+ |gcp_compute_engine | ssh_username | ubuntu |no | Username to access the VM |
99+ |gcp_compute_engine | ssh_password | |no | Password for worker VMs. If not provided, it is created randomly |
100+ |gcp_compute_engine | ssh_key_filename | ~/.ssh/id_rsa |no | SSH private key for the master VM. If not provided, Lithops creates one |
101+ |gcp_compute_engine | request_spot_instances | False |no | Use Spot VMs for workers |
102+ |gcp_compute_engine | delete_on_dismantle | True |no | Delete worker VMs when stopped. Master VM is never deleted when stopped |
103+ |gcp_compute_engine | max_workers | 100 |no | Max number of workers per `FunctionExecutor()` |
104+ |gcp_compute_engine | worker_processes | AUTO |no | Parallel Lithops processes per worker. Default : CPUs of `worker_instance_type` |
105+ |gcp_compute_engine | runtime | python3 |no | Runtime name. Default : python3 on the VM |
106+ |gcp_compute_engine | auto_dismantle | True |no | If False, VMs are not stopped automatically |
107+ |gcp_compute_engine | soft_dismantle_timeout | 300 |no | Seconds to stop the VM after a job **completed** |
108+ |gcp_compute_engine | hard_dismantle_timeout | 3600 |no | Seconds to stop the VM after a job **started** |
109+ |gcp_compute_engine | exec_mode | reuse |no | One of : **consume**, **create** or **reuse** |
110+ |gcp_compute_engine | extra_apt_packages | [] |no | Extra apt packages on master/worker VMs during setup |
111+ |gcp_compute_engine | extra_python_packages | [] |no | Extra pip packages on master/worker VMs after Lithops |
104112
105113# # Consume mode
106114
@@ -110,12 +118,12 @@ In this mode, Lithops uses an existing VM. The VM must be reachable by SSH and h
110118
111119` ` ` yaml
112120lithops:
113- backend: gcp_compute_engie
121+ backend: gcp_compute_engine
114122
115123gcp:
116124 credentials_path: <FULL_PATH_TO_SERVICE_ACCOUNT_JSON>
117125
118- gcp_compute_engie :
126+ gcp_compute_engine :
119127 exec_mode: consume
120128 project_name: <GCP_PROJECT_ID>
121129 zone: <ZONE>
@@ -126,19 +134,19 @@ gcp_compute_engie:
126134
127135|Group|Key|Default|Mandatory|Additional info|
128136|---|---|---|---|---|
129- |gcp_compute_engie | instance_name | |yes | Existing VM instance name |
130- |gcp_compute_engie | project_name | |yes | GCP project ID |
131- |gcp_compute_engie | zone | |yes | Compute Engine zone |
132- |gcp_compute_engie | ssh_username | ubuntu |no | Username to access the VM |
133- |gcp_compute_engie | ssh_key_filename | ~/.ssh/id_rsa |no | Path to the SSH private key |
134- |gcp_compute_engie | worker_processes | AUTO |no | Parallel Lithops processes per worker |
137+ |gcp_compute_engine | instance_name | |yes | Existing VM instance name |
138+ |gcp_compute_engine | project_name | |yes | GCP project ID |
139+ |gcp_compute_engine | zone | |yes | Compute Engine zone |
140+ |gcp_compute_engine | ssh_username | ubuntu |no | Username to access the VM |
141+ |gcp_compute_engine | ssh_key_filename | ~/.ssh/id_rsa |no | Path to the SSH private key |
142+ |gcp_compute_engine | worker_processes | AUTO |no | Parallel Lithops processes per worker |
135143
136144# # Test Lithops
137145
138146Once you have your compute and storage backends configured, you can run a hello world function with :
139147
140148` ` ` bash
141- lithops hello -b gcp_compute_engie -s gcp_storage
149+ lithops hello -b gcp_compute_engine -s gcp_storage
142150` ` `
143151
144152# # Viewing the execution logs
@@ -158,33 +166,33 @@ All VMs, including the master, are automatically stopped after a configurable ti
158166You can open an SSH session to the master VM with :
159167
160168` ` ` bash
161- lithops attach -b gcp_compute_engie
169+ lithops attach -b gcp_compute_engine
162170` ` `
163171
164172The master and worker VMs store Lithops service logs in `/tmp/lithops-root/*-service.log`.
165173
166174To list available workers :
167175
168176` ` ` bash
169- lithops worker list -b gcp_compute_engie
177+ lithops worker list -b gcp_compute_engine
170178` ` `
171179
172180To list submitted jobs :
173181
174182` ` ` bash
175- lithops job list -b gcp_compute_engie
183+ lithops job list -b gcp_compute_engine
176184` ` `
177185
178186To delete workers only :
179187
180188` ` ` bash
181- lithops clean -b gcp_compute_engie -s gcp_storage
189+ lithops clean -b gcp_compute_engine -s gcp_storage
182190` ` `
183191
184192To delete workers, the master VM, and Lithops-created network resources :
185193
186194` ` ` bash
187- lithops clean -b gcp_compute_engie -s gcp_storage --all
195+ lithops clean -b gcp_compute_engine -s gcp_storage --all
188196` ` `
189197
190198# # Architecture diagram
0 commit comments