https://pulumi.com logo
#aws
Title
# aws
s

sticky-country-73582

09/08/2022, 7:27 PM
Hi, I'm trying to use Pulumi to create an API Gateway that can call multiple Lambda endpoints, i.e, there is a one-to-one mapping between the path called and the respective Lambda function invoked. Is there any available example in Pulumi documentation for achieving this? I tried using the
body
argument in
apigateway.RestApi
to have OpenAPI specs for each individual path and a corresponding integration under
x-amazon-apigateway-integration
but it gives an error like this -
Unable to put integration on 'POST' for resource at path '/<some>/<path>': Integrations of type 'AWS_PROXY' currently only supports Lambda function and Firehose stream invocations.
s

swift-fireman-31153

09/08/2022, 7:36 PM
Can you just configure a seperate method and integration for each
Copy code
const methodGet = new aws.apigateway.Method("get", {
    restApi: openApiId,
    resourceId: resource.id,
    httpMethod: "GET",
    authorization: "CUSTOM",
    authorizerId: openApiAuthorizorId,
    apiKeyRequired: true,
});

const integration = new aws.apigateway.Integration("integration", {
    restApi: openApiId,
    resourceId: resource.id,
    httpMethod: methodGet.httpMethod,
    integrationHttpMethod: methodGet.httpMethod,
    type: "HTTP_PROXY",
    uri: "<https://httpbin.org/uuid>",
});
s

sticky-country-73582

09/08/2022, 7:49 PM
Yeah that is another way of doing it instead of giving the OpenAPI specs. I would also need to create a specific
Resource
before each right?
s

swift-fireman-31153

09/08/2022, 8:40 PM
yes
or define the shared resource