Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
app
.gitignore
Pulumi.pulumi-serverless-dev.yaml
Pulumi.yaml
README.md
index.js
package-lock.json
package.json

README.md

Serverless API with Pulumi

An example that shows how to use the @pulumi/aws-serverless package to easily define API Gateway and Lambda resources.

Setup

  1. Install Pulumi and configure your AWS credentials.

  2. Create a new stack:

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

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

  5. Run pulumi update to preview and deploy changes.

  6. View the endpoint URL and curl a few routes:

    $ pulumi stack output 
    Current stack outputs (1):
        OUTPUT            VALUE
        endpoint          https://5e8xrktey3.execute-api.us-west-2.amazonaws.com/stage/
    
    $ curl $(pulumi stack output endpoint)/hello
    {"route":"hello","count":1}
    $ curl $(pulumi stack output endpoint)/hello
    {"route":"hello","count":2}
    $ curl $(pulumi stack output endpoint)/woohoo
    {"route":"woohoo","count":1}
  7. To view the runtime logs of the Lambda function, use the pulumi logs command. To get a log stream, use pulumi logs --follow.

Cleanup

  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.