🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

@reckon-limited/serverless-duplicate-api-gateway

Package Overview
Dependencies
Maintainers
2
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@reckon-limited/serverless-duplicate-api-gateway

Serverless Plugin that creates a duplicate ApiGateway

1.2.0
latest
Source
npm
Version published
Weekly downloads
24
118.18%
Maintainers
2
Weekly downloads
 
Created
Source

Serverless Duplicate ApiGateway Plugin

This plugin allows you to create a duplicate ApiGateway that points to the same lambda functions.

Only Rest APIs are currently supported.

Our use case for this plugin was to create identical Gateways to our APIs which could only be used with mTLS to allow internal access without requiring user authentication.

Installation

npm install --save-dev @reckon-limited/serverless-duplicate-api-gateway

Add the plugin to serverless.yml:

plugins:
  - '@reckon-limited/serverless-duplicate-api-gateway'

Usage

Define config for the duplicate ApiGateway in the custom property of the serverless.yml

custom:
  duplicate-api:
    duplicateApiNameSuffix: 'duplicate'
    removeAuthorization: true
    removeApiKeysAndUsagePlans: true
    disableDefaultEndpoint: true
Parameter NameDefault ValueDescription
duplicateApiNameSuffixduplicateThe string that is appended to the name of the duplicate ApiGateway. A - is used as a separator between the original name and the string. e.g Original: test-api, duplicateApiNameSuffix: duplicate, New API name: test-api-duplicate
removeAuthorizationfalseIf set to true will remove Authorizers from the duplicate ApiGateway and change all methods to use Authorization:'NONE'
removeApiKeysAndUsagePlansfalseIf set to true will remove Api Keys, Usage Plans and Usage Plan Keys from the duplicate ApiGateway and change all methods to use ApiKeyRequired: false
disableDefaultEndpointfalseIf set to true will remove disable the default endpoint of the duplicate ApiGateway.

Referencing Duplicate Resources

All duplicate resources have Duplicate added to the end of the name.

For example if you have a custom resource to create an API Base Path Mapping:

ApiGatewayBasePathMapping:
    Type: AWS::ApiGateway::BasePathMapping
    Properties:
      DomainName: 'domain-name'
      RestApiId:
        Ref: ApiGatewayRestApi
      Stage: ${opt:stage}

If you wanted to create a similar Base Path Mapping for the duplicate ApiGateway:

SecondApiGatewayBasePathMapping:
    Type: AWS::ApiGateway::BasePathMapping
    Properties:
      DomainName: 'domain-name'
      RestApiId:
        Ref: ApiGatewayRestApiDuplicate
      Stage: ${opt:stage}

Keywords

serverless plugin duplicate api

FAQs

Package last updated on 16 Sep 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts