Skip to content

Instantly share code, notes, and snippets.

@wreulicke
Created August 22, 2019 15:05
Show Gist options
  • Save wreulicke/7d994f15e58f7828d004fa9e6f66455e to your computer and use it in GitHub Desktop.
Save wreulicke/7d994f15e58f7828d004fa9e6f66455e to your computer and use it in GitHub Desktop.
CDKでAPI Gateway経由でlambdaを叩けるようにするやつ
#!/usr/bin/env node
import 'source-map-support/register';
import {App, Stack} from '@aws-cdk/core';
import {Runtime, Code, Function} from "@aws-cdk/aws-lambda"
import {ApiEventSource} from "@aws-cdk/aws-lambda-event-sources"
const app = new App();
const stack = new Stack(app, "example-stack")
const f = new Function(stack, "example-lambda", {
handler: "main",
code: Code.fromAsset("dist/"),
runtime: Runtime.GO_1_X,
role: role,
})
f.addEventSource(new ApiEventSource("POST", "/"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment