npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

bam-lambda

v5.0.0

Published

Serverless framework for AWS Lambda and API Gateway

Downloads

47

Readme

BAM! header bam 💥 npm license

BAM! is a serverless framework that makes it quick (hence, the name) and easy to get small applications up & running using Node.js and Amazon Web Services (AWS). It is optimized for the deployment of AWS Lambda functions integrated with Amazon API Gateway endpoints, but also allows for the creation of Amazon DynamoDB tables, which can help persist data between lambda invocations.

As long as you meet the prerequisites (see below), there is no need to perform any configuration; BAM! presumes some configuration details by default and uses AWS STS to pull in your account number. That said, there is an option to update your default configuration if you'd like to do that.

Assuming you've written a JavaScript file according to the AWS Lambda programming pattern for Node.js, only one command is needed to push it to AWS and integrate it with an API Gateway endpoint.

If you're new to AWS Lambda, we've included templates for common scenarios (see documentation for bam create in the command section below). These will help you handle requests made using a variety of HTTP methods and expose query/path parameters.

For those more familiar with AWS, we did our best to structure BAM! to allow you to work with existing lambdas & make changes to resources using the AWS console (or other frameworks).

Thanks for trying out BAM! We hope you'll like it! 💥

The Team

Takayoshi Sampson Software Engineer New York, NY

Jocie Moore Software Engineer San Francisco, CA

Jason Overby Software Engineer Portland, OR

Getting Started

Prerequisites

  • AWS account
  • AWS CLI
  • Node.js >= 18
  • NPM

BAM! requires that you have an account with AWS and you have set up an AWS CLI configuration on your local machine. If you have not already done so, please visit Configuring the AWS CLI for instructions. BAM! will use the default profile and region you have specified within that profile when interacting with AWS services.

Install BAM!

npm install -g bam-lambda

Commands

BAM! commands conform to the following structure:

bam <commandName> [<name>] [--<flag>]

For all commands, BAM! will look for <name> in your current directory. This can be either a file called <name>.js or a directory called <name> containing a file called <name>.js.


bam config

updates default settings


bam create <name>

creates local file (or directory) based on template

--invoker: creates a local file/directory with lambda templated to invoke another lambda

--html: creates local directory containing index.html, application.js, main.css, and [resourceName].js

--db: creates local file/directory templated to work with a DynamoDB table

--verbose: creates template with instructional comments


bam deploy <name>

deploys lambda + endpoint

--role: specifies role for this deployment

--permitDb: adds policy with scan, put, get, delete DynamoDB permissions

--methods: specifies HTTP method(s) for the endpoint

--lambdaOnly: deploys the lambda without an endpoint


bam redeploy <name>

updates existing lambda and endpoint

--role: specifies role for this deployment

--permitDb: adds policy with scan, put, get, delete DynamoDB permissions

--methods: specifies HTTP method(s) for the endpoint

--rmMethods: specifies a HTTP method or methods to remove from endpoint

--addEndpoint: connects endpoint to lambda

--revokeDb: changes role associated with lambda to role specified in user config

--runtime: changes Node runtime of the lambda


bam delete <name>

deletes existing lambda + endpoint

--dbtable: deletes DynamoDB table

--endpointOnly: deletes endpoint only


bam get <name>

pulls lambda code from AWS into a local directory


bam list

lists lambdas, endpoints, and dbtables

Lambdas and endpoints deployed from this machine using BAM!:
  nameOfLambda1
    description: a description of the lambda
    endpoint: http://associatedEndpoint/bam
    http methods: GET

  nameOfLambda2
    description: a description of the lambda
    endpoint:: http://associatedEndpoint/bam
    http methods: GET, POST, DELETE

Other lambdas on AWS
  anotherLambda
  yetAnotherLambda

DynamoDB tables deployed from this machine using BAM!:
  nameOfTable1
    partition key: id (number)

  nameOfTable2
    partition key: id (number)
    sort key: name (string)

--dbtables: lists only DynamoDB tables created with BAM!

--lambdas: lists only lambdas and associated endpoints


bam dbtable <name>

creates a DynamoDB table [tableName] on AWS


bam --man|help|h

documentation of commands

--<commandName>: logs a description of the command options

--all: logs descriptions of all command options


bam --version|v

displays version


Additional Resources

Release Notes

Version 5.0.0 (November 2023)

  • Updated default Node runtime to nodejs18.x.
  • Added nodejs16.x and nodejs18.x to valid runtimes for Lambda functions.
  • Removed nodejs12.x and nodejs14.x from valid runtimes for Lambda functions because they are no longer supported (https://docs.aws.amazon.com/lambda/latest/dg/runtime-support-policy.html).

Version 4.0.0 (August 2021)

  • Updated default Node runtime to nodejs14.x.
  • Added nodejs12.x to valid runtimes for Lambda functions.
  • Removed nodejs10.x from valid runtimes for Lambda functions because Node 10.x will no longer be supported after July 30, 2021 (https://docs.aws.amazon.com/lambda/latest/dg/runtime-support-policy.html).

Version 3.0.0 (November 2019)

  • Updated the Node runtime to nodejs10.x for newly created lambda functions because Node 8.x is reaching EOL on December 31, 2019 (https://github.com/nodejs/Release).
  • Added a --runtime flag to the redeploy command so that previously created lambda functions can be updated and therefore continued to be maintained after 2019.