npm i aws-apigateway-manager-r,--region(required) - region to deploy-s,--stage(required) - stage to deploy (ex: dev, prod)--accessKeyId- from AWS credentials--secretAccessKey- from AWS credentials
The tool allows you to use credential file or pass credentials through options during run the tool.
project
├── aws-apigateway
│ ├── stages.json
│ └── swagger.json
└── package.json
This file describes stages and API ID.
{
"restApiId": "xxxxxxxxxx",
"dev": {}
}You can grab restApiId from the address bar.

Also it's possible to pass stage variables.
{
"restApiId": "xxxxxxxxxx",
"dev": {
"stageName": "dev",
"host": "https://dev.server.com"
},
"production": {
"stageName": "prod",
"host": "https://server.com"
}
}The JSON Swagger file that was grabbed from API Gateawy via export:

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 on you using lambdas with aliases and generating arn to grant access so:
arn:aws:lambda:${region}:${accountId}:function:${lambdaName}:${stage}
Your securityDefinitions should look 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",
}Also the tool can substitute placeholders.
For example you can use it 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",
}