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...

asked 2 years ago634 views
2 Answers
1
Accepted Answer

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
---------
answered 2 years ago
-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
answered 2 years ago
  • 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?

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions