Skip to main content

Search the Dev Center

Search tutorials, templates, examples, and more.

Web server on Linode

Basic example of an Linode web server accessible over HTTP

This example lives in the pulumi/examples repository. Check out just this directory to use it:

Get started with this example
git clone --filter=blob:none --sparse https://github.com/pulumi/examples pulumi-examples
git -C pulumi-examples sparse-checkout set linode-js-webserver
cd pulumi-examples/linode-js-webserver

Starting point for building a Pulumi sample web server on Linode.

Prerequisites#

  1. Install Pulumi
  2. Configure Linode credentials
  3. Install Node.js

Deploying the example#

  1. Create a new stack:

    Terminal window
    pulumi stack init webserver-linode-testing
  2. Set your Linode API token:

    Terminal window
    pulumi config set --secret linode:token YOURLINODETOKEN
  3. Install dependencies:

    Terminal window
    npm install
  4. Run pulumi up to preview and deploy changes:

    Terminal window
    pulumi up
    Updating (webserver-linode-testing):
    Type Name Status
    + pulumi:pulumi:Stack webserver-linode-webserver-linode-testing created
    + ├─ linode:index:StackScript simple-server created
    + └─ linode:index:Instance instance created
    Outputs:
    instanceIP : "69.164.221.90"
    instanceLabel: "linode13879908"
    Resources:
    + 3 created
    Duration: 55s
  5. Curl the HTTP server:

    Terminal window
    curl $(pulumi stack output instanceIP)
    Hello, World!
  6. SSH into the server:

    Terminal window
    linode-cli ssh root@$(pulumi stack output instanceLabel)

Cleaning up#

Once you’re finished experimenting, destroy your stack and remove it to avoid incurring any additional cost:

Terminal window
pulumi destroy
pulumi stack rm

Related

The infrastructure as code platform for any cloud.