AWS API Gateway

Pulumi Official
Package maintained by Pulumi
v0.0.7 published on Monday, May 9, 2022 by Pulumi

Easily create AWS API Gateway REST APIs using Pulumi. This component exposes the Crosswalk for AWS functionality documented in the Pulumi AWS API Gateway guide as a package available in all Pulumi languages.


import * as apigateway from "@pulumi/aws-apigateway";
import * as aws from "@pulumi/aws";

// Create a Lambda Function
const f = new aws.lambda.CallbackFunction("f", {
    callback: async (ev, ctx) => {
        return {
            statusCode: 200,
            body: "goodbye",

// Create a REST API that invokes the Lambda Function
const api = new apigateway.RestAPI("api", {
    routes: [{
        path: "/",
        method: "GET",
        eventHandler: f,

export const url = api.url;
# Create a Lambda Function
# f = ...

# Create a REST API that invokes the Lambda Function and uses a few other route kinds
api = apigateway.RestAPI('api', routes=[
    apigateway.RouteArgs(path="/", method="GET", event_handler=f),
    apigateway.RouteArgs(path="/www", method="GET", local_path="www", index=False),
    apigateway.RouteArgs(path="/integration", target=apigateway.TargetArgs(uri="", type="http_proxy"))

pulumi.export('url', api.url)
// Create a Lambda Function
// f, err := ...

// Create a REST API that invokes the Lambda Function
getMethod := apigateway.MethodGET
restAPI, err := apigateway.NewRestAPI(ctx, "api", &apigateway.RestAPIArgs{
    Routes: []apigateway.RouteArgs{
            Path:         "/",
            Method:       &getMethod,
            EventHandler: f,