Creating a Authorizer for API:GatewayV2 (HTTP api) with a custom lambda authorizer using CFT

0

I have created HTTPapi and have integrated with the application load balancer, all this is working using CFT.

Now I wanted to add the authorizer to the API endpoint, I am able to implement it through console. But I am not able to figure out by CFT.

Documentation of Authorizer: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-authorizer.html CFT for reference, currently I am receiving error as "Invalid Authorizer URI: I have given the arn of lambda function.

{
    "AWSTemplateFormatVersion": "2010-09-09",
    "Description": "The template for API authorization.",
    "Parameters": {
        "projectName": {
            "Type": "String",
            "Default": "test"
        },
        "apiId": {
            "Type": "String"
        },
        "lambdaAuthArn": {
            "Type": "String"
        }
    },
    "Resources": {
        "authorizer": {
            "Type": "AWS::ApiGatewayV2::Authorizer",
            "Properties": {
                "ApiId": {
                    "Ref": "apiId"
                },
                "AuthorizerUri": {
                    "Ref": "lambdaAuthArn"
                },
                "AuthorizerType": "REQUEST",
                "Name": {
                    "Fn::Sub": "${projectName}-auth"
                  }
            }
        }
    },
    "Outputs": {
        "authorizerId": {
            "Description": "The Authorizer's ID.",
            "Value": {
                "Ref": "authorizer"
            }
        }
    }
}
  • Can you give an example of the AuthorizerUri you're using?

Keine Antworten

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen