aws.apigatewayv2.Api
Explore with Pulumi AI
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 resources.
Example Usage
Basic WebSocket API
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",
});
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")
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 {
		_, 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
		}
		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",
    });
});
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 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());
    }
}
resources:
  example:
    type: aws:apigatewayv2:Api
    properties:
      name: example-websocket-api
      protocolType: WEBSOCKET
      routeSelectionExpression: $request.body.action
Basic HTTP API
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",
});
import pulumi
import pulumi_aws as aws
example = aws.apigatewayv2.Api("example",
    name="example-http-api",
    protocol_type="HTTP")
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 {
		_, err := apigatewayv2.NewApi(ctx, "example", &apigatewayv2.ApiArgs{
			Name:         pulumi.String("example-http-api"),
			ProtocolType: pulumi.String("HTTP"),
		})
		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",
    });
});
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 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());
    }
}
resources:
  example:
    type: aws:apigatewayv2:Api
    properties:
      name: example-http-api
      protocolType: HTTP
Create Api Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Api(name: string, args: ApiArgs, opts?: CustomResourceOptions);@overload
def Api(resource_name: str,
        args: ApiArgs,
        opts: Optional[ResourceOptions] = None)
@overload
def Api(resource_name: str,
        opts: Optional[ResourceOptions] = None,
        protocol_type: Optional[str] = None,
        fail_on_warnings: Optional[bool] = None,
        cors_configuration: Optional[ApiCorsConfigurationArgs] = None,
        credentials_arn: Optional[str] = None,
        description: Optional[str] = None,
        disable_execute_api_endpoint: Optional[bool] = None,
        api_key_selection_expression: Optional[str] = None,
        name: Optional[str] = None,
        body: Optional[str] = None,
        route_key: Optional[str] = None,
        route_selection_expression: Optional[str] = None,
        tags: Optional[Mapping[str, str]] = None,
        target: Optional[str] = None,
        version: Optional[str] = None)func NewApi(ctx *Context, name string, args ApiArgs, opts ...ResourceOption) (*Api, error)public Api(string name, ApiArgs args, CustomResourceOptions? opts = null)type: aws:apigatewayv2:Api
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 ApiArgs
- 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 ApiArgs
- 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 ApiArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ApiArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args ApiArgs
- 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 apiResource = new Aws.ApiGatewayV2.Api("apiResource", new()
{
    ProtocolType = "string",
    FailOnWarnings = false,
    CorsConfiguration = new Aws.ApiGatewayV2.Inputs.ApiCorsConfigurationArgs
    {
        AllowCredentials = false,
        AllowHeaders = new[]
        {
            "string",
        },
        AllowMethods = new[]
        {
            "string",
        },
        AllowOrigins = new[]
        {
            "string",
        },
        ExposeHeaders = new[]
        {
            "string",
        },
        MaxAge = 0,
    },
    CredentialsArn = "string",
    Description = "string",
    DisableExecuteApiEndpoint = false,
    ApiKeySelectionExpression = "string",
    Name = "string",
    Body = "string",
    RouteKey = "string",
    RouteSelectionExpression = "string",
    Tags = 
    {
        { "string", "string" },
    },
    Target = "string",
    Version = "string",
});
example, err := apigatewayv2.NewApi(ctx, "apiResource", &apigatewayv2.ApiArgs{
	ProtocolType:   pulumi.String("string"),
	FailOnWarnings: pulumi.Bool(false),
	CorsConfiguration: &apigatewayv2.ApiCorsConfigurationArgs{
		AllowCredentials: pulumi.Bool(false),
		AllowHeaders: pulumi.StringArray{
			pulumi.String("string"),
		},
		AllowMethods: pulumi.StringArray{
			pulumi.String("string"),
		},
		AllowOrigins: pulumi.StringArray{
			pulumi.String("string"),
		},
		ExposeHeaders: pulumi.StringArray{
			pulumi.String("string"),
		},
		MaxAge: pulumi.Int(0),
	},
	CredentialsArn:            pulumi.String("string"),
	Description:               pulumi.String("string"),
	DisableExecuteApiEndpoint: pulumi.Bool(false),
	ApiKeySelectionExpression: pulumi.String("string"),
	Name:                      pulumi.String("string"),
	Body:                      pulumi.String("string"),
	RouteKey:                  pulumi.String("string"),
	RouteSelectionExpression:  pulumi.String("string"),
	Tags: pulumi.StringMap{
		"string": pulumi.String("string"),
	},
	Target:  pulumi.String("string"),
	Version: pulumi.String("string"),
})
var apiResource = new Api("apiResource", ApiArgs.builder()
    .protocolType("string")
    .failOnWarnings(false)
    .corsConfiguration(ApiCorsConfigurationArgs.builder()
        .allowCredentials(false)
        .allowHeaders("string")
        .allowMethods("string")
        .allowOrigins("string")
        .exposeHeaders("string")
        .maxAge(0)
        .build())
    .credentialsArn("string")
    .description("string")
    .disableExecuteApiEndpoint(false)
    .apiKeySelectionExpression("string")
    .name("string")
    .body("string")
    .routeKey("string")
    .routeSelectionExpression("string")
    .tags(Map.of("string", "string"))
    .target("string")
    .version("string")
    .build());
