Skip to content
Branch: master
Find file History
justinvp Remove duplicate template descriptions (#188)
Now that we've released a few versions of the CLI that can fallback to
showing the project description when listing templates in a repo, we can
delete these redundant descriptions from Pulumi.yaml. Older versions of
the CLI will still work -- they'll just show the name of the template
without a description when running a command like:

pulumi new
Latest commit 5c7298c Dec 3, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
index.js Readmes (#84) Jun 15, 2018
package.json Use latest packages for all harnessed examples Nov 9, 2018


Serverless REST API on AWS

A simple REST API that counts the number of times a route has been hit. For a detailed walkthrough of this example, see the article Create a Serverless REST API.

Note: this example uses JavaScript promises, but if you're using Node 8, you can change the code to use async and await.

Deploying and running the program

Note: some values in this example will be different from run to run. These values are indicated with ***.

  1. Create a new stack:

    $ pulumi stack init count-api-testing
  2. Set the AWS region:

    $ pulumi config set aws:region us-west-2
  3. Restore NPM modules via npm install or yarn install.

  4. Run pulumi up to preview and deploy changes:

    $ pulumi up
    Previewing update of stack 'count-api-testing'
    Updating stack 'count-api-testing'
    Performing changes:
        Type                                      Name                                     Status      Info
    +   pulumi:pulumi:Stack                       cloud-js-httpendpoint-count-api-testing  created
    +   ├─ cloud:table:Table                      counterTable                             created
    +   │  └─ aws:dynamodb:Table                  counterTable                             created
    +   └─ cloud:http:HttpEndpoint                hello-world                              created
    +      ├─ cloud:function:Function             hello-world4fcc7b60                      created
    +      │  └─ aws:serverless:Function          hello-world4fcc7b60                      created
    +      │     ├─ aws:iam:Role                  hello-world4fcc7b60                      created
    +      │     ├─ aws:lambda:Function           hello-world4fcc7b60                      created
    +      │     ├─ aws:iam:RolePolicyAttachment  hello-world4fcc7b60-32be53a2             created
    +      │     └─ aws:iam:RolePolicyAttachment  hello-world4fcc7b60-fd1a00e5             created
    +      ├─ aws:apigateway:RestApi              hello-world                              created
    +      ├─ aws:apigateway:Deployment           hello-world                              created
    +      ├─ aws:lambda:Permission               hello-world-4fcc7b60                     created
    +      └─ aws:apigateway:Stage                hello-world                              created
    endpoint: "https://***"
    info: 14 changes performed:
        + 14 resources created
    Update duration: ***
  5. View the endpoint URL and curl a few routes:

    $ pulumi stack output
    Current stack outputs (1):
        OUTPUT            VALUE
        endpoint          https://***
    $ curl $(pulumi stack output endpoint)/hello
    $ curl $(pulumi stack output endpoint)/hello
    $ curl $(pulumi stack output endpoint)/woohoo
  6. To view the runtime logs of the Lambda function, use the pulumi logs command. To get a log stream, use pulumi logs --follow.

Clean up

  1. Run pulumi destroy to tear down all resources.

  2. To delete the stack itself, run pulumi stack rm. Note that this command deletes all deployment history from the Pulumi Console.

You can’t perform that action at this time.