---
title: "Web Server on Google Compute Engine, Written in HCL"
description: "A simple web server on a Google Compute Engine instance, written in HCL"
url: "https://www.pulumi.com/dev/examples/gcp-hcl-webserver/"
image: "https://www.pulumi.com/assets/og/dev/examples/gcp-hcl-webserver.png"
---

# Web Server on Google Compute Engine, Written in HCL

A simple web server on a Google Compute Engine instance, written in HCL

- Source on GitHub: https://github.com/pulumi/examples/tree/master/gcp-hcl-webserver

## Get started with this example

This example lives in the [pulumi/examples](https://github.com/pulumi/examples/tree/master/gcp-hcl-webserver) repo. Pull down just this directory to follow along:

```bash
git clone --filter=blob:none --sparse https://github.com/pulumi/examples pulumi-examples
git -C pulumi-examples sparse-checkout set gcp-hcl-webserver
cd pulumi-examples/gcp-hcl-webserver
```

A simple web server running on a Google Compute Engine instance, written in
[Pulumi HCL](https://www.pulumi.com/docs/languages-sdks/hcl/). Pulumi installs the HCL language
plugin and the Terraform Google provider automatically the first time you run the program.

## Deploying and running the program

1.  Create a new stack:

    ```bash
    $ pulumi stack init webserver-testing
    ```

1.  [Configure your GCP credentials](https://www.pulumi.com/registry/packages/gcp/installation-configuration/)
    and set the project and zone to deploy into:

    ```bash
    $ export GOOGLE_PROJECT=my-project
    $ export GOOGLE_ZONE=us-central1-a
    ```

1.  Run `pulumi up` to preview and deploy changes. After the preview is shown you will be
    prompted if you want to continue or not.

1.  Curl the HTTP server:

    ```bash
    $ curl $(pulumi stack output instance_ip)
    Hello, World!
    ```

    The instance may take a minute to boot and start serving after the deployment finishes.

1.  To clean up resources, run `pulumi destroy` and answer the confirmation question at the prompt.
