DEV Community

aravind-dussani99
aravind-dussani99

Posted on • Updated on

Creating a GCP Workstation

Background Info:

For traditional application development, we have multiple IDE's available in the market like VS Code, IntelliJ, JetBrains etc. Developers install these IDEs in local machines and use them to write code, debug and run to check the previews/outputs.

DrawBacks:

  1. Not suitable when developer need high compute power
  2. Issues with In-consistency b/w the developer environments
  3. Takes much time to set-up the environment

Context:
As the technology grows, we can create cloud-based / remote development environments. In addition to the IaaC, PaaC, FaaC & etc services, we have one more new service called as "Development Environment As a Code" (DEaaC). This service is named as "Workstations" in GCP. In which one can get their development environment working setup instantly which will be in cloud not local. We can pre-configure the required IDEs/extensions/services/access in a docker image and can use that to create the workstations to increase the productivity of the developer.

Today, will configure workstation in GCP using different resources of terraform.

Steps:

  1. Pre-requisites
  2. Create a Workstation Cluster
  3. Create a Workstation configuration
  4. Create a Workstation
  5. Access the workstation

Pre-requisites:
Assuming you've followed the post here for the pre-requisites configuration.

Create a Workstation Cluster:

Use the google_workstations_workstation_cluster to create the workstation cluster. the cluster is depended on the VPC, subnets, make sure that you've created them.

workstationcluster

Create a Workstation configuration:

Use the `` to create the workstation configuration. This configuration is the main part of the workstations, as we can define what and all we required here only. We can use the default/custom docker images with the pre-configurable options and machine types with RAM, CPU processors and service accounts access.

workstationconfig

Create a Workstation:

Finally, after all we create the workstation based on the previous cluster and config creations.

workstation

Access the workstation:

To access the workstation, user required at least the roles/workstations.user role. So to add the roles to workstations, will use the google_workstations_workstation_iam_binding resource as shown below.

workstationrole

Once the workstation is provisioned, you can see something like below.

workstationlist

Please click on "Start" and "Launch", there you can see multiple ways to access the workstation and will use this "Launch" or "Connect to Port 80" option to access the workstation IDE from browser.

workstationlaunch

Resources- References:
Google Documentation - https://cloud.google.com/workstations
workstation roles - https://cloud.google.com/workstations/docs/access-control
terraform resources - https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/workstations_workstation
Github: https://github.com/aravind-dussani99/google-workstation

Final words:

Feel free to comment your queries here or at LinkedIn . Thanks.

Top comments (0)