Cloud Native Programming

Cloud Native Infrastructure as Code for Google Cloud with Pulumi

Pulumi provides a cloud native programming model for Google Cloud to create containers, serverless functions, and infrastructure, enabling the delivery of Cloud Native Infrastructure as Code, using real programming languages.

Find out how to program the cloud with Pulumi and Google Cloud.

Need help with Cloud Native Infrastructure as Code with Google Cloud? Drop us a line.

Benefits of Pulumi

Real Code

Pulumi is infrastructure as real code. This means you get all the benefits of your favorite language and tool for provisioning cloud infrastructure: code completion, error checking, versioning, IDE support, and general productivity gains - without the need to manage YAML and DSL syntax.

Reusable Components

As Pulumi is code, you can build up a library of packages to further enhance efficiency. Build repeatable practices through versioned packages such as: standard policies, network best practices, architecture blueprints - and deploy them to your team.

Immutable Infrastructure

Pulumi provides the computation of necessary cloud resources with a 'Cloud Resource DAG' ensuring successful deployment of cloud infrastructure - efficiently building, updating, and destroying cloud resources as required.


Build and deploy a GKE cluster

Pulumi supports programming against Kubernetes – Minikube, custom on-premises, or cloud-hosted custom clusters or in managed clusters such as Google GKE.

This code defines a GKE cluster with configurable settings which could be used in a module which could then be used to deploy an app to the cluster.

Get Started

Pulumi can be used on any resource covering serverless, containers, and infrastructure using JavaScript, TypeScript, Python, and Go.

// Define a GKE cluster with configurable settings
import * as gcp from "@pulumi/gcp";
import { nodeCount, nodeMachineType, password, username } from "./config";

export const k8sCluster = new gcp.container.Cluster("gke-cluster", {
    initialNodeCount: nodeCount,
    nodeVersion: "latest",
    minMasterVersion: "latest",
    masterAuth: { username, password },
    nodeConfig: {
        machineType: nodeMachineType,
        oauthScopes: [

Build and deploy Kubernetes apps to GKE

Pulumi supports deploying apps and services to Kubernetes clusters such as GKE.

This code makes use of our previously defined GKE cluster and deploys an nginx canary onto the cluster with 1 replica.

Get Started

Pulumi can be used on any resource covering serverless, containers, and infrastructure using JavaScript, TypeScript, Python, and Go.

// Deploy an nginx canary to GKE
import * as k8s from "@pulumi/kubernetes";
import * as pulumi from "@pulumi/pulumi";
import { k8sProvider, k8sConfig } from "./cluster";

// Create a canary deployment to test that this cluster works.
const name = `${pulumi.getProject()}-${pulumi.getStack()}`;
const canaryLabels = { app: `canary-${name}` };
const canary = new k8s.apps.v1beta1.Deployment("canary", {
    spec: {
        selector: { matchLabels: canaryLabels },
        replicas: 1,
        template: {
            metadata: { labels: canaryLabels },
            spec: { containers: [{ name, image: "nginx" }] },
}, { provider: k8sProvider });

// Export the Kubeconfig so that clients can easily access our cluster.
export let kubeConfig = k8sConfig;


Creating a Simple Web Server

Pulumi gives you a way to express infrastructure configuration using your favorite programming language.

This code uses TypeScript on Node.js to define the necessary environment, defines a very simple web server, and then creates the instance, before exporting the IP and Hostname.

Get Started

Pulumi can be used on any resource covering serverless, containers, and infrastructure using JavaScript, TypeScript, Python, and Go.

const gcp = require("@pulumi/gcp");

const computeNetwork = new gcp.compute.Network("network", {
    autoCreateSubnetworks: true,

const computeFirewall = new gcp.compute.Firewall("firewall", {
    network: computeNetwork.selfLink,
    allows: [{
        protocol: "tcp",
        ports: [ "22", "80" ],

// Create a simple web server
const startupScript = `#!/bin/bash
echo "Hello, World!" > index.html
nohup python -m SimpleHTTPServer 80 &`;

const computeInstance = new gcp.compute.Instance("instance", {
    machineType: "f1-micro",
    metadataStartupScript: startupScript,
    bootDisk: {
        initializeParams: {
            image: "debian-cloud/debian-8",
    networkInterfaces: [{
        accessConfigs: [{}], // must be empty 
    serviceAccount: {
      scopes: [""],
}, { dependsOn: [computeFirewall] });

exports.instanceName =;
exports.instanceIP = computeInstance.networkInterfaces.apply(ni => ni[0].accessConfigs[0].natIp);

Creating a Google Cloud Function

With Pulumi, you can combine infrastructure definitions and application code in one program. The @pulumi/cloud-gcp library is a set of Pulumi components that provide a higher-level abstraction over Azure. You can use this library and define application code at the same time as the infrastructure it depends on.

This example shows how to create a simple Google Cloud Function that returns a message when invoked.

Get Started

Pulumi can be used on any resource covering serverless, containers, and infrastructure using JavaScript, TypeScript, Python, and Go.

// Create a simple Function
            import * as gcpFunction from "./gcpFunction";
            let greetingFunction = new gcpFunction.HttpFunction("greeting", (req, res) => {
                res.send(`Greetings from ${ || 'Google Cloud Functions'}!`);
            export let url = greetingFunction.httpsTriggerUrl;

How Pulumi Works

Featured Customer

Learning Machine

Learning Machine

Learning Machine, a blockchain SaaS company faced two challenges with their cloud infrastructure:

  1. Skills gaps between Dev and DevOps creating silos, and fragility.
  2. The need to more rapidly provision their expanding roster of new customers.

By moving to Pulumi, Learning Machine were able to solve both challenges with significant increases in capability:

25,000 Lines of CloudFormation reduced to 500 Lines of JavaScript
New customer provisioning time reduced from 3 weeks to 1 hour

Pulumi has given our team the tools and framework to achieve a unified development and DevOps model, boosting productivity and taking our business to any cloud environment that our customers need. We retired 25,000 lines of complex code that few team members understood and replaced it with 100s of lines in a real programming language.

Get started with Pulumi

Pulumi works with your favorite language, and can be used with any cloud.

Install Pulumi



Try our tutorials



Read the docs



Let Pulumi assist with your cloud infrastructure

Need help delivering Cloud Native Infrastructure as Code on GCP? Drop us a line.

More from Pulumi

Migrate to Pulumi

In this video, Pulumi CTO, Luke Hoban, discusses how to begin to migrate to Pulumi from existing tools such as CloudFormation and Terraform.

Learn more

Serverless, Containers, and Infrastructure

In this blog post, we show productive Pulumi can be at combining different aspects of cloud architecture for truly cloud native programming.

Learn more