1. Create a Pulumi GCP instance template with specific CPU and RAM

    TypeScript

    You can use Google Cloud Platform's compute.InstanceTemplate resource to create an instance template with specific CPU and RAM.

    The following TypeScript program creates an instance template with a n1-standard-1 machine type, which consists of 1 vCPU and 3.75 GB of memory.

    Please replace project and region with your actual project id and desired region.

    import * as pulumi from "@pulumi/pulumi"; import * as gcp from "@pulumi/gcp"; const instanceTemplate = new gcp.compute.InstanceTemplate("instanceTemplate", { namePrefix: "instance-template-", machineType: "n1-standard-1", region: "us-central1", project: "your-project-id", disk: [ { boot: true, sourceImage: "projects/debian-cloud/global/images/family/debian-9", }, ], networkInterface: { network: "default", }, serviceAccount: { email: "default", scopes: ["https://www.googleapis.com/auth/cloud-platform"], }, }); export const instanceTemplateName = instanceTemplate.name;

    If you want to use a different machine type, you can replace n1-standard-1 with your desired machine type that specifies a different number of CPUs and/or amount of memory. Here is a link to the machine types available in Google Cloud.

    This program also specifies that the instance should use a Disk that boots from the debian-9 image. The service account with the "https://www.googleapis.com/auth/cloud-platform" scope is also part of the instance template configuration to allow the instance to authenticate with GCP services.

    You can find more information about this resource in Pulumi's documentation for gcp.compute.InstanceTemplate.