Try AWS Native preview for resources not in the classic version.
AWS API Gateway V2 HTTP API
Try AWS Native preview for resources not in the classic version.
Set up a HTTP API using AWS API Gateway V2, complete with a route, stage and integration.
Deploying and running the program
Note: some values in this example will be different from run to run. These values are indicated
with ***.
Create a new stack:
$ pulumi stack init http-apiSet the AWS region:
$ pulumi config set aws:region us-east-2Restore NPM modules via
npm installoryarn install.Run
pulumi upto preview and deploy changes:$ pulumi up Previewing update (http-api) ... Updating (http-api) Type Name Status + pulumi:pulumi:Stack aws-ts-apigatewayv2-http-api-http-api created + ├─ aws:apigatewayv2:Api httpApiGateway created + ├─ aws:iam:Role lambdaRole created + ├─ aws:lambda:Function lambdaFunction created + ├─ aws:iam:RolePolicyAttachment lambdaRoleAttachment created + ├─ aws:lambda:Permission lambdaPermission created + ├─ aws:apigatewayv2:Integration lambdaIntegration created + ├─ aws:apigatewayv2:Route apiRoute created + └─ aws:apigatewayv2:Stage apiStage created Outputs: endpoint: "https://****.execute-api.us-east-2.amazonaws.com/http-api" Resources: + 9 created Duration: 33sView the endpoint URL and curl a few routes:
$ pulumi stack output Current stack outputs (1): OUTPUT VALUE endpoint https://***.execute-api.us-east-2.amazonaws.com/http-api $ curl $(pulumi stack output endpoint) Hello, Pulumi!To view the runtime logs of the Lambda function, use the
pulumi logscommand. To get a log stream, usepulumi logs --follow.
Clean up
Run
pulumi destroyto tear down all resources.To delete the stack itself, run
pulumi stack rm. Note that this command deletes all deployment history from the Pulumi console.
Try AWS Native preview for resources not in the classic version.