Namespace Pulumi.Aws.ApiGatewayV2
Classes
Api
Manages an Amazon API Gateway Version 2 API.
Note: Amazon API Gateway Version 2 resources are used for creating and deploying WebSocket and HTTP APIs. To create and deploy REST APIs, use Amazon API Gateway Version 1.
Example Usage
Basic WebSocket API
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var example = new Aws.ApiGatewayV2.Api("example", new Aws.ApiGatewayV2.ApiArgs
{
ProtocolType = "WEBSOCKET",
RouteSelectionExpression = "$$request.body.action",
});
}
}
Basic HTTP API
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var example = new Aws.ApiGatewayV2.Api("example", new Aws.ApiGatewayV2.ApiArgs
{
ProtocolType = "HTTP",
});
}
}
ApiArgs
ApiMapping
Manages an Amazon API Gateway Version 2 API mapping. More information can be found in the Amazon API Gateway Developer Guide.
Example Usage
Basic
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var example = new Aws.ApiGatewayV2.ApiMapping("example", new Aws.ApiGatewayV2.ApiMappingArgs
{
ApiId = aws_apigatewayv2_api.Example.Id,
DomainName = aws_apigatewayv2_domain_name.Example.Id,
Stage = aws_apigatewayv2_stage.Example.Id,
});
}
}
ApiMappingArgs
ApiMappingState
ApiState
Authorizer
Manages an Amazon API Gateway Version 2 authorizer. More information can be found in the Amazon API Gateway Developer Guide.
Example Usage
Basic WebSocket API
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var example = new Aws.ApiGatewayV2.Authorizer("example", new Aws.ApiGatewayV2.AuthorizerArgs
{
ApiId = aws_apigatewayv2_api.Example.Id,
AuthorizerType = "REQUEST",
AuthorizerUri = aws_lambda_function.Example.Invoke_arn,
IdentitySources =
{
"route.request.header.Auth",
},
});
}
}
Basic HTTP API
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var example = new Aws.ApiGatewayV2.Authorizer("example", new Aws.ApiGatewayV2.AuthorizerArgs
{
ApiId = aws_apigatewayv2_api.Example.Id,
AuthorizerType = "JWT",
IdentitySources =
{
"$$request.header.Authorization",
},
JwtConfiguration = new Aws.ApiGatewayV2.Inputs.AuthorizerJwtConfigurationArgs
{
Audience =
{
"example",
},
Issuer = $"https://{aws_cognito_user_pool.Example.Endpoint}",
},
});
}
}
AuthorizerArgs
AuthorizerState
Deployment
Manages an Amazon API Gateway Version 2 deployment. More information can be found in the Amazon API Gateway Developer Guide.
Note: Creating a deployment for an API requires at least one
aws.apigatewayv2.Routeresource associated with that API. To avoid race conditions when all resources are being created together, you need to add implicit resource references via thetriggersargument or explicit resource references using the resourcedependsOnmeta-argument.
Example Usage
Basic
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var example = new Aws.ApiGatewayV2.Deployment("example", new Aws.ApiGatewayV2.DeploymentArgs
{
ApiId = aws_apigatewayv2_route.Example.Api_id,
Description = "Example deployment",
});
}
}
DeploymentArgs
DeploymentState
DomainName
Manages an Amazon API Gateway Version 2 domain name. More information can be found in the Amazon API Gateway Developer Guide.
Note: This resource establishes ownership of and the TLS settings for a particular domain name. An API stage can be associated with the domain name using the
aws.apigatewayv2.ApiMappingresource.
Example Usage
Basic
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var example = new Aws.ApiGatewayV2.DomainName("example", new Aws.ApiGatewayV2.DomainNameArgs
{
DomainName = "ws-api.example.com",
DomainNameConfiguration = new Aws.ApiGatewayV2.Inputs.DomainNameDomainNameConfigurationArgs
{
CertificateArn = aws_acm_certificate.Example.Arn,
EndpointType = "REGIONAL",
SecurityPolicy = "TLS_1_2",
},
});
}
}
DomainNameArgs
DomainNameState
Integration
Manages an Amazon API Gateway Version 2 integration. More information can be found in the Amazon API Gateway Developer Guide.
Example Usage
Basic
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var example = new Aws.ApiGatewayV2.Integration("example", new Aws.ApiGatewayV2.IntegrationArgs
{
ApiId = aws_apigatewayv2_api.Example.Id,
IntegrationType = "MOCK",
});
}
}
Lambda Integration
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var exampleFunction = new Aws.Lambda.Function("exampleFunction", new Aws.Lambda.FunctionArgs
{
Code = new FileArchive("example.zip"),
Handler = "index.handler",
Role = aws_iam_role.Example.Arn,
Runtime = "nodejs10.x",
});
var exampleIntegration = new Aws.ApiGatewayV2.Integration("exampleIntegration", new Aws.ApiGatewayV2.IntegrationArgs
{
ApiId = aws_apigatewayv2_api.Example.Id,
ConnectionType = "INTERNET",
ContentHandlingStrategy = "CONVERT_TO_TEXT",
Description = "Lambda example",
IntegrationMethod = "POST",
IntegrationType = "AWS",
IntegrationUri = exampleFunction.InvokeArn,
PassthroughBehavior = "WHEN_NO_MATCH",
});
}
}
IntegrationArgs
IntegrationResponse
Manages an Amazon API Gateway Version 2 integration response. More information can be found in the Amazon API Gateway Developer Guide.
Example Usage
Basic
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var example = new Aws.ApiGatewayV2.IntegrationResponse("example", new Aws.ApiGatewayV2.IntegrationResponseArgs
{
ApiId = aws_apigatewayv2_api.Example.Id,
IntegrationId = aws_apigatewayv2_integration.Example.Id,
IntegrationResponseKey = "/200/",
});
}
}
IntegrationResponseArgs
IntegrationResponseState
IntegrationState
Model
Manages an Amazon API Gateway Version 2 model.
Example Usage
Basic
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var example = new Aws.ApiGatewayV2.Model("example", new Aws.ApiGatewayV2.ModelArgs
{
ApiId = aws_apigatewayv2_api.Example.Id,
ContentType = "application/json",
Schema = @"{
""$$schema"": ""http://json-schema.org/draft-04/schema#"",
""title"": ""ExampleModel"",
""type"": ""object"",
""properties"": {
""id"": { ""type"": ""string"" }
}
}
",
});
}
}
ModelArgs
ModelState
Route
Manages an Amazon API Gateway Version 2 route. More information can be found in the Amazon API Gateway Developer Guide.
Example Usage
Basic
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var example = new Aws.ApiGatewayV2.Route("example", new Aws.ApiGatewayV2.RouteArgs
{
ApiId = aws_apigatewayv2_api.Example.Id,
RouteKey = "$$default",
});
}
}
RouteArgs
RouteResponse
Manages an Amazon API Gateway Version 2 route response. More information can be found in the Amazon API Gateway Developer Guide.
Example Usage
Basic
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var example = new Aws.ApiGatewayV2.RouteResponse("example", new Aws.ApiGatewayV2.RouteResponseArgs
{
ApiId = aws_apigatewayv2_api.Example.Id,
RouteId = aws_apigatewayv2_route.Example.Id,
RouteResponseKey = "$$default",
});
}
}
RouteResponseArgs
RouteResponseState
RouteState
Stage
Manages an Amazon API Gateway Version 2 stage. More information can be found in the Amazon API Gateway Developer Guide.
Example Usage
Basic
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var example = new Aws.ApiGatewayV2.Stage("example", new Aws.ApiGatewayV2.StageArgs
{
ApiId = aws_apigatewayv2_api.Example.Id,
});
}
}
StageArgs
StageState
VpcLink
Manages an Amazon API Gateway Version 2 VPC Link.
Note: Amazon API Gateway Version 2 VPC Links enable private integrations that connect HTTP APIs to private resources in a VPC. To enable private integration for REST APIs, use the Amazon API Gateway Version 1 VPC Link resource.
Example Usage
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var example = new Aws.ApiGatewayV2.VpcLink("example", new Aws.ApiGatewayV2.VpcLinkArgs
{
SecurityGroupIds =
{
data.Aws_security_group.Example.Id,
},
SubnetIds = data.Aws_subnet_ids.Example.Ids,
Tags =
{
{ "Usage", "example" },
},
});
}
}