Skip to main content

authorizers

Creates, updates, deletes, gets or lists an authorizers resource.

Overview

Nameauthorizers
TypeResource
Idaws.apigatewayv2.authorizers

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
authorizer_credentials_arnstringRepresents an Amazon Resource Name (ARN).
authorizer_idstringThe identifier.
authorizer_payload_format_versionstringA string with a length between [1-64].
authorizer_result_ttl_in_secondsintegerAn integer with a value between [0-3600].
authorizer_typestringThe authorizer type. Specify REQUEST for a Lambda function using incoming request parameters. Specify JWT to use JSON Web Tokens (supported only for HTTP APIs). (REQUEST, JWT)
authorizer_uristringA string representation of a URI with a length between [1-2048].
enable_simple_responsesbooleanSpecifies whether a Lambda authorizer returns a response in a simple format. If enabled, the Lambda authorizer can return a boolean value instead of an IAM policy. Supported only for HTTP APIs. To learn more, see Working with AWS Lambda authorizers for HTTP APIs
identity_sourcearrayThe identity source for which authorization is requested. For the REQUEST authorizer, this is required when authorization caching is enabled. The value is a comma-separated string of one or more mapping expressions of the specified request parameters. For example, if an Auth header, a Name query string parameter are defined as identity sources, this value is $method.request.header.Auth, $method.request.querystring.Name. These parameters will be used to derive the authorization caching key and to perform runtime validation of the REQUEST authorizer by verifying all of the identity-related request parameters are present, not null and non-empty. Only when this is true does the authorizer invoke the authorizer Lambda function, otherwise, it returns a 401 Unauthorized response without calling the Lambda function. The valid value is a string of comma-separated mapping expressions of the specified request parameters. When the authorization caching is not enabled, this property is optional.
identity_validation_expressionstringA string with a length between [0-1024].
jwt_configurationobjectRepresents the configuration of a JWT authorizer. Required for the JWT authorizer type. Supported only for HTTP APIs.
namestringA string with a length between [1-128].

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_authorizerselectapi_id, authorizer_id, regionGets an Authorizer.
get_authorizersselectapi_id, regionmaxResults, nextTokenGets the Authorizers for an API.
create_authorizerinsertapi_id, region, AuthorizerType, IdentitySourceCreates an Authorizer for an API.
update_authorizerupdateapi_id, authorizer_id, regionUpdates an Authorizer.
delete_authorizerdeleteapi_id, authorizer_id, regionDeletes an Authorizer.
reset_authorizers_cacheexecapi_id, stage_name, regionResets all authorizer cache entries on a stage. Supported only for HTTP APIs.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
api_idstringThe API identifier.
authorizer_idstringThe authorizer identifier.
regionstringAWS region (default: us-east-1)
stage_namestringThe stage name. Stage names can contain only alphanumeric characters, hyphens, and underscores, or be $default. Maximum length is 128 characters.
maxResultsstringThe maximum number of elements to be returned for this resource.
nextTokenstringThe next page of elements from this collection. Not valid for the last element of the collection.

SELECT examples

Gets an Authorizer.

SELECT
authorizer_credentials_arn,
authorizer_id,
authorizer_payload_format_version,
authorizer_result_ttl_in_seconds,
authorizer_type,
authorizer_uri,
enable_simple_responses,
identity_source,
identity_validation_expression,
jwt_configuration,
name
FROM aws.apigatewayv2.authorizers
WHERE api_id = '{{ api_id }}' -- required
AND authorizer_id = '{{ authorizer_id }}' -- required
AND region = '{{ region }}' -- required
;

INSERT examples

Creates an Authorizer for an API.

INSERT INTO aws.apigatewayv2.authorizers (
AuthorizerCredentialsArn,
AuthorizerPayloadFormatVersion,
AuthorizerResultTtlInSeconds,
AuthorizerType,
AuthorizerUri,
EnableSimpleResponses,
IdentitySource,
IdentityValidationExpression,
JwtConfiguration,
Name,
api_id,
region
)
SELECT
'{{ AuthorizerCredentialsArn }}',
'{{ AuthorizerPayloadFormatVersion }}',
{{ AuthorizerResultTtlInSeconds }},
'{{ AuthorizerType }}' /* required */,
'{{ AuthorizerUri }}',
{{ EnableSimpleResponses }},
'{{ IdentitySource }}' /* required */,
'{{ IdentityValidationExpression }}',
'{{ JwtConfiguration }}',
'{{ Name }}',
'{{ api_id }}',
'{{ region }}'
RETURNING
authorizer_credentials_arn,
authorizer_id,
authorizer_payload_format_version,
authorizer_result_ttl_in_seconds,
authorizer_type,
authorizer_uri,
enable_simple_responses,
identity_source,
identity_validation_expression,
jwt_configuration,
name
;

UPDATE examples

Updates an Authorizer.

UPDATE aws.apigatewayv2.authorizers
SET
AuthorizerCredentialsArn = '{{ AuthorizerCredentialsArn }}',
AuthorizerPayloadFormatVersion = '{{ AuthorizerPayloadFormatVersion }}',
AuthorizerResultTtlInSeconds = {{ AuthorizerResultTtlInSeconds }},
AuthorizerType = '{{ AuthorizerType }}',
AuthorizerUri = '{{ AuthorizerUri }}',
EnableSimpleResponses = {{ EnableSimpleResponses }},
IdentitySource = '{{ IdentitySource }}',
IdentityValidationExpression = '{{ IdentityValidationExpression }}',
JwtConfiguration = '{{ JwtConfiguration }}',
Name = '{{ Name }}'
WHERE
api_id = '{{ api_id }}' --required
AND authorizer_id = '{{ authorizer_id }}' --required
AND region = '{{ region }}' --required
RETURNING
authorizer_credentials_arn,
authorizer_id,
authorizer_payload_format_version,
authorizer_result_ttl_in_seconds,
authorizer_type,
authorizer_uri,
enable_simple_responses,
identity_source,
identity_validation_expression,
jwt_configuration,
name;

DELETE examples

Deletes an Authorizer.

DELETE FROM aws.apigatewayv2.authorizers
WHERE api_id = '{{ api_id }}' --required
AND authorizer_id = '{{ authorizer_id }}' --required
AND region = '{{ region }}' --required
;

Lifecycle Methods

Resets all authorizer cache entries on a stage. Supported only for HTTP APIs.

EXEC aws.apigatewayv2.authorizers.reset_authorizers_cache
@api_id='{{ api_id }}' --required,
@stage_name='{{ stage_name }}' --required,
@region='{{ region }}' --required
;