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_id
required - string -
authorizer_credentials_arn
optional - string -
authorizer_payload_format_version
optional - string -
authorizer_result_ttl_in_seconds
optional computed - number -
authorizer_type
required - string -
authorizer_uri
optional - string -
enable_simple_responses
optional - bool -
id
optional computed - string -
identity_sources
optional - set of string -
name
required - string -
jwt_configuration
list 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
-
IdentityValidationExpression
optional - String -
AuthorizerUri
optional - String -
AuthorizerCredentialsArn
optional - String -
AuthorizerType
required - String -
JwtConfiguration
optional - JWTConfiguration -
AuthorizerResultTtlInSeconds
optional - Integer -
IdentitySource
optional - List -
AuthorizerPayloadFormatVersion
optional - String -
EnableSimpleResponses
optional - Boolean -
ApiId
required - String -
Name
required - String
Explanation in CloudFormation Registry
The
AWS::ApiGatewayV2::Authorizer
resource 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.