Web Server Using Amazon EC2

View Code Deploy

This example deploys a simple AWS EC2 virtual machine running a Python web server.

Deploying the App

To deploy your infrastructure, follow the below steps.


  1. Install Pulumi
  2. Configure AWS Credentials


After cloning this repo, from this working directory, run these commands:

  1. Create a new stack, which is an isolated deployment target for this example:

    $ pulumi stack init
  2. Set the required configuration variables for this program:

    $ pulumi config set aws:region us-east-1
  3. Stand up the VM, which will also boot up your Python web server on port 80:

    $ pulumi up
  4. After a couple minutes, your VM will be ready, and two stack outputs are printed:

    $ pulumi stack output
    Current stack outputs (2):
    OUTPUT          VALUE
  5. Thanks to the security group making port 80 accessible to the CIDR block, we can curl it:

    $ curl $(pulumi stack output publicIp)
    Hello, World!
  6. From there, feel free to experiment. Simply making edits and running pulumi up will incrementally update your VM.

  7. Afterwards, destroy your stack and remove it:

    $ pulumi destroy --yes
    $ pulumi stack rm --yes