api_resource = aws.apigatewayv2.Api("apiResource",
    protocol_type="string",
    fail_on_warnings=False,
    cors_configuration={
        "allow_credentials": False,
        "allow_headers": ["string"],
        "allow_methods": ["string"],
        "allow_origins": ["string"],
        "expose_headers": ["string"],
        "max_age": 0,
    },
    credentials_arn="string",
    description="string",
    disable_execute_api_endpoint=False,
    api_key_selection_expression="string",
    name="string",
    body="string",
    route_key="string",
    route_selection_expression="string",
    tags={
        "string": "string",
    },
    target="string",
    version="string")
const apiResource = new aws.apigatewayv2.Api("apiResource", {
    protocolType: "string",
    failOnWarnings: false,
    corsConfiguration: {
        allowCredentials: false,
        allowHeaders: ["string"],
        allowMethods: ["string"],
        allowOrigins: ["string"],
        exposeHeaders: ["string"],
        maxAge: 0,
    },
    credentialsArn: "string",
    description: "string",
    disableExecuteApiEndpoint: false,
    apiKeySelectionExpression: "string",
    name: "string",
    body: "string",
    routeKey: "string",
    routeSelectionExpression: "string",
    tags: {
        string: "string",
    },
    target: "string",
    version: "string",
});
type: aws:apigatewayv2:Api
properties:
    apiKeySelectionExpression: string
    body: string
    corsConfiguration:
        allowCredentials: false
        allowHeaders:
            - string
        allowMethods:
            - string
        allowOrigins:
            - string
        exposeHeaders:
            - string
        maxAge: 0
    credentialsArn: string
    description: string
    disableExecuteApiEndpoint: false
    failOnWarnings: false
    name: string
    protocolType: string
    routeKey: string
    routeSelectionExpression: string
    tags:
        string: string
    target: string
    version: string
