Create AWS::Lex::BotAlias with Lambdahook using Cloudformation is not working

2

I am using the below Cloudformation script to create an alias and assign lambda code hook but this is giving an error as below. if you have any working examples that will also help. Please note Lex bot creation and Version creation is working fine

Properties validation failed for resource VOCBotAliasWithCFN with message: #/BotAliasLocaleSettings/0: required key [Key] not found #/BotAliasLocaleSettings/0: required key [Value] not found 
VOCBotAliasWithCFN:
    DependsOn: VOCBotVersionWithCFN
    Type: AWS::Lex::BotAlias
    Properties:
      BotId: !Ref VOCBot
      BotAliasName: prod
      BotVersion: !GetAtt VOCBotVersionWithCFN.BotVersion
      SentimentAnalysisSettings:
        DetectSentiment: false 
      BotAliasLocaleSettings: 
        - BotAliasLocaleSetting:
            Enabled: true
            CodeHookSpecification:
              LambdaCodeHook:
                CodeHookInterfaceVersion: 1
                LambdaArn: <LambdaArn>
          LocaleId: en_US
  • I have the exact same issue...

已提问 2 年前644 查看次数
2 回答
1
已接受的回答

I got an update from AWS Support team this issue is fixed now. I have tested it in the us-east-1 region it is working for me now. Here is a working example

---------
VOCBotAliasWithCFN:
  DependsOn: VOCBotVersionWithCFN
  Type: AWS::Lex::BotAlias
  Properties:
    ...
    ...
    BotAliasLocaleSettings:
        - BotAliasLocaleSetting:
            Enabled: true
            CodeHookSpecification:
              LambdaCodeHook:
                CodeHookInterfaceVersion: 1.0
                LambdaArn: arn:aws:lambda:us-east-1:<Account_Id>:function:Lexfunction
          LocaleId: en_US
---------
已回答 2 年前
-2

Hi Sushil, thanks for your question. Please take a look at this documentation link on how you can declare the BotAliasLocaleSettings entity. I believe the error lies in the line "-BotAliasLocaleSetting:" which is why it cannot read the required "Enabled" field thus causing the error.

Doc Link: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lex-botalias-botaliaslocalesettings.html

AWS
已回答 2 年前
  • Thanks Saubia for replying to my post. I have checked the documentation I didn't find any problem with my cloud formation script. Also error return by the cloudformation didn't provide such information it is pointing towards some key[Key] and Key[Value].

    If you have some working sample that will help.

  • Apologies for the late reply, as of now we have no pre-built templates that are using the entity you have in the script. We have several examples on github regarding Amazon Lex, check them out here: https://github.com/orgs/aws-samples/repositories?q=lex&type=all&language=&sort=

  • Hi Saubia, the question is about a CloudFormation error when deploying a AWS::Lex::BotAlias. With this error it's currently not possible to deploy an alias using CloudFormation.

  • Yes jogold, AWS recently launched Lex deployment using cloud formation https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Lex.html

    If I am not putting any Codehook then AWS::Lex::BotAlias also working but with codehook it is giving error as mentioned in the problem description.

  • Sushil, getting the same error without a codehook, can you share your working CloudFormation template?

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则