1. Packages
  2. AWS Classic
  3. API Docs
  4. apigatewayv2
  5. Route

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.42.0 published on Wednesday, Jun 26, 2024 by Pulumi

aws.apigatewayv2.Route

Explore with Pulumi AI

aws logo

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.42.0 published on Wednesday, Jun 26, 2024 by Pulumi

    Manages an Amazon API Gateway Version 2 route. More information can be found in the Amazon API Gateway Developer Guide for WebSocket and HTTP APIs.

    Example Usage

    Basic

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const example = new aws.apigatewayv2.Api("example", {
        name: "example-websocket-api",
        protocolType: "WEBSOCKET",
        routeSelectionExpression: "$request.body.action",
    });
    const exampleRoute = new aws.apigatewayv2.Route("example", {
        apiId: example.id,
        routeKey: "$default",
    });
    
    import pulumi
    import pulumi_aws as aws
    
    example = aws.apigatewayv2.Api("example",
        name="example-websocket-api",
        protocol_type="WEBSOCKET",
        route_selection_expression="$request.body.action")
    example_route = aws.apigatewayv2.Route("example",
        api_id=example.id,
        route_key="$default")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := apigatewayv2.NewApi(ctx, "example", &apigatewayv2.ApiArgs{
    			Name:                     pulumi.String("example-websocket-api"),
    			ProtocolType:             pulumi.String("WEBSOCKET"),
    			RouteSelectionExpression: pulumi.String("$request.body.action"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = apigatewayv2.NewRoute(ctx, "example", &apigatewayv2.RouteArgs{
    			ApiId:    example.ID(),
    			RouteKey: pulumi.String("$default"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Aws.ApiGatewayV2.Api("example", new()
        {
            Name = "example-websocket-api",
            ProtocolType = "WEBSOCKET",
            RouteSelectionExpression = "$request.body.action",
        });
    
        var exampleRoute = new Aws.ApiGatewayV2.Route("example", new()
        {
            ApiId = example.Id,
            RouteKey = "$default",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.apigatewayv2.Api;
    import com.pulumi.aws.apigatewayv2.ApiArgs;
    import com.pulumi.aws.apigatewayv2.Route;
    import com.pulumi.aws.apigatewayv2.RouteArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            var example = new Api("example", ApiArgs.builder()
                .name("example-websocket-api")
                .protocolType("WEBSOCKET")
                .routeSelectionExpression("$request.body.action")
                .build());
    
            var exampleRoute = new Route("exampleRoute", RouteArgs.builder()
                .apiId(example.id())
                .routeKey("$default")
                .build());
    
        }
    }
    
    resources:
      example:
        type: aws:apigatewayv2:Api
        properties:
          name: example-websocket-api
          protocolType: WEBSOCKET
          routeSelectionExpression: $request.body.action
      exampleRoute:
        type: aws:apigatewayv2:Route
        name: example
        properties:
          apiId: ${example.id}
          routeKey: $default
    

    HTTP Proxy Integration

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const example = new aws.apigatewayv2.Api("example", {
        name: "example-http-api",
        protocolType: "HTTP",
    });
    const exampleIntegration = new aws.apigatewayv2.Integration("example", {
        apiId: example.id,
        integrationType: "HTTP_PROXY",
        integrationMethod: "ANY",
        integrationUri: "https://example.com/{proxy}",
    });
    const exampleRoute = new aws.apigatewayv2.Route("example", {
        apiId: example.id,
        routeKey: "ANY /example/{proxy+}",
        target: pulumi.interpolate`integrations/${exampleIntegration.id}`,
    });
    
    import pulumi
    import pulumi_aws as aws
    
    example = aws.apigatewayv2.Api("example",
        name="example-http-api",
        protocol_type="HTTP")
    example_integration = aws.apigatewayv2.Integration("example",
        api_id=example.id,
        integration_type="HTTP_PROXY",
        integration_method="ANY",
        integration_uri="https://example.com/{proxy}")
    example_route = aws.apigatewayv2.Route("example",
        api_id=example.id,
        route_key="ANY /example/{proxy+}",
        target=example_integration.id.apply(lambda id: f"integrations/{id}"))
    
    package main
    
    import (
    	"fmt"
    
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := apigatewayv2.NewApi(ctx, "example", &apigatewayv2.ApiArgs{
    			Name:         pulumi.String("example-http-api"),
    			ProtocolType: pulumi.String("HTTP"),
    		})
    		if err != nil {
    			return err
    		}
    		exampleIntegration, err := apigatewayv2.NewIntegration(ctx, "example", &apigatewayv2.IntegrationArgs{
    			ApiId:             example.ID(),
    			IntegrationType:   pulumi.String("HTTP_PROXY"),
    			IntegrationMethod: pulumi.String("ANY"),
    			IntegrationUri:    pulumi.String("https://example.com/{proxy}"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = apigatewayv2.NewRoute(ctx, "example", &apigatewayv2.RouteArgs{
    			ApiId:    example.ID(),
    			RouteKey: pulumi.String("ANY /example/{proxy+}"),
    			Target: exampleIntegration.ID().ApplyT(func(id string) (string, error) {
    				return fmt.Sprintf("integrations/%v", id), nil
    			}).(pulumi.StringOutput),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Aws.ApiGatewayV2.Api("example", new()
        {
            Name = "example-http-api",
            ProtocolType = "HTTP",
        });
    
        var exampleIntegration = new Aws.ApiGatewayV2.Integration("example", new()
        {
            ApiId = example.Id,
            IntegrationType = "HTTP_PROXY",
            IntegrationMethod = "ANY",
            IntegrationUri = "https://example.com/{proxy}",
        });
    
        var exampleRoute = new Aws.ApiGatewayV2.Route("example", new()
        {
            ApiId = example.Id,
            RouteKey = "ANY /example/{proxy+}",
            Target = exampleIntegration.Id.Apply(id => $"integrations/{id}"),
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.apigatewayv2.Api;
    import com.pulumi.aws.apigatewayv2.ApiArgs;
    import com.pulumi.aws.apigatewayv2.Integration;
    import com.pulumi.aws.apigatewayv2.IntegrationArgs;
    import com.pulumi.aws.apigatewayv2.Route;
    import com.pulumi.aws.apigatewayv2.RouteArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            var example = new Api("example", ApiArgs.builder()
                .name("example-http-api")
                .protocolType("HTTP")
                .build());
    
            var exampleIntegration = new Integration("exampleIntegration", IntegrationArgs.builder()
                .apiId(example.id())
                .integrationType("HTTP_PROXY")
                .integrationMethod("ANY")
                .integrationUri("https://example.com/{proxy}")
                .build());
    
            var exampleRoute = new Route("exampleRoute", RouteArgs.builder()
                .apiId(example.id())
                .routeKey("ANY /example/{proxy+}")
                .target(exampleIntegration.id().applyValue(id -> String.format("integrations/%s", id)))
                .build());
    
        }
    }
    
    resources:
      example:
        type: aws:apigatewayv2:Api
        properties:
          name: example-http-api
          protocolType: HTTP
      exampleIntegration:
        type: aws:apigatewayv2:Integration
        name: example
        properties:
          apiId: ${example.id}
          integrationType: HTTP_PROXY
          integrationMethod: ANY
          integrationUri: https://example.com/{proxy}
      exampleRoute:
        type: aws:apigatewayv2:Route
        name: example
        properties:
          apiId: ${example.id}
          routeKey: ANY /example/{proxy+}
          target: integrations/${exampleIntegration.id}
    

    Create Route Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new Route(name: string, args: RouteArgs, opts?: CustomResourceOptions);
    @overload
    def Route(resource_name: str,
              args: RouteArgs,
              opts: Optional[ResourceOptions] = None)
    
    @overload
    def Route(resource_name: str,
              opts: Optional[ResourceOptions] = None,
              api_id: Optional[str] = None,
              route_key: Optional[str] = None,
              api_key_required: Optional[bool] = None,
              authorization_scopes: Optional[Sequence[str]] = None,
              authorization_type: Optional[str] = None,
              authorizer_id: Optional[str] = None,
              model_selection_expression: Optional[str] = None,
              operation_name: Optional[str] = None,
              request_models: Optional[Mapping[str, str]] = None,
              request_parameters: Optional[Sequence[RouteRequestParameterArgs]] = None,
              route_response_selection_expression: Optional[str] = None,
              target: Optional[str] = None)
    func NewRoute(ctx *Context, name string, args RouteArgs, opts ...ResourceOption) (*Route, error)
    public Route(string name, RouteArgs args, CustomResourceOptions? opts = null)
    public Route(String name, RouteArgs args)
    public Route(String name, RouteArgs args, CustomResourceOptions options)
    
    type: aws:apigatewayv2:Route
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args RouteArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args RouteArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args RouteArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args RouteArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args RouteArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var routeResource = new Aws.ApiGatewayV2.Route("routeResource", new()
    {
        ApiId = "string",
        RouteKey = "string",
        ApiKeyRequired = false,
        AuthorizationScopes = new[]
        {
            "string",
        },
        AuthorizationType = "string",
        AuthorizerId = "string",
        ModelSelectionExpression = "string",
        OperationName = "string",
        RequestModels = 
        {
            { "string", "string" },
        },
        RequestParameters = new[]
        {
            new Aws.ApiGatewayV2.Inputs.RouteRequestParameterArgs
            {
                RequestParameterKey = "string",
                Required = false,
            },
        },
        RouteResponseSelectionExpression = "string",
        Target = "string",
    });
    
    example, err := apigatewayv2.NewRoute(ctx, "routeResource", &apigatewayv2.RouteArgs{
    	ApiId:          pulumi.String("string"),
    	RouteKey:       pulumi.String("string"),
    	ApiKeyRequired: pulumi.Bool(false),
    	AuthorizationScopes: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	AuthorizationType:        pulumi.String("string"),
    	AuthorizerId:             pulumi.String("string"),
    	ModelSelectionExpression: pulumi.String("string"),
    	OperationName:            pulumi.String("string"),
    	RequestModels: pulumi.StringMap{
    		"string": pulumi.String("string"),
    	},
    	RequestParameters: apigatewayv2.RouteRequestParameterArray{
    		&apigatewayv2.RouteRequestParameterArgs{
    			RequestParameterKey: pulumi.String("string"),
    			Required:            pulumi.Bool(false),
    		},
    	},
    	RouteResponseSelectionExpression: pulumi.String("string"),
    	Target:                           pulumi.String("string"),
    })
    
    var routeResource = new Route("routeResource", RouteArgs.builder()
        .apiId("string")
        .routeKey("string")
        .apiKeyRequired(false)
        .authorizationScopes("string")
        .authorizationType("string")
        .authorizerId("string")
        .modelSelectionExpression("string")
        .operationName("string")
        .requestModels(Map.of("string", "string"))
        .requestParameters(RouteRequestParameterArgs.builder()
            .requestParameterKey("string")
            .required(false)
            .build())
        .routeResponseSelectionExpression("string")
        .target("string")
        .build());
    
    route_resource = aws.apigatewayv2.Route("routeResource",
        api_id="string",
        route_key="string",
        api_key_required=False,
        authorization_scopes=["string"],
        authorization_type="string",
        authorizer_id="string",
        model_selection_expression="string",
        operation_name="string",
        request_models={
            "string": "string",
        },
        request_parameters=[{
            "requestParameterKey": "string",
            "required": False,
        }],
        route_response_selection_expression="string",
        target="string")
    
    const routeResource = new aws.apigatewayv2.Route("routeResource", {
        apiId: "string",
        routeKey: "string",
        apiKeyRequired: false,
        authorizationScopes: ["string"],
        authorizationType: "string",
        authorizerId: "string",
        modelSelectionExpression: "string",
        operationName: "string",
        requestModels: {
            string: "string",
        },
        requestParameters: [{
            requestParameterKey: "string",
            required: false,
        }],
        routeResponseSelectionExpression: "string",
        target: "string",
    });
    
    type: aws:apigatewayv2:Route
    properties:
        apiId: string
        apiKeyRequired: false
        authorizationScopes:
            - string
        authorizationType: string
        authorizerId: string
        modelSelectionExpression: string
        operationName: string
        requestModels:
            string: string
        requestParameters:
            - requestParameterKey: string
              required: false
        routeKey: string
        routeResponseSelectionExpression: string
        target: string
    

    Route Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The Route resource accepts the following input properties:

    ApiId string
    API identifier.
    RouteKey string
    Route key for the route. For HTTP APIs, the route key can be either $default, or a combination of an HTTP method and resource path, for example, GET /pets.
    ApiKeyRequired bool
    Boolean whether an API key is required for the route. Defaults to false. Supported only for WebSocket APIs.
    AuthorizationScopes List<string>
    Authorization scopes supported by this route. The scopes are used with a JWT authorizer to authorize the method invocation.
    AuthorizationType string
    Authorization type for the route. For WebSocket APIs, valid values are NONE for open access, AWS_IAM for using AWS IAM permissions, and CUSTOM for using a Lambda authorizer. For HTTP APIs, valid values are NONE for open access, JWT for using JSON Web Tokens, AWS_IAM for using AWS IAM permissions, and CUSTOM for using a Lambda authorizer. Defaults to NONE.
    AuthorizerId string
    Identifier of the aws.apigatewayv2.Authorizer resource to be associated with this route.
    ModelSelectionExpression string
    The model selection expression for the route. Supported only for WebSocket APIs.
    OperationName string
    Operation name for the route. Must be between 1 and 64 characters in length.
    RequestModels Dictionary<string, string>
    Request models for the route. Supported only for WebSocket APIs.
    RequestParameters List<RouteRequestParameter>
    Request parameters for the route. Supported only for WebSocket APIs.
    RouteResponseSelectionExpression string
    The route response selection expression for the route. Supported only for WebSocket APIs.
    Target string
    Target for the route, of the form integrations/IntegrationID, where IntegrationID is the identifier of an aws.apigatewayv2.Integration resource.
    ApiId string
    API identifier.
    RouteKey string
    Route key for the route. For HTTP APIs, the route key can be either $default, or a combination of an HTTP method and resource path, for example, GET /pets.
    ApiKeyRequired bool
    Boolean whether an API key is required for the route. Defaults to false. Supported only for WebSocket APIs.
    AuthorizationScopes []string
    Authorization scopes supported by this route. The scopes are used with a JWT authorizer to authorize the method invocation.
    AuthorizationType string
    Authorization type for the route. For WebSocket APIs, valid values are NONE for open access, AWS_IAM for using AWS IAM permissions, and CUSTOM for using a Lambda authorizer. For HTTP APIs, valid values are NONE for open access, JWT for using JSON Web Tokens, AWS_IAM for using AWS IAM permissions, and CUSTOM for using a Lambda authorizer. Defaults to NONE.
    AuthorizerId string
    Identifier of the aws.apigatewayv2.Authorizer resource to be associated with this route.
    ModelSelectionExpression string
    The model selection expression for the route. Supported only for WebSocket APIs.
    OperationName string
    Operation name for the route. Must be between 1 and 64 characters in length.
    RequestModels map[string]string
    Request models for the route. Supported only for WebSocket APIs.
    RequestParameters []RouteRequestParameterArgs
    Request parameters for the route. Supported only for WebSocket APIs.
    RouteResponseSelectionExpression string
    The route response selection expression for the route. Supported only for WebSocket APIs.
    Target string
    Target for the route, of the form integrations/IntegrationID, where IntegrationID is the identifier of an aws.apigatewayv2.Integration resource.
    apiId String
    API identifier.
    routeKey String
    Route key for the route. For HTTP APIs, the route key can be either $default, or a combination of an HTTP method and resource path, for example, GET /pets.
    apiKeyRequired Boolean
    Boolean whether an API key is required for the route. Defaults to false. Supported only for WebSocket APIs.
    authorizationScopes List<String>
    Authorization scopes supported by this route. The scopes are used with a JWT authorizer to authorize the method invocation.
    authorizationType String
    Authorization type for the route. For WebSocket APIs, valid values are NONE for open access, AWS_IAM for using AWS IAM permissions, and CUSTOM for using a Lambda authorizer. For HTTP APIs, valid values are NONE for open access, JWT for using JSON Web Tokens, AWS_IAM for using AWS IAM permissions, and CUSTOM for using a Lambda authorizer. Defaults to NONE.
    authorizerId String
    Identifier of the aws.apigatewayv2.Authorizer resource to be associated with this route.
    modelSelectionExpression String
    The model selection expression for the route. Supported only for WebSocket APIs.
    operationName String
    Operation name for the route. Must be between 1 and 64 characters in length.
    requestModels Map<String,String>
    Request models for the route. Supported only for WebSocket APIs.
    requestParameters List<RouteRequestParameter>
    Request parameters for the route. Supported only for WebSocket APIs.
    routeResponseSelectionExpression String
    The route response selection expression for the route. Supported only for WebSocket APIs.
    target String
    Target for the route, of the form integrations/IntegrationID, where IntegrationID is the identifier of an aws.apigatewayv2.Integration resource.
    apiId string
    API identifier.
    routeKey string
    Route key for the route. For HTTP APIs, the route key can be either $default, or a combination of an HTTP method and resource path, for example, GET /pets.
    apiKeyRequired boolean
    Boolean whether an API key is required for the route. Defaults to false. Supported only for WebSocket APIs.
    authorizationScopes string[]
    Authorization scopes supported by this route. The scopes are used with a JWT authorizer to authorize the method invocation.
    authorizationType string
    Authorization type for the route. For WebSocket APIs, valid values are NONE for open access, AWS_IAM for using AWS IAM permissions, and CUSTOM for using a Lambda authorizer. For HTTP APIs, valid values are NONE for open access, JWT for using JSON Web Tokens, AWS_IAM for using AWS IAM permissions, and CUSTOM for using a Lambda authorizer. Defaults to NONE.
    authorizerId string
    Identifier of the aws.apigatewayv2.Authorizer resource to be associated with this route.
    modelSelectionExpression string
    The model selection expression for the route. Supported only for WebSocket APIs.
    operationName string
    Operation name for the route. Must be between 1 and 64 characters in length.
    requestModels {[key: string]: string}
    Request models for the route. Supported only for WebSocket APIs.
    requestParameters RouteRequestParameter[]
    Request parameters for the route. Supported only for WebSocket APIs.
    routeResponseSelectionExpression string
    The route response selection expression for the route. Supported only for WebSocket APIs.
    target string
    Target for the route, of the form integrations/IntegrationID, where IntegrationID is the identifier of an aws.apigatewayv2.Integration resource.
    api_id str
    API identifier.
    route_key str
    Route key for the route. For HTTP APIs, the route key can be either $default, or a combination of an HTTP method and resource path, for example, GET /pets.
    api_key_required bool
    Boolean whether an API key is required for the route. Defaults to false. Supported only for WebSocket APIs.
    authorization_scopes Sequence[str]
    Authorization scopes supported by this route. The scopes are used with a JWT authorizer to authorize the method invocation.
    authorization_type str
    Authorization type for the route. For WebSocket APIs, valid values are NONE for open access, AWS_IAM for using AWS IAM permissions, and CUSTOM for using a Lambda authorizer. For HTTP APIs, valid values are NONE for open access, JWT for using JSON Web Tokens, AWS_IAM for using AWS IAM permissions, and CUSTOM for using a Lambda authorizer. Defaults to NONE.
    authorizer_id str
    Identifier of the aws.apigatewayv2.Authorizer resource to be associated with this route.
    model_selection_expression str
    The model selection expression for the route. Supported only for WebSocket APIs.
    operation_name str
    Operation name for the route. Must be between 1 and 64 characters in length.
    request_models Mapping[str, str]
    Request models for the route. Supported only for WebSocket APIs.
    request_parameters Sequence[RouteRequestParameterArgs]
    Request parameters for the route. Supported only for WebSocket APIs.
    route_response_selection_expression str
    The route response selection expression for the route. Supported only for WebSocket APIs.
    target str
    Target for the route, of the form integrations/IntegrationID, where IntegrationID is the identifier of an aws.apigatewayv2.Integration resource.
    apiId String
    API identifier.
    routeKey String
    Route key for the route. For HTTP APIs, the route key can be either $default, or a combination of an HTTP method and resource path, for example, GET /pets.
    apiKeyRequired Boolean
    Boolean whether an API key is required for the route. Defaults to false. Supported only for WebSocket APIs.
    authorizationScopes List<String>
    Authorization scopes supported by this route. The scopes are used with a JWT authorizer to authorize the method invocation.
    authorizationType String
    Authorization type for the route. For WebSocket APIs, valid values are NONE for open access, AWS_IAM for using AWS IAM permissions, and CUSTOM for using a Lambda authorizer. For HTTP APIs, valid values are NONE for open access, JWT for using JSON Web Tokens, AWS_IAM for using AWS IAM permissions, and CUSTOM for using a Lambda authorizer. Defaults to NONE.
    authorizerId String
    Identifier of the aws.apigatewayv2.Authorizer resource to be associated with this route.
    modelSelectionExpression String
    The model selection expression for the route. Supported only for WebSocket APIs.
    operationName String
    Operation name for the route. Must be between 1 and 64 characters in length.
    requestModels Map<String>
    Request models for the route. Supported only for WebSocket APIs.
    requestParameters List<Property Map>
    Request parameters for the route. Supported only for WebSocket APIs.
    routeResponseSelectionExpression String
    The route response selection expression for the route. Supported only for WebSocket APIs.
    target String
    Target for the route, of the form integrations/IntegrationID, where IntegrationID is the identifier of an aws.apigatewayv2.Integration resource.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the Route resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing Route Resource

    Get an existing Route resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: RouteState, opts?: CustomResourceOptions): Route
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            api_id: Optional[str] = None,
            api_key_required: Optional[bool] = None,
            authorization_scopes: Optional[Sequence[str]] = None,
            authorization_type: Optional[str] = None,
            authorizer_id: Optional[str] = None,
            model_selection_expression: Optional[str] = None,
            operation_name: Optional[str] = None,
            request_models: Optional[Mapping[str, str]] = None,
            request_parameters: Optional[Sequence[RouteRequestParameterArgs]] = None,
            route_key: Optional[str] = None,
            route_response_selection_expression: Optional[str] = None,
            target: Optional[str] = None) -> Route
    func GetRoute(ctx *Context, name string, id IDInput, state *RouteState, opts ...ResourceOption) (*Route, error)
    public static Route Get(string name, Input<string> id, RouteState? state, CustomResourceOptions? opts = null)
    public static Route get(String name, Output<String> id, RouteState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    ApiId string
    API identifier.
    ApiKeyRequired bool
    Boolean whether an API key is required for the route. Defaults to false. Supported only for WebSocket APIs.
    AuthorizationScopes List<string>
    Authorization scopes supported by this route. The scopes are used with a JWT authorizer to authorize the method invocation.
    AuthorizationType string
    Authorization type for the route. For WebSocket APIs, valid values are NONE for open access, AWS_IAM for using AWS IAM permissions, and CUSTOM for using a Lambda authorizer. For HTTP APIs, valid values are NONE for open access, JWT for using JSON Web Tokens, AWS_IAM for using AWS IAM permissions, and CUSTOM for using a Lambda authorizer. Defaults to NONE.
    AuthorizerId string
    Identifier of the aws.apigatewayv2.Authorizer resource to be associated with this route.
    ModelSelectionExpression string
    The model selection expression for the route. Supported only for WebSocket APIs.
    OperationName string
    Operation name for the route. Must be between 1 and 64 characters in length.
    RequestModels Dictionary<string, string>
    Request models for the route. Supported only for WebSocket APIs.
    RequestParameters List<RouteRequestParameter>
    Request parameters for the route. Supported only for WebSocket APIs.
    RouteKey string
    Route key for the route. For HTTP APIs, the route key can be either $default, or a combination of an HTTP method and resource path, for example, GET /pets.
    RouteResponseSelectionExpression string
    The route response selection expression for the route. Supported only for WebSocket APIs.
    Target string
    Target for the route, of the form integrations/IntegrationID, where IntegrationID is the identifier of an aws.apigatewayv2.Integration resource.
    ApiId string
    API identifier.
    ApiKeyRequired bool
    Boolean whether an API key is required for the route. Defaults to false. Supported only for WebSocket APIs.
    AuthorizationScopes []string
    Authorization scopes supported by this route. The scopes are used with a JWT authorizer to authorize the method invocation.
    AuthorizationType string
    Authorization type for the route. For WebSocket APIs, valid values are NONE for open access, AWS_IAM for using AWS IAM permissions, and CUSTOM for using a Lambda authorizer. For HTTP APIs, valid values are NONE for open access, JWT for using JSON Web Tokens, AWS_IAM for using AWS IAM permissions, and CUSTOM for using a Lambda authorizer. Defaults to NONE.
    AuthorizerId string
    Identifier of the aws.apigatewayv2.Authorizer resource to be associated with this route.
    ModelSelectionExpression string
    The model selection expression for the route. Supported only for WebSocket APIs.
    OperationName string
    Operation name for the route. Must be between 1 and 64 characters in length.
    RequestModels map[string]string
    Request models for the route. Supported only for WebSocket APIs.
    RequestParameters []RouteRequestParameterArgs
    Request parameters for the route. Supported only for WebSocket APIs.
    RouteKey string
    Route key for the route. For HTTP APIs, the route key can be either $default, or a combination of an HTTP method and resource path, for example, GET /pets.
    RouteResponseSelectionExpression string
    The route response selection expression for the route. Supported only for WebSocket APIs.
    Target string
    Target for the route, of the form integrations/IntegrationID, where IntegrationID is the identifier of an aws.apigatewayv2.Integration resource.
    apiId String
    API identifier.
    apiKeyRequired Boolean
    Boolean whether an API key is required for the route. Defaults to false. Supported only for WebSocket APIs.
    authorizationScopes List<String>
    Authorization scopes supported by this route. The scopes are used with a JWT authorizer to authorize the method invocation.
    authorizationType String
    Authorization type for the route. For WebSocket APIs, valid values are NONE for open access, AWS_IAM for using AWS IAM permissions, and CUSTOM for using a Lambda authorizer. For HTTP APIs, valid values are NONE for open access, JWT for using JSON Web Tokens, AWS_IAM for using AWS IAM permissions, and CUSTOM for using a Lambda authorizer. Defaults to NONE.
    authorizerId String
    Identifier of the aws.apigatewayv2.Authorizer resource to be associated with this route.
    modelSelectionExpression String
    The model selection expression for the route. Supported only for WebSocket APIs.
    operationName String
    Operation name for the route. Must be between 1 and 64 characters in length.
    requestModels Map<String,String>
    Request models for the route. Supported only for WebSocket APIs.
    requestParameters List<RouteRequestParameter>
    Request parameters for the route. Supported only for WebSocket APIs.
    routeKey String
    Route key for the route. For HTTP APIs, the route key can be either $default, or a combination of an HTTP method and resource path, for example, GET /pets.
    routeResponseSelectionExpression String
    The route response selection expression for the route. Supported only for WebSocket APIs.
    target String
    Target for the route, of the form integrations/IntegrationID, where IntegrationID is the identifier of an aws.apigatewayv2.Integration resource.
    apiId string
    API identifier.
    apiKeyRequired boolean
    Boolean whether an API key is required for the route. Defaults to false. Supported only for WebSocket APIs.
    authorizationScopes string[]
    Authorization scopes supported by this route. The scopes are used with a JWT authorizer to authorize the method invocation.
    authorizationType string
    Authorization type for the route. For WebSocket APIs, valid values are NONE for open access, AWS_IAM for using AWS IAM permissions, and CUSTOM for using a Lambda authorizer. For HTTP APIs, valid values are NONE for open access, JWT for using JSON Web Tokens, AWS_IAM for using AWS IAM permissions, and CUSTOM for using a Lambda authorizer. Defaults to NONE.
    authorizerId string
    Identifier of the aws.apigatewayv2.Authorizer resource to be associated with this route.
    modelSelectionExpression string
    The model selection expression for the route. Supported only for WebSocket APIs.
    operationName string
    Operation name for the route. Must be between 1 and 64 characters in length.
    requestModels {[key: string]: string}
    Request models for the route. Supported only for WebSocket APIs.
    requestParameters RouteRequestParameter[]
    Request parameters for the route. Supported only for WebSocket APIs.
    routeKey string
    Route key for the route. For HTTP APIs, the route key can be either $default, or a combination of an HTTP method and resource path, for example, GET /pets.
    routeResponseSelectionExpression string
    The route response selection expression for the route. Supported only for WebSocket APIs.
    target string
    Target for the route, of the form integrations/IntegrationID, where IntegrationID is the identifier of an aws.apigatewayv2.Integration resource.
    api_id str
    API identifier.
    api_key_required bool
    Boolean whether an API key is required for the route. Defaults to false. Supported only for WebSocket APIs.
    authorization_scopes Sequence[str]
    Authorization scopes supported by this route. The scopes are used with a JWT authorizer to authorize the method invocation.
    authorization_type str
    Authorization type for the route. For WebSocket APIs, valid values are NONE for open access, AWS_IAM for using AWS IAM permissions, and CUSTOM for using a Lambda authorizer. For HTTP APIs, valid values are NONE for open access, JWT for using JSON Web Tokens, AWS_IAM for using AWS IAM permissions, and CUSTOM for using a Lambda authorizer. Defaults to NONE.
    authorizer_id str
    Identifier of the aws.apigatewayv2.Authorizer resource to be associated with this route.
    model_selection_expression str
    The model selection expression for the route. Supported only for WebSocket APIs.
    operation_name str
    Operation name for the route. Must be between 1 and 64 characters in length.
    request_models Mapping[str, str]
    Request models for the route. Supported only for WebSocket APIs.
    request_parameters Sequence[RouteRequestParameterArgs]
    Request parameters for the route. Supported only for WebSocket APIs.
    route_key str
    Route key for the route. For HTTP APIs, the route key can be either $default, or a combination of an HTTP method and resource path, for example, GET /pets.
    route_response_selection_expression str
    The route response selection expression for the route. Supported only for WebSocket APIs.
    target str
    Target for the route, of the form integrations/IntegrationID, where IntegrationID is the identifier of an aws.apigatewayv2.Integration resource.
    apiId String
    API identifier.
    apiKeyRequired Boolean
    Boolean whether an API key is required for the route. Defaults to false. Supported only for WebSocket APIs.
    authorizationScopes List<String>
    Authorization scopes supported by this route. The scopes are used with a JWT authorizer to authorize the method invocation.
    authorizationType String
    Authorization type for the route. For WebSocket APIs, valid values are NONE for open access, AWS_IAM for using AWS IAM permissions, and CUSTOM for using a Lambda authorizer. For HTTP APIs, valid values are NONE for open access, JWT for using JSON Web Tokens, AWS_IAM for using AWS IAM permissions, and CUSTOM for using a Lambda authorizer. Defaults to NONE.
    authorizerId String
    Identifier of the aws.apigatewayv2.Authorizer resource to be associated with this route.
    modelSelectionExpression String
    The model selection expression for the route. Supported only for WebSocket APIs.
    operationName String
    Operation name for the route. Must be between 1 and 64 characters in length.
    requestModels Map<String>
    Request models for the route. Supported only for WebSocket APIs.
    requestParameters List<Property Map>
    Request parameters for the route. Supported only for WebSocket APIs.
    routeKey String
    Route key for the route. For HTTP APIs, the route key can be either $default, or a combination of an HTTP method and resource path, for example, GET /pets.
    routeResponseSelectionExpression String
    The route response selection expression for the route. Supported only for WebSocket APIs.
    target String
    Target for the route, of the form integrations/IntegrationID, where IntegrationID is the identifier of an aws.apigatewayv2.Integration resource.

    Supporting Types

    RouteRequestParameter, RouteRequestParameterArgs

    RequestParameterKey string
    Request parameter key. This is a request data mapping parameter.
    Required bool
    Boolean whether or not the parameter is required.
    RequestParameterKey string
    Request parameter key. This is a request data mapping parameter.
    Required bool
    Boolean whether or not the parameter is required.
    requestParameterKey String
    Request parameter key. This is a request data mapping parameter.
    required Boolean
    Boolean whether or not the parameter is required.
    requestParameterKey string
    Request parameter key. This is a request data mapping parameter.
    required boolean
    Boolean whether or not the parameter is required.
    request_parameter_key str
    Request parameter key. This is a request data mapping parameter.
    required bool
    Boolean whether or not the parameter is required.
    requestParameterKey String
    Request parameter key. This is a request data mapping parameter.
    required Boolean
    Boolean whether or not the parameter is required.

    Import

    Using pulumi import, import aws_apigatewayv2_route using the API identifier and route identifier. For example:

    $ pulumi import aws:apigatewayv2/route:Route example aabbccddee/1122334
    

    -> Note: The API Gateway managed route created as part of quick_create cannot be imported.

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    AWS Classic pulumi/pulumi-aws
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the aws Terraform Provider.
    aws logo

    Try AWS Native preview for resources not in the classic version.

    AWS Classic v6.42.0 published on Wednesday, Jun 26, 2024 by Pulumi