Viewing docs for AWS API Gateway v3.0.0
published on Tuesday, Jul 22, 2025 by Pulumi
published on Tuesday, Jul 22, 2025 by Pulumi
AWS API Gateway
I want to use the Pulumi AWS API Gateway package (aws-apigateway) in my project.
## Provider details
- Package: aws-apigateway
- Version: v3.0.0
- Publisher: Pulumi
- Source: pulumi
- Repository: https://github.com/pulumi/pulumi-aws-apigateway
## Documentation
The Pulumi Cloud Registry API serves canonical, up-to-date docs for this package — including private packages and every published version. Send the "Accept: text/markdown" header for clean readable content, or "application/json" for structured data.
Start at the navigation tree, which cross-links to the readme, installation guide, and per-resource docs URL template:
- https://api.pulumi.com/api/registry/packages/pulumi/pulumi/aws-apigateway/versions/latest/nav
Returns a summary by default. The full tree can be hundreds of kB for large providers, so prefer targeted search: append "?q=<query>&depth=full" to filter by resource/function title or token (for example "?q=bucket&depth=full"). Only request the full nav without a query if you actually need to enumerate every resource.
Other endpoints:
- Overview and getting started: https://api.pulumi.com/api/registry/packages/pulumi/pulumi/aws-apigateway/versions/latest/readme
- Installation and configuration: https://api.pulumi.com/api/registry/packages/pulumi/pulumi/aws-apigateway/versions/latest/installation
- Per-resource/function docs: https://api.pulumi.com/api/registry/packages/pulumi/pulumi/aws-apigateway/versions/latest/docs/{token}?lang={lang}
Replace {token} with the percent-encoded token from the nav response (for example aws:s3/bucket:Bucket).
Replace {lang} with typescript, python, go, csharp, java, or yaml.
Fetch the installation endpoint above for the correct setup steps — install instructions vary between native providers, bridged Terraform providers, and component packages.
Help me get started using this provider. Show me a complete Pulumi program that provisions a common resource, including all necessary configuration and imports.
Viewing docs for AWS API Gateway v3.0.0
published on Tuesday, Jul 22, 2025 by Pulumi
published on Tuesday, Jul 22, 2025 by Pulumi
Easily create AWS API Gateway REST APIs using Pulumi. This component provides higher-level abstractions documented in the Pulumi AWS API Gateway guide as a package available in all Pulumi languages.
Example:
import * as apigateway from "@pulumi/aws-apigateway";
import * as aws from "@pulumi/aws";
const f = new aws.lambda.CallbackFunction("f", {
callback: async (ev, ctx) => {
console.log(JSON.stringify(ev));
return {
statusCode: 200,
body: "goodbye",
};
},
});
const api = new apigateway.RestAPI("api", {
routes: [{
path: "/",
method: "GET",
eventHandler: f,
}],
});
export const url = api.url;
import json
import pulumi
import pulumi_aws as aws
import pulumi_aws_apigateway as apigateway
role = aws.iam.Role("mylambda-role",
assume_role_policy=json.dumps({
"Version": "2012-10-17",
"Statement": [{
"Effect": "Allow",
"Principal": { "Service": "lambda.amazonaws.com" },
"Action": "sts:AssumeRole"
}]
})
)
policy = aws.iam.RolePolicy("mylambda-policy",
role=role.id,
policy=json.dumps({
"Version": "2012-10-17",
"Statement": [{
"Action": ["logs:*", "cloudwatch:*"],
"Resource": "*",
"Effect": "Allow",
}],
}))
# Closure serialization is not supported in multi-lang components
# so we need to provide a handler function explicitly from the file-system.
# Refer to https://github.com/pulumi/pulumi-aws-apigateway/tree/main/examples/simple-py/handler
# for an example handler.
f = aws.lambda_.Function("mylambda",
runtime=aws.lambda_.Runtime.PYTHON3D8,
code=pulumi.AssetArchive({
".": pulumi.FileArchive("./handler"),
}),
timeout=300,
handler="handler.handler",
role=role.arn,
opts=pulumi.ResourceOptions(depends_on=[policy]),
)
api = apigateway.RestAPI('api', routes=[
apigateway.RouteArgs(path="/", method="GET", event_handler=f),
])
pulumi.export('url', api.url)
using Pulumi;
using System.Collections.Generic;
using ApiGW = Pulumi.AwsApiGateway;
using Lambda = Pulumi.Aws.Lambda;
using Iam = Pulumi.Aws.Iam;
class MyStack : Stack
{
public MyStack()
{
var lambdaRole = new Iam.Role("mylambda-role", new Iam.RoleArgs
{
AssumeRolePolicy =
@"{
""Version"": ""2012-10-17"",
""Statement"": [{
""Effect"": ""Allow"",
""Principal"": { ""Service"": ""lambda.amazonaws.com"" },
""Action"": ""sts:AssumeRole""
}]
}"
});
var rolePolicy = new Iam.RolePolicy("mylambda-policy", new Iam.RolePolicyArgs
{
Role = lambdaRole.Id,
Policy =
@"{
""Version"": ""2012-10-17"",
""Statement"": [{
""Action"": [""logs:*"", ""cloudwatch:*""],
""Resource"": ""*"",
""Effect"": ""Allow""
}]
}"
});
// Closure serialization is not supported in multi-lang components
// so we need to provide a handler function explicitly from the file-system.
// Refer to https://github.com/pulumi/pulumi-aws-apigateway/tree/main/examples/simple-cs/handler
// for an example handler.
var lambda = new Lambda.Function("lambda", new Lambda.FunctionArgs
{
Runtime = Lambda.Runtime.Python3d8,
Code = new AssetArchive(new Dictionary<string, AssetOrArchive>{
["."] = new FileArchive("./handler"),
}),
Timeout = 300,
Handler = "handler.handler",
Role = lambdaRole.Arn
}, new Pulumi.CustomResourceOptions { DependsOn = { rolePolicy } });
var restAPI = new ApiGW.RestAPI("api", new ApiGW.RestAPIArgs
{
Routes = new List<ApiGW.Inputs.RouteArgs>{
new ApiGW.Inputs.RouteArgs{Path="/", Method=ApiGW.Method.GET, EventHandler=lambda}}
});
this.Url = restAPI.Url;
}
[Output]
public Output<string> Url { get; set; }
}
package main
import (
apigateway "github.com/pulumi/pulumi-aws-apigateway/sdk/go/apigateway"
"github.com/pulumi/pulumi-aws/sdk/v4/go/aws/iam"
"github.com/pulumi/pulumi-aws/sdk/v4/go/aws/lambda"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
role, err := iam.NewRole(ctx, "lambda-role", &iam.RoleArgs{
AssumeRolePolicy: pulumi.String(`{
"Version": "2012-10-17",
"Statement": [{
"Effect": "Allow",
"Principal": { "Service": "lambda.amazonaws.com" },
"Action": "sts:AssumeRole"
}]
}`),
})
if err != nil {
return err
}
policy, err := iam.NewRolePolicy(ctx, "lambda-policy", &iam.RolePolicyArgs{
Role: role.ID(),
Policy: pulumi.String(`{
"Version": "2012-10-17",
"Statement": [{
"Action": ["logs:*", "cloudwatch:*"],
"Resource": "*",
"Effect": "Allow"
}]
}`),
})
if err != nil {
return err
}
// Closure serialization is not supported in multi-lang components
// so we need to provide a handler function explicitly from the file-system.
// Refer to https://github.com/pulumi/pulumi-aws-apigateway/tree/main/examples/simple-go/handler
// for an example handler.
f, err := lambda.NewFunction(ctx, "lambda", &lambda.FunctionArgs{
Runtime: lambda.RuntimePython3d8,
Code: pulumi.NewAssetArchive(map[string]interface{}{
".": pulumi.NewFileArchive("./handler"),
}),
Timeout: pulumi.Int(300),
Handler: pulumi.String("handler.handler"),
Role: role.Arn,
}, pulumi.DependsOn([]pulumi.Resource{policy}))
if err != nil {
return err
}
getMethod := apigateway.MethodGET
restAPI, err := apigateway.NewRestAPI(ctx, "api", &apigateway.RestAPIArgs{
Routes: []apigateway.RouteArgs{
apigateway.RouteArgs{
Path: "/",
Method: &getMethod,
EventHandler: f,
},
},
})
if err != nil {
return err
}
ctx.Export("url", restAPI.Url)
return nil
})
}
Viewing docs for AWS API Gateway v3.0.0
published on Tuesday, Jul 22, 2025 by Pulumi
published on Tuesday, Jul 22, 2025 by Pulumi
