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

aws-apigatrway-manager

v0.1.1

Published

???

Downloads

1

Readme

aws-apigateway-manager

Instalation

npm i aws-apigateway-manager

Usage

  • -r, --region (required) - region to deploy
  • -s, --stage (required) - stage to deploy (ex: dev, prod)
  • --accessKeyId - from AWS credentials
  • --secretAccessKey - from AWS credentials

Configuration

The tool allows you to use credential file or pass credentials through options during run the tool.

Project structure

project
├── aws-apigateway
│   ├── stages.json
│   └── swagger.json
└── package.json

stages.json

This file describes stages and API ID.

{
  "restApiId": "xxxxxxxxxx",
  "dev": {}
}

You can grab restApiId from the adress bar. API ID

Also it's possible to pass stage viraables.

{
  "restApiId": "xxxxxxxxxx",
  "dev": {
      "stageName": "dev",
      "host": "https://dev.server.com"
  },
  "production": {
      "stageName": "prod",
      "host": "https://server.com"
  }
}

The result will be like that: API ID

swagger.json

The JSON Swagger file that was grabbed from API Gateawy via export: API ID

What you have to know if you are using custom lambda authorizers. Each lambda with alias have to be permited. And the tool allows you to do it.

The tool rely you are using lambdas with aliases and generate arn to grant access so:

arn:aws:lambda:${region}:${accountId}:function:${lambdaName}:${stage}

Your securityDefinitions should looks like that: Pay attention to dev alias.

"securityDefinitions": {
    "auth1": {
      "x-amazon-apigateway-authorizer": {
        "authorizerUri": "arn:aws:apigateway:west-1:lambda:path/functions/arn:aws:lambda:west-1:accountId:function:lambda-function-name:dev/invocations",
      }
    },
    "auth2": {
    },
  },

Or you can use stageVariables:

"x-amazon-apigateway-authorizer": {
  "authorizerUri": "arn:aws:apigateway:west-1:lambda:path/functions/arn:aws:lambda:west-1:accountId:function:lambda-function-name:${stageVariables.stageName}/invocations",
}
Placeholders

Also the tool can substitute placeholders. You can use it, for instance in authorizerUri.

Placeholders:

  • {{region}} region which was passed via CLI
"x-amazon-apigateway-authorizer": {
  "authorizerUri": "arn:aws:apigateway:{{region}}:lambda:path/functions/arn:aws:lambda:{{region}}:accountId:function:lambda-function-name:${stageVariables.stageName}/invocations",
}