Cloudformation Template - Amazon Lex Voice Setting Engine

0

Hello,

Is there a way to set the Polly voice setting to either "neural" or "standard" using the Cloudformation template to create a Lex bot?

Documentation for Cloudformation which is missing the Engine keyword: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lex-bot-voicesettings.html

From what I have seem, it looks like an omission on the Cloudformation side. In the Lex Console, we can set any voice to be either standard or neural. When we download the bot, we can see that there is a keyword for the engine: ""voiceSettings":{"engine":"neural","voiceId":"Ivy"}". Only Cloudformation is missing that engine setting. Unfortunately, it seems to always default to the standard voice. I tried adding in the Engine keyword in my CFN template just to see if it was working but not documented, unfortunately, it is not the case; it doesn't work.

Let me know if I am missing anything.

Thanks,

John
asked 2 years ago282 views
1 Answer
1
Accepted Answer

Hi, Know you asked this 3mo ago and likely moved on, but answering in case others have the same question.

You're correct that the CFT support for Lex does not currently do anything with the 'Engine' property passed as part of the 'VoiceSettings'' property in a AWS::Lex::Bot resource. Behind the scenes, the AWS::Lex::Bot resource will result in an API call to create_bot_locale:

response = client.create_bot_locale(
    botId='string',
    botVersion='string',
    localeId='string',
    description='string',
    nluIntentConfidenceThreshold=123.0,
    voiceSettings={
        'voiceId': 'string',
        'engine': 'standard'|'neural'
    }
)

Because the 'engine' property is not honored, the value defaults to 'standard' in the API call.

I submitted a feature request but in the meantime, you can create a lambda custom resource or a CloudFormation resource type to overcome this. Your custom resource type would take in the same parameters currently passed in AWS::Lex::Bot and make a call to create_bot_locale API including the voiceSettings.engine property value which you would set to 'neural' in your template. Creating the Lambda custom resource is pretty trivial but you would need to support the update and delete cases as well. See docs for Lambda-backed Custom Resources, or the newer preferred mechanism, CloudFormation Registry Resource Types.

AWS
Scott_K
answered a year ago
  • Hello,

    Sorry for not closing the question. It was made available around a month or two ago in the CFN templates. I never had to use the APIs directly, so I never encountered this problem, but for the sake of the product growth, thanks for making this enhancement request.

    Thanks,

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