Api Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The Api resource accepts the following input properties:
- ProtocolType string
- API protocol. Valid values: HTTP,WEBSOCKET.
- ApiKey stringSelection Expression 
- An API key selection expression.
Valid values: $context.authorizer.usageIdentifierKey,$request.header.x-api-key. Defaults to$request.header.x-api-key. Applicable for WebSocket APIs.
- Body string
- An OpenAPI specification that defines the set of routes and integrations to create as part of the HTTP APIs. Supported only for HTTP APIs.
- CorsConfiguration ApiCors Configuration 
- Cross-origin resource sharing (CORS) configuration. Applicable for HTTP APIs.
- CredentialsArn string
- Part of quick create. Specifies any credentials required for the integration. Applicable for HTTP APIs.
- Description string
- Description of the API. Must be less than or equal to 1024 characters in length.
- DisableExecute boolApi Endpoint 
- Whether clients can invoke the API by using the default execute-apiendpoint. By default, clients can invoke the API with the default{api_id}.execute-api.{region}.amazonaws.com endpoint. To require that clients use a custom domain name to invoke the API, disable the default endpoint.
- FailOn boolWarnings 
- Whether warnings should return an error while API Gateway is creating or updating the resource using an OpenAPI specification. Defaults to false. Applicable for HTTP APIs.
- Name string
- Name of the API. Must be less than or equal to 128 characters in length.
- RouteKey string
- Part of quick create. Specifies any route key. Applicable for HTTP APIs.
- RouteSelection stringExpression 
- The route selection expression for the API.
Defaults to $request.method $request.path.
- Dictionary<string, string>
- Map of tags to assign to the API. If configured with a provider default_tagsconfiguration block present, tags with matching keys will overwrite those defined at the provider-level.
- Target string
- Part of quick create. Quick create produces an API with an integration, a default catch-all route, and a default stage which is configured to automatically deploy changes.
For HTTP integrations, specify a fully qualified URL. For Lambda integrations, specify a function ARN.
The type of the integration will be HTTP_PROXYorAWS_PROXY, respectively. Applicable for HTTP APIs.
- Version string
- Version identifier for the API. Must be between 1 and 64 characters in length.
- ProtocolType string
- API protocol. Valid values: HTTP,WEBSOCKET.
- ApiKey stringSelection Expression 
- An API key selection expression.
Valid values: $context.authorizer.usageIdentifierKey,$request.header.x-api-key. Defaults to$request.header.x-api-key. Applicable for WebSocket APIs.
- Body string
- An OpenAPI specification that defines the set of routes and integrations to create as part of the HTTP APIs. Supported only for HTTP APIs.
- CorsConfiguration ApiCors Configuration Args 
- Cross-origin resource sharing (CORS) configuration. Applicable for HTTP APIs.
- CredentialsArn string
- Part of quick create. Specifies any credentials required for the integration. Applicable for HTTP APIs.
- Description string
- Description of the API. Must be less than or equal to 1024 characters in length.
- DisableExecute boolApi Endpoint 
- Whether clients can invoke the API by using the default execute-apiendpoint. By default, clients can invoke the API with the default{api_id}.execute-api.{region}.amazonaws.com endpoint. To require that clients use a custom domain name to invoke the API, disable the default endpoint.
- FailOn boolWarnings 
- Whether warnings should return an error while API Gateway is creating or updating the resource using an OpenAPI specification. Defaults to false. Applicable for HTTP APIs.
- Name string
- Name of the API. Must be less than or equal to 128 characters in length.
- RouteKey string
- Part of quick create. Specifies any route key. Applicable for HTTP APIs.
- RouteSelection stringExpression 
- The route selection expression for the API.
Defaults to $request.method $request.path.
- map[string]string
- Map of tags to assign to the API. If configured with a provider default_tagsconfiguration block present, tags with matching keys will overwrite those defined at the provider-level.
- Target string
- Part of quick create. Quick create produces an API with an integration, a default catch-all route, and a default stage which is configured to automatically deploy changes.
For HTTP integrations, specify a fully qualified URL. For Lambda integrations, specify a function ARN.
The type of the integration will be HTTP_PROXYorAWS_PROXY, respectively. Applicable for HTTP APIs.
- Version string
- Version identifier for the API. Must be between 1 and 64 characters in length.
- protocolType String
- API protocol. Valid values: HTTP,WEBSOCKET.
- apiKey StringSelection Expression 
- An API key selection expression.
Valid values: $context.authorizer.usageIdentifierKey,$request.header.x-api-key. Defaults to$request.header.x-api-key. Applicable for WebSocket APIs.
- body String
- An OpenAPI specification that defines the set of routes and integrations to create as part of the HTTP APIs. Supported only for HTTP APIs.
- corsConfiguration ApiCors Configuration 
- Cross-origin resource sharing (CORS) configuration. Applicable for HTTP APIs.
- credentialsArn String
- Part of quick create. Specifies any credentials required for the integration. Applicable for HTTP APIs.
- description String
- Description of the API. Must be less than or equal to 1024 characters in length.
- disableExecute BooleanApi Endpoint 
- Whether clients can invoke the API by using the default execute-apiendpoint. By default, clients can invoke the API with the default{api_id}.execute-api.{region}.amazonaws.com endpoint. To require that clients use a custom domain name to invoke the API, disable the default endpoint.
- failOn BooleanWarnings 
- Whether warnings should return an error while API Gateway is creating or updating the resource using an OpenAPI specification. Defaults to false. Applicable for HTTP APIs.
- name String
- Name of the API. Must be less than or equal to 128 characters in length.
- routeKey String
- Part of quick create. Specifies any route key. Applicable for HTTP APIs.
- routeSelection StringExpression 
- The route selection expression for the API.
Defaults to $request.method $request.path.
- Map<String,String>
- Map of tags to assign to the API. If configured with a provider default_tagsconfiguration block present, tags with matching keys will overwrite those defined at the provider-level.
- target String
- Part of quick create. Quick create produces an API with an integration, a default catch-all route, and a default stage which is configured to automatically deploy changes.
For HTTP integrations, specify a fully qualified URL. For Lambda integrations, specify a function ARN.
The type of the integration will be HTTP_PROXYorAWS_PROXY, respectively. Applicable for HTTP APIs.
- version String
- Version identifier for the API. Must be between 1 and 64 characters in length.
- protocolType string
- API protocol. Valid values: HTTP,WEBSOCKET.
- apiKey stringSelection Expression 
- An API key selection expression.
Valid values: $context.authorizer.usageIdentifierKey,$request.header.x-api-key. Defaults to$request.header.x-api-key. Applicable for WebSocket APIs.
- body string
- An OpenAPI specification that defines the set of routes and integrations to create as part of the HTTP APIs. Supported only for HTTP APIs.
- corsConfiguration ApiCors Configuration 
- Cross-origin resource sharing (CORS) configuration. Applicable for HTTP APIs.
- credentialsArn string
- Part of quick create. Specifies any credentials required for the integration. Applicable for HTTP APIs.
- description string
- Description of the API. Must be less than or equal to 1024 characters in length.
- disableExecute booleanApi Endpoint 
- Whether clients can invoke the API by using the default execute-apiendpoint. By default, clients can invoke the API with the default{api_id}.execute-api.{region}.amazonaws.com endpoint. To require that clients use a custom domain name to invoke the API, disable the default endpoint.
- failOn booleanWarnings 
- Whether warnings should return an error while API Gateway is creating or updating the resource using an OpenAPI specification. Defaults to false. Applicable for HTTP APIs.
- name string
- Name of the API. Must be less than or equal to 128 characters in length.
- routeKey string
- Part of quick create. Specifies any route key. Applicable for HTTP APIs.
- routeSelection stringExpression 
- The route selection expression for the API.
Defaults to $request.method $request.path.
- {[key: string]: string}
- Map of tags to assign to the API. If configured with a provider default_tagsconfiguration block present, tags with matching keys will overwrite those defined at the provider-level.
- target string
- Part of quick create. Quick create produces an API with an integration, a default catch-all route, and a default stage which is configured to automatically deploy changes.
For HTTP integrations, specify a fully qualified URL. For Lambda integrations, specify a function ARN.
The type of the integration will be HTTP_PROXYorAWS_PROXY, respectively. Applicable for HTTP APIs.
- version string
- Version identifier for the API. Must be between 1 and 64 characters in length.
- protocol_type str
- API protocol. Valid values: HTTP,WEBSOCKET.
- api_key_ strselection_ expression 
- An API key selection expression.
Valid values: $context.authorizer.usageIdentifierKey,$request.header.x-api-key. Defaults to$request.header.x-api-key. Applicable for WebSocket APIs.
- body str
- An OpenAPI specification that defines the set of routes and integrations to create as part of the HTTP APIs. Supported only for HTTP APIs.
- cors_configuration ApiCors Configuration Args 
- Cross-origin resource sharing (CORS) configuration. Applicable for HTTP APIs.
- credentials_arn str
- Part of quick create. Specifies any credentials required for the integration. Applicable for HTTP APIs.
- description str
- Description of the API. Must be less than or equal to 1024 characters in length.
- disable_execute_ boolapi_ endpoint 
- Whether clients can invoke the API by using the default execute-apiendpoint. By default, clients can invoke the API with the default{api_id}.execute-api.{region}.amazonaws.com endpoint. To require that clients use a custom domain name to invoke the API, disable the default endpoint.
- fail_on_ boolwarnings 
- Whether warnings should return an error while API Gateway is creating or updating the resource using an OpenAPI specification. Defaults to false. Applicable for HTTP APIs.
- name str
- Name of the API. Must be less than or equal to 128 characters in length.
- route_key str
- Part of quick create. Specifies any route key. Applicable for HTTP APIs.
- route_selection_ strexpression 
- The route selection expression for the API.
Defaults to $request.method $request.path.
- Mapping[str, str]
- Map of tags to assign to the API. If configured with a provider default_tagsconfiguration block present, tags with matching keys will overwrite those defined at the provider-level.
- target str
- Part of quick create. Quick create produces an API with an integration, a default catch-all route, and a default stage which is configured to automatically deploy changes.
For HTTP integrations, specify a fully qualified URL. For Lambda integrations, specify a function ARN.
The type of the integration will be HTTP_PROXYorAWS_PROXY, respectively. Applicable for HTTP APIs.
- version str
- Version identifier for the API. Must be between 1 and 64 characters in length.
- protocolType String
- API protocol. Valid values: HTTP,WEBSOCKET.
- apiKey StringSelection Expression 
- An API key selection expression.
Valid values: $context.authorizer.usageIdentifierKey,$request.header.x-api-key. Defaults to$request.header.x-api-key. Applicable for WebSocket APIs.
- body String
- An OpenAPI specification that defines the set of routes and integrations to create as part of the HTTP APIs. Supported only for HTTP APIs.
- corsConfiguration Property Map
- Cross-origin resource sharing (CORS) configuration. Applicable for HTTP APIs.
- credentialsArn String
- Part of quick create. Specifies any credentials required for the integration. Applicable for HTTP APIs.
- description String
- Description of the API. Must be less than or equal to 1024 characters in length.
- disableExecute BooleanApi Endpoint 
- Whether clients can invoke the API by using the default execute-apiendpoint. By default, clients can invoke the API with the default{api_id}.execute-api.{region}.amazonaws.com endpoint. To require that clients use a custom domain name to invoke the API, disable the default endpoint.
- failOn BooleanWarnings 
- Whether warnings should return an error while API Gateway is creating or updating the resource using an OpenAPI specification. Defaults to false. Applicable for HTTP APIs.
- name String
- Name of the API. Must be less than or equal to 128 characters in length.
- routeKey String
- Part of quick create. Specifies any route key. Applicable for HTTP APIs.
- routeSelection StringExpression 
- The route selection expression for the API.
Defaults to $request.method $request.path.
- Map<String>
- Map of tags to assign to the API. If configured with a provider default_tagsconfiguration block present, tags with matching keys will overwrite those defined at the provider-level.
- target String
- Part of quick create. Quick create produces an API with an integration, a default catch-all route, and a default stage which is configured to automatically deploy changes.
For HTTP integrations, specify a fully qualified URL. For Lambda integrations, specify a function ARN.
The type of the integration will be HTTP_PROXYorAWS_PROXY, respectively. Applicable for HTTP APIs.
- version String
- Version identifier for the API. Must be between 1 and 64 characters in length.
Outputs
All input properties are implicitly available as output properties. Additionally, the Api resource produces the following output properties:
- ApiEndpoint string
- URI of the API, of the form https://{api-id}.execute-api.{region}.amazonaws.comfor HTTP APIs andwss://{api-id}.execute-api.{region}.amazonaws.comfor WebSocket APIs.
- Arn string
- ARN of the API.
- ExecutionArn string
- ARN prefix to be used in an aws.lambda.Permission'ssource_arnattribute or in anaws.iam.Policyto authorize access to the@connectionsAPI. See the Amazon API Gateway Developer Guide for details.
- Id string
- The provider-assigned unique ID for this managed resource.
- Dictionary<string, string>
- Map of tags assigned to the resource, including those inherited from the provider default_tagsconfiguration block.
- ApiEndpoint string
- URI of the API, of the form https://{api-id}.execute-api.{region}.amazonaws.comfor HTTP APIs andwss://{api-id}.execute-api.{region}.amazonaws.comfor WebSocket APIs.
- Arn string
- ARN of the API.
- ExecutionArn string
- ARN prefix to be used in an aws.lambda.Permission'ssource_arnattribute or in anaws.iam.Policyto authorize access to the@connectionsAPI. See the Amazon API Gateway Developer Guide for details.
- Id string
- The provider-assigned unique ID for this managed resource.
- map[string]string
- Map of tags assigned to the resource, including those inherited from the provider default_tagsconfiguration block.
- apiEndpoint String
- URI of the API, of the form https://{api-id}.execute-api.{region}.amazonaws.comfor HTTP APIs andwss://{api-id}.execute-api.{region}.amazonaws.comfor WebSocket APIs.
- arn String
- ARN of the API.
- executionArn String
- ARN prefix to be used in an aws.lambda.Permission'ssource_arnattribute or in anaws.iam.Policyto authorize access to the@connectionsAPI. See the Amazon API Gateway Developer Guide for details.
- id String
- The provider-assigned unique ID for this managed resource.
- Map<String,String>
- Map of tags assigned to the resource, including those inherited from the provider default_tagsconfiguration block.
- apiEndpoint string
- URI of the API, of the form https://{api-id}.execute-api.{region}.amazonaws.comfor HTTP APIs andwss://{api-id}.execute-api.{region}.amazonaws.comfor WebSocket APIs.
- arn string
- ARN of the API.
- executionArn string
- ARN prefix to be used in an aws.lambda.Permission'ssource_arnattribute or in anaws.iam.Policyto authorize access to the@connectionsAPI. See the Amazon API Gateway Developer Guide for details.
- id string
- The provider-assigned unique ID for this managed resource.
- {[key: string]: string}
- Map of tags assigned to the resource, including those inherited from the provider default_tagsconfiguration block.
- api_endpoint str
- URI of the API, of the form https://{api-id}.execute-api.{region}.amazonaws.comfor HTTP APIs andwss://{api-id}.execute-api.{region}.amazonaws.comfor WebSocket APIs.
- arn str
- ARN of the API.
- execution_arn str
- ARN prefix to be used in an aws.lambda.Permission'ssource_arnattribute or in anaws.iam.Policyto authorize access to the@connectionsAPI. See the Amazon API Gateway Developer Guide for details.
- id str
- The provider-assigned unique ID for this managed resource.
- Mapping[str, str]
- Map of tags assigned to the resource, including those inherited from the provider default_tagsconfiguration block.
- apiEndpoint String
- URI of the API, of the form https://{api-id}.execute-api.{region}.amazonaws.comfor HTTP APIs andwss://{api-id}.execute-api.{region}.amazonaws.comfor WebSocket APIs.
- arn String
- ARN of the API.
- executionArn String
- ARN prefix to be used in an aws.lambda.Permission'ssource_arnattribute or in anaws.iam.Policyto authorize access to the@connectionsAPI. See the Amazon API Gateway Developer Guide for details.
- id String
- The provider-assigned unique ID for this managed resource.
- Map<String>
- Map of tags assigned to the resource, including those inherited from the provider default_tagsconfiguration block.
Look up Existing Api Resource
Get an existing Api 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?: ApiState, opts?: CustomResourceOptions): Api@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        api_endpoint: Optional[str] = None,
        api_key_selection_expression: Optional[str] = None,
        arn: Optional[str] = None,
        body: Optional[str] = None,
        cors_configuration: Optional[ApiCorsConfigurationArgs] = None,
        credentials_arn: Optional[str] = None,
        description: Optional[str] = None,
        disable_execute_api_endpoint: Optional[bool] = None,
        execution_arn: Optional[str] = None,
        fail_on_warnings: Optional[bool] = None,
        name: Optional[str] = None,
        protocol_type: Optional[str] = None,
        route_key: Optional[str] = None,
        route_selection_expression: Optional[str] = None,
        tags: Optional[Mapping[str, str]] = None,
        tags_all: Optional[Mapping[str, str]] = None,
        target: Optional[str] = None,
        version: Optional[str] = None) -> Apifunc GetApi(ctx *Context, name string, id IDInput, state *ApiState, opts ...ResourceOption) (*Api, error)public static Api Get(string name, Input<string> id, ApiState? state, CustomResourceOptions? opts = null)public static Api get(String name, Output<String> id, ApiState state, CustomResourceOptions options)resources:  _:    type: aws:apigatewayv2:Api    get:      id: ${id}- 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.
- ApiEndpoint string
- URI of the API, of the form https://{api-id}.execute-api.{region}.amazonaws.comfor HTTP APIs andwss://{api-id}.execute-api.{region}.amazonaws.comfor WebSocket APIs.
- ApiKey stringSelection Expression 
- An API key selection expression.
Valid values: $context.authorizer.usageIdentifierKey,$request.header.x-api-key. Defaults to$request.header.x-api-key. Applicable for WebSocket APIs.
- Arn string
- ARN of the API.
- Body string
- An OpenAPI specification that defines the set of routes and integrations to create as part of the HTTP APIs. Supported only for HTTP APIs.
- CorsConfiguration ApiCors Configuration 
- Cross-origin resource sharing (CORS) configuration. Applicable for HTTP APIs.
- CredentialsArn string
- Part of quick create. Specifies any credentials required for the integration. Applicable for HTTP APIs.
- Description string
- Description of the API. Must be less than or equal to 1024 characters in length.
- DisableExecute boolApi Endpoint 
- Whether clients can invoke the API by using the default execute-apiendpoint. By default, clients can invoke the API with the default{api_id}.execute-api.{region}.amazonaws.com endpoint. To require that clients use a custom domain name to invoke the API, disable the default endpoint.
- ExecutionArn string
- ARN prefix to be used in an aws.lambda.Permission'ssource_arnattribute or in anaws.iam.Policyto authorize access to the@connectionsAPI. See the Amazon API Gateway Developer Guide for details.
- FailOn boolWarnings 
- Whether warnings should return an error while API Gateway is creating or updating the resource using an OpenAPI specification. Defaults to false. Applicable for HTTP APIs.
- Name string
- Name of the API. Must be less than or equal to 128 characters in length.
- ProtocolType string
- API protocol. Valid values: HTTP,WEBSOCKET.
- RouteKey string
- Part of quick create. Specifies any route key. Applicable for HTTP APIs.
- RouteSelection stringExpression 
- The route selection expression for the API.
Defaults to $request.method $request.path.
- Dictionary<string, string>
- Map of tags to assign to the API. If configured with a provider default_tagsconfiguration block present, tags with matching keys will overwrite those defined at the provider-level.
- Dictionary<string, string>
- Map of tags assigned to the resource, including those inherited from the provider default_tagsconfiguration block.
- Target string
- Part of quick create. Quick create produces an API with an integration, a default catch-all route, and a default stage which is configured to automatically deploy changes.
For HTTP integrations, specify a fully qualified URL. For Lambda integrations, specify a function ARN.
The type of the integration will be HTTP_PROXYorAWS_PROXY, respectively. Applicable for HTTP APIs.
- Version string
- Version identifier for the API. Must be between 1 and 64 characters in length.
- ApiEndpoint string
- URI of the API, of the form https://{api-id}.execute-api.{region}.amazonaws.comfor HTTP APIs andwss://{api-id}.execute-api.{region}.amazonaws.comfor WebSocket APIs.
- ApiKey stringSelection Expression 
- An API key selection expression.
Valid values: $context.authorizer.usageIdentifierKey,$request.header.x-api-key. Defaults to$request.header.x-api-key. Applicable for WebSocket APIs.
- Arn string
- ARN of the API.
- Body string
- An OpenAPI specification that defines the set of routes and integrations to create as part of the HTTP APIs. Supported only for HTTP APIs.
- CorsConfiguration ApiCors Configuration Args 
- Cross-origin resource sharing (CORS) configuration. Applicable for HTTP APIs.
- CredentialsArn string
- Part of quick create. Specifies any credentials required for the integration. Applicable for HTTP APIs.
- Description string
- Description of the API. Must be less than or equal to 1024 characters in length.
- DisableExecute boolApi Endpoint 
- Whether clients can invoke the API by using the default execute-apiendpoint. By default, clients can invoke the API with the default{api_id}.execute-api.{region}.amazonaws.com endpoint. To require that clients use a custom domain name to invoke the API, disable the default endpoint.
- ExecutionArn string
- ARN prefix to be used in an aws.lambda.Permission'ssource_arnattribute or in anaws.iam.Policyto authorize access to the@connectionsAPI. See the Amazon API Gateway Developer Guide for details.
- FailOn boolWarnings 
- Whether warnings should return an error while API Gateway is creating or updating the resource using an OpenAPI specification. Defaults to false. Applicable for HTTP APIs.
- Name string
- Name of the API. Must be less than or equal to 128 characters in length.
- ProtocolType string
- API protocol. Valid values: HTTP,WEBSOCKET.
- RouteKey string
- Part of quick create. Specifies any route key. Applicable for HTTP APIs.
- RouteSelection stringExpression 
- The route selection expression for the API.
Defaults to $request.method $request.path.
- map[string]string
- Map of tags to assign to the API. If configured with a provider default_tagsconfiguration block present, tags with matching keys will overwrite those defined at the provider-level.
- map[string]string
- Map of tags assigned to the resource, including those inherited from the provider default_tagsconfiguration block.
- Target string
- Part of quick create. Quick create produces an API with an integration, a default catch-all route, and a default stage which is configured to automatically deploy changes.
For HTTP integrations, specify a fully qualified URL. For Lambda integrations, specify a function ARN.
The type of the integration will be HTTP_PROXYorAWS_PROXY, respectively. Applicable for HTTP APIs.
- Version string
- Version identifier for the API. Must be between 1 and 64 characters in length.
- apiEndpoint String
- URI of the API, of the form https://{api-id}.execute-api.{region}.amazonaws.comfor HTTP APIs andwss://{api-id}.execute-api.{region}.amazonaws.comfor WebSocket APIs.
- apiKey StringSelection Expression 
- An API key selection expression.
Valid values: $context.authorizer.usageIdentifierKey,$request.header.x-api-key. Defaults to$request.header.x-api-key. Applicable for WebSocket APIs.
- arn String
- ARN of the API.
- body String
- An OpenAPI specification that defines the set of routes and integrations to create as part of the HTTP APIs. Supported only for HTTP APIs.
- corsConfiguration ApiCors Configuration 
- Cross-origin resource sharing (CORS) configuration. Applicable for HTTP APIs.
- credentialsArn String
- Part of quick create. Specifies any credentials required for the integration. Applicable for HTTP APIs.
- description String
- Description of the API. Must be less than or equal to 1024 characters in length.
- disableExecute BooleanApi Endpoint 
- Whether clients can invoke the API by using the default execute-apiendpoint. By default, clients can invoke the API with the default{api_id}.execute-api.{region}.amazonaws.com endpoint. To require that clients use a custom domain name to invoke the API, disable the default endpoint.
- executionArn String
- ARN prefix to be used in an aws.lambda.Permission'ssource_arnattribute or in anaws.iam.Policyto authorize access to the@connectionsAPI. See the Amazon API Gateway Developer Guide for details.
- failOn BooleanWarnings 
- Whether warnings should return an error while API Gateway is creating or updating the resource using an OpenAPI specification. Defaults to false. Applicable for HTTP APIs.
- name String
- Name of the API. Must be less than or equal to 128 characters in length.
- protocolType String
- API protocol. Valid values: HTTP,WEBSOCKET.
- routeKey String
- Part of quick create. Specifies any route key. Applicable for HTTP APIs.
- routeSelection StringExpression 
- The route selection expression for the API.
Defaults to $request.method $request.path.
- Map<String,String>
- Map of tags to assign to the API. If configured with a provider default_tagsconfiguration block present, tags with matching keys will overwrite those defined at the provider-level.
- Map<String,String>
- Map of tags assigned to the resource, including those inherited from the provider default_tagsconfiguration block.
- target String
- Part of quick create. Quick create produces an API with an integration, a default catch-all route, and a default stage which is configured to automatically deploy changes.
For HTTP integrations, specify a fully qualified URL. For Lambda integrations, specify a function ARN.
The type of the integration will be HTTP_PROXYorAWS_PROXY, respectively. Applicable for HTTP APIs.
- version String
- Version identifier for the API. Must be between 1 and 64 characters in length.
- apiEndpoint string
- URI of the API, of the form https://{api-id}.execute-api.{region}.amazonaws.comfor HTTP APIs andwss://{api-id}.execute-api.{region}.amazonaws.comfor WebSocket APIs.
- apiKey stringSelection Expression 
- An API key selection expression.
Valid values: $context.authorizer.usageIdentifierKey,$request.header.x-api-key. Defaults to$request.header.x-api-key. Applicable for WebSocket APIs.
- arn string
- ARN of the API.
- body string
- An OpenAPI specification that defines the set of routes and integrations to create as part of the HTTP APIs. Supported only for HTTP APIs.
- corsConfiguration ApiCors Configuration 
- Cross-origin resource sharing (CORS) configuration. Applicable for HTTP APIs.
- credentialsArn string
- Part of quick create. Specifies any credentials required for the integration. Applicable for HTTP APIs.
- description string
- Description of the API. Must be less than or equal to 1024 characters in length.
- disableExecute booleanApi Endpoint 
- Whether clients can invoke the API by using the default execute-apiendpoint. By default, clients can invoke the API with the default{api_id}.execute-api.{region}.amazonaws.com endpoint. To require that clients use a custom domain name to invoke the API, disable the default endpoint.
- executionArn string
- ARN prefix to be used in an aws.lambda.Permission'ssource_arnattribute or in anaws.iam.Policyto authorize access to the@connectionsAPI. See the Amazon API Gateway Developer Guide for details.
- failOn booleanWarnings 
- Whether warnings should return an error while API Gateway is creating or updating the resource using an OpenAPI specification. Defaults to false. Applicable for HTTP APIs.
- name string
- Name of the API. Must be less than or equal to 128 characters in length.
- protocolType string
- API protocol. Valid values: HTTP,WEBSOCKET.
- routeKey string
- Part of quick create. Specifies any route key. Applicable for HTTP APIs.
- routeSelection stringExpression 
- The route selection expression for the API.
Defaults to $request.method $request.path.
- {[key: string]: string}
- Map of tags to assign to the API. If configured with a provider default_tagsconfiguration block present, tags with matching keys will overwrite those defined at the provider-level.
- {[key: string]: string}
- Map of tags assigned to the resource, including those inherited from the provider default_tagsconfiguration block.
- target string
- Part of quick create. Quick create produces an API with an integration, a default catch-all route, and a default stage which is configured to automatically deploy changes.
For HTTP integrations, specify a fully qualified URL. For Lambda integrations, specify a function ARN.
The type of the integration will be HTTP_PROXYorAWS_PROXY, respectively. Applicable for HTTP APIs.
- version string
- Version identifier for the API. Must be between 1 and 64 characters in length.
- api_endpoint str
- URI of the API, of the form https://{api-id}.execute-api.{region}.amazonaws.comfor HTTP APIs andwss://{api-id}.execute-api.{region}.amazonaws.comfor WebSocket APIs.
- api_key_ strselection_ expression 
- An API key selection expression.
Valid values: $context.authorizer.usageIdentifierKey,$request.header.x-api-key. Defaults to$request.header.x-api-key. Applicable for WebSocket APIs.
- arn str
- ARN of the API.
- body str
- An OpenAPI specification that defines the set of routes and integrations to create as part of the HTTP APIs. Supported only for HTTP APIs.
- cors_configuration ApiCors Configuration Args 
- Cross-origin resource sharing (CORS) configuration. Applicable for HTTP APIs.
- credentials_arn str
- Part of quick create. Specifies any credentials required for the integration. Applicable for HTTP APIs.
- description str
- Description of the API. Must be less than or equal to 1024 characters in length.
- disable_execute_ boolapi_ endpoint 
- Whether clients can invoke the API by using the default execute-apiendpoint. By default, clients can invoke the API with the default{api_id}.execute-api.{region}.amazonaws.com endpoint. To require that clients use a custom domain name to invoke the API, disable the default endpoint.
- execution_arn str
- ARN prefix to be used in an aws.lambda.Permission'ssource_arnattribute or in anaws.iam.Policyto authorize access to the@connectionsAPI. See the Amazon API Gateway Developer Guide for details.
- fail_on_ boolwarnings 
- Whether warnings should return an error while API Gateway is creating or updating the resource using an OpenAPI specification. Defaults to false. Applicable for HTTP APIs.
- name str
- Name of the API. Must be less than or equal to 128 characters in length.
- protocol_type str
- API protocol. Valid values: HTTP,WEBSOCKET.
- route_key str
- Part of quick create. Specifies any route key. Applicable for HTTP APIs.
- route_selection_ strexpression 
- The route selection expression for the API.
Defaults to $request.method $request.path.
- Mapping[str, str]
- Map of tags to assign to the API. If configured with a provider default_tagsconfiguration block present, tags with matching keys will overwrite those defined at the provider-level.
- Mapping[str, str]
- Map of tags assigned to the resource, including those inherited from the provider default_tagsconfiguration block.
- target str
- Part of quick create. Quick create produces an API with an integration, a default catch-all route, and a default stage which is configured to automatically deploy changes.
For HTTP integrations, specify a fully qualified URL. For Lambda integrations, specify a function ARN.
The type of the integration will be HTTP_PROXYorAWS_PROXY, respectively. Applicable for HTTP APIs.
- version str
- Version identifier for the API. Must be between 1 and 64 characters in length.
- apiEndpoint String
- URI of the API, of the form https://{api-id}.execute-api.{region}.amazonaws.comfor HTTP APIs andwss://{api-id}.execute-api.{region}.amazonaws.comfor WebSocket APIs.
- apiKey StringSelection Expression 
- An API key selection expression.
Valid values: $context.authorizer.usageIdentifierKey,$request.header.x-api-key. Defaults to$request.header.x-api-key. Applicable for WebSocket APIs.
- arn String
- ARN of the API.
- body String
- An OpenAPI specification that defines the set of routes and integrations to create as part of the HTTP APIs. Supported only for HTTP APIs.
- corsConfiguration Property Map
- Cross-origin resource sharing (CORS) configuration. Applicable for HTTP APIs.
- credentialsArn String
- Part of quick create. Specifies any credentials required for the integration. Applicable for HTTP APIs.
- description String
- Description of the API. Must be less than or equal to 1024 characters in length.
- disableExecute BooleanApi Endpoint 
- Whether clients can invoke the API by using the default execute-apiendpoint. By default, clients can invoke the API with the default{api_id}.execute-api.{region}.amazonaws.com endpoint. To require that clients use a custom domain name to invoke the API, disable the default endpoint.
- executionArn String
- ARN prefix to be used in an aws.lambda.Permission'ssource_arnattribute or in anaws.iam.Policyto authorize access to the@connectionsAPI. See the Amazon API Gateway Developer Guide for details.
- failOn BooleanWarnings 
- Whether warnings should return an error while API Gateway is creating or updating the resource using an OpenAPI specification. Defaults to false. Applicable for HTTP APIs.
- name String
- Name of the API. Must be less than or equal to 128 characters in length.
- protocolType String
- API protocol. Valid values: HTTP,WEBSOCKET.
- routeKey String
- Part of quick create. Specifies any route key. Applicable for HTTP APIs.
- routeSelection StringExpression 
- The route selection expression for the API.
Defaults to $request.method $request.path.
- Map<String>
- Map of tags to assign to the API. If configured with a provider default_tagsconfiguration block present, tags with matching keys will overwrite those defined at the provider-level.
- Map<String>
- Map of tags assigned to the resource, including those inherited from the provider default_tagsconfiguration block.
- target String
- Part of quick create. Quick create produces an API with an integration, a default catch-all route, and a default stage which is configured to automatically deploy changes.
For HTTP integrations, specify a fully qualified URL. For Lambda integrations, specify a function ARN.
The type of the integration will be HTTP_PROXYorAWS_PROXY, respectively. Applicable for HTTP APIs.
- version String
- Version identifier for the API. Must be between 1 and 64 characters in length.
Supporting Types
ApiCorsConfiguration, ApiCorsConfigurationArgs      
- AllowCredentials bool
- Whether credentials are included in the CORS request.
- AllowHeaders List<string>
- Set of allowed HTTP headers.
- AllowMethods List<string>
- Set of allowed HTTP methods.
- AllowOrigins List<string>
- Set of allowed origins.
- ExposeHeaders List<string>
- Set of exposed HTTP headers.
- MaxAge int
- Number of seconds that the browser should cache preflight request results.
- AllowCredentials bool
- Whether credentials are included in the CORS request.
- AllowHeaders []string
- Set of allowed HTTP headers.
- AllowMethods []string
- Set of allowed HTTP methods.
- AllowOrigins []string
- Set of allowed origins.
- ExposeHeaders []string
- Set of exposed HTTP headers.
- MaxAge int
- Number of seconds that the browser should cache preflight request results.
- allowCredentials Boolean
- Whether credentials are included in the CORS request.
- allowHeaders List<String>
- Set of allowed HTTP headers.
- allowMethods List<String>
- Set of allowed HTTP methods.
- allowOrigins List<String>
- Set of allowed origins.
- exposeHeaders List<String>
- Set of exposed HTTP headers.
- maxAge Integer
- Number of seconds that the browser should cache preflight request results.
- allowCredentials boolean
- Whether credentials are included in the CORS request.
- allowHeaders string[]
- Set of allowed HTTP headers.
- allowMethods string[]
- Set of allowed HTTP methods.
- allowOrigins string[]
- Set of allowed origins.
- exposeHeaders string[]
- Set of exposed HTTP headers.
- maxAge number
- Number of seconds that the browser should cache preflight request results.
- allow_credentials bool
- Whether credentials are included in the CORS request.
- allow_headers Sequence[str]
- Set of allowed HTTP headers.
- allow_methods Sequence[str]
- Set of allowed HTTP methods.
- allow_origins Sequence[str]
- Set of allowed origins.
- expose_headers Sequence[str]
- Set of exposed HTTP headers.
- max_age int
- Number of seconds that the browser should cache preflight request results.
- allowCredentials Boolean
- Whether credentials are included in the CORS request.
- allowHeaders List<String>
- Set of allowed HTTP headers.
- allowMethods List<String>
- Set of allowed HTTP methods.
- allowOrigins List<String>
- Set of allowed origins.
- exposeHeaders List<String>
- Set of exposed HTTP headers.
- maxAge Number
- Number of seconds that the browser should cache preflight request results.
Import
Using pulumi import, import aws_apigatewayv2_api using the API identifier. For example:
$ pulumi import aws:apigatewayv2/api:Api example aabbccddee
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 awsTerraform Provider.