---
title: "Web Server Using Openstack"
description: "A minimal OpenStack Python Pulumi program"
url: "https://www.pulumi.com/dev/examples/openstack-py-webserver/"
image: "https://www.pulumi.com/assets/og/dev/examples/openstack-py-webserver.png"
---

# Web Server Using Openstack

A minimal OpenStack Python Pulumi program

- Source on GitHub: https://github.com/pulumi/examples/tree/master/openstack-py-webserver

## Get started with this example

This example lives in the [pulumi/examples](https://github.com/pulumi/examples/tree/master/openstack-py-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 openstack-py-webserver
cd pulumi-examples/openstack-py-webserver
```

## Prerequisites

1. [Install Pulumi](https://www.pulumi.com/docs/get-started/install/)
1. [Configure Pulumi for Openstack](https://www.pulumi.com/docs/intro/cloud-providers/openstack/setup/)
1. [Configure Pulumi for Python](https://www.pulumi.com/docs/intro/languages/python/)

## Deploying and running the program

1. Create a new stack:

    ```bash
    $ pulumi stack init
    ```

2. Modify `__main__.py` to include your keypair and image

3. Run `pulumi up` to preview and deploy changes:

    ```bash
    $ pulumi up
    Previewing update (dev):
        Type                                  Name           Plan
        pulumi:pulumi:Stack                   pulum-dev
    +   ├─ openstack:images:Image             fedora         create
    +   ├─ openstack:compute:Keypair          default        create
    +   ├─ openstack:networking:SecGroupRule  secgroupRule1  create
    +   ├─ openstack:networking:SecGroupRule  secgroupRule2  create
    +   ├─ openstack:networking:SecGroupRule  secgroupRule3  create
    +   └─ openstack:compute:Instance         test_fedora    create

    Outputs:
    ~ instance_ip: "192.168.0.243" => output<string>

    Resources:
        + 6 to create
        1 unchanged
    Resources:
        + 6 created
        1 unchanged

    Duration: 38s

    ```

4. View the host name and IP address of the instance via `stack output`:

    ```bash
    $ pulumi stack output
    Current stack outputs (1):
        OUTPUT       VALUE
        instance_ip  192.168.0.243
    ```

5.  Verify that the Openstack instance exists, by either using the Horizon dashboard or running `openstack server list`.
    ```bash
    $ openstack server list
    +--------------------------------------+-------------+--------+-------------------------------------+--------------------------+----------+
    | ID                                   | Name        | Status | Networks                            | Image                    | Flavor   |
    +--------------------------------------+-------------+--------+-------------------------------------+--------------------------+----------+
    | 8bdf8a6d-ac53-4448-ae09-e2a08ad554a0 | test_fedora | ACTIVE | public=192.168.0.243, 2001:db8::36b | fedora                   | m1.small |
    +--------------------------------------+-------------+--------+-------------------------------------+--------------------------+----------+
    ```

## Clean up

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