@nona-creative/aws-cdk-api-gateway
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

AWS API Gateway (CDK)

Installation

npm i -S @nona-creative/aws-cdk-api-gateway

Usage

  1. Create the API Gateway stack

    import { ApiGatewayStack } from '@nona-creative/aws-cdk-api-gateway'
    
    this.apiGatewayStack = new ApiGatewayStack(this.scope, `${this.id}-lambda-${this.stage}`, {
      stage: 'test',
    })
  2. Create a Security Group for Lambda on the relevant VPC (if you are using VPC eg. using @nona-creative/aws-cdk-vpc)

    this.vpcStack.createSecurityGroup({
      name: LAMBDA_VPC_SECURITY_GROUP_NAME,
      description: 'Lambda Security Group for app VPC',
    })
  3. You can then attach API Gateway to Lambdas by adding the Lambdas as Resources and Methods on the API Gateway Stack instance, eg.

    const books = this.apiGatewayStack.addResource('books', 'GET', getBooksLambda, this.apiGatewayStack.api.root)
    this.apiGatewayStack.addMethod('POST', createBooksLambda, books)

Readme

Keywords

Package Sidebar

Install

npm i @nona-creative/aws-cdk-api-gateway

Weekly Downloads

0

Version

1.0.2

License

MIT

Unpacked Size

243 kB

Total Files

22

Last publish

Collaborators

  • ian-cawood
  • yesitsdave
  • syntaxza
  • rollyourowned
  • neilrussell6