AWS API Gateway V2 Authorizer
This page shows how to write Terraform and CloudFormation for API Gateway V2 Authorizer and write them securely.
aws_apigatewayv2_authorizer (Terraform)
The Authorizer in API Gateway V2 can be configured in Terraform with the resource name aws_apigatewayv2_authorizer. The following sections describe 3 examples of how to use the resource and its parameters.
Example Usage from GitHub
resource "aws_apigatewayv2_authorizer" "jwt_authorizer" {
api_id = var.api_gateway_id
name = var.authorizer_name
identity_sources = [var.jwt_token_source]
authorizer_type = "JWT"
resource "aws_apigatewayv2_authorizer" "this" {
api_id = var.api_id
authorizer_type = var.authorizer_type
identity_sources = var.identity_sources
name = var.name
resource "aws_apigatewayv2_authorizer" "this" {
api_id = var.api_id
authorizer_credentials_arn = var.authorizer_credentials_arn
authorizer_type = var.authorizer_type
authorizer_uri = var.authorizer_uri
identity_sources = var.identity_sources
Parameters
-
api_idrequired - string -
authorizer_credentials_arnoptional - string -
authorizer_payload_format_versionoptional - string -
authorizer_result_ttl_in_secondsoptional computed - number -
authorizer_typerequired - string -
authorizer_urioptional - string -
enable_simple_responsesoptional - bool -
idoptional computed - string -
identity_sourcesoptional - set of string -
namerequired - string -
jwt_configurationlist block
Explanation in Terraform Registry
Manages an Amazon API Gateway Version 2 authorizer. More information can be found in the Amazon API Gateway Developer Guide.
AWS::ApiGatewayV2::Authorizer (CloudFormation)
The Authorizer in ApiGatewayV2 can be configured in CloudFormation with the resource name AWS::ApiGatewayV2::Authorizer. The following sections describe 1 example of how to use the resource and its parameters.
Example Usage from GitHub
"default" : "AWS::ApiGatewayV2::Authorizer"
},
"Properties" : {
"$ref" : "AWS_ApiGatewayV2_Authorizer.schema.json"
}
}
Parameters
-
IdentityValidationExpressionoptional - String -
AuthorizerUrioptional - String -
AuthorizerCredentialsArnoptional - String -
AuthorizerTyperequired - String -
JwtConfigurationoptional - JWTConfiguration -
AuthorizerResultTtlInSecondsoptional - Integer -
IdentitySourceoptional - List -
AuthorizerPayloadFormatVersionoptional - String -
EnableSimpleResponsesoptional - Boolean -
ApiIdrequired - String -
Namerequired - String
Explanation in CloudFormation Registry
The
AWS::ApiGatewayV2::Authorizerresource creates an authorizer for a WebSocket API or an HTTP API. To learn more, see Controlling and managing access to a WebSocket API in API Gateway and Controlling and managing access to an HTTP API in API Gateway in the API Gateway Developer Guide.
Frequently asked questions
What is AWS API Gateway V2 Authorizer?
AWS API Gateway V2 Authorizer is a resource for API Gateway V2 of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.
Where can I find the example code for the AWS API Gateway V2 Authorizer?
For Terraform, the vladcar/terraform-aws-http-api-gatewayV2-jwt-authorizer, danwiltshire/violet and niveklabs/aws source code examples are useful. See the Terraform Example section for further details.
For CloudFormation, the shiver-me-timbers/smt-cloudformation-parent source code example is useful. See the CloudFormation Example section for further details.