Skip to content

Adding example of how to do api-gateway lambda integration with integration responses #448

@VladCherniavsky

Description

@VladCherniavsky

❓ Guidance Question

The Question

Environment

  • CDK CLI Version: 1.105.0
  • Language: TypeScript

Other information

I didn't manage to find any examples of how to set integration responses for Lambda Integration
Here I have few lines of code to put you into picture

export class TestStack extends cdk.Stack {

    constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
        super(scope, id, props);

        const testHandler = new lambda.Function(this, 'TestHandler', {
            runtime: lambda.Runtime.NODEJS_14_X,
            code: lambda.Code.fromAsset('lambda'),
            handler: 'hello.handler'
        })

        const api = new apigw.RestApi(this, 'books', {
            restApiName: "Books service",
            description: "This service serves books."
        });

        const integration = new apigw.LambdaIntegration(testHandler, {
            proxy: false,
            allowTestInvoke: true,
        })

        api.root.addMethod('GET', integration)
    }
}

Here I don't see appropriate place where I need to provide integration responses

Metadata

Metadata

Assignees

No one assigned

    Labels

    guidanceQuestion that needs advice or information.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions