HttpIamAuthorizer

class aws_cdk.aws_apigatewayv2_authorizers.HttpIamAuthorizer

Bases: object

(experimental) Authorize HTTP API Routes with IAM.

Stability:

experimental

ExampleMetadata:

infused

Example:

from aws_cdk.aws_apigatewayv2_authorizers import HttpIamAuthorizer
from aws_cdk.aws_apigatewayv2_integrations import HttpUrlIntegration

# principal: iam.AnyPrincipal


authorizer = HttpIamAuthorizer()

http_api = apigwv2.HttpApi(self, "HttpApi",
    default_authorizer=authorizer
)

routes = http_api.add_routes(
    integration=HttpUrlIntegration("BooksIntegration", "https://get-books-proxy.myproxy.internal"),
    path="/books/{book}"
)

routes[0].grant_invoke(principal)
Stability:

experimental

Methods

bind(*, route, scope)

(experimental) Bind this authorizer to a specified Http route.

Parameters:
  • route (IHttpRoute) – (experimental) The route to which the authorizer is being bound.

  • scope (Construct) – (experimental) The scope for any constructs created as part of the bind.

Stability:

experimental

Return type:

HttpRouteAuthorizerConfig