A tool to provision Amazon Lex using YAML or JSON
Amazon Lex is amazing, except it has very low automation. There's no CloudFormation (CFN) for it for it.
Also, when trying to create or update anything, the CLI wants you to pass in a checksum so it can figure out if it needs to update or create, this can be annoying.
lexbelt
fixes all this.
usage: lexbelt [<flags>] <command> [<args> ...]
AWS Lex CLI utilities
Flags:
-h, --help Show context-sensitive help (also try --help-long and --help-man).
--profile=PROFILE AWS credentials/config file profile to use
--region=REGION AWS region
-v, --version Show application version.
Commands:
help [<command>...]
Show help.
put-slot-type --name=NAME <file>
Adds or updates a slot type
put-intent --name=NAME <file>
Adds or updates an intent
put-bot --name=NAME [<flags>] <file>
Adds or updates a bot
export [<flags>]
Export existing AWS Lex configs and write to workspace
Easiest way to install if you're on a Mac or Linux (amd64 or arm64) is to use Homebrew
Type:
brew tap sethkor/tap
brew install lexbelt
For other platforms take a look at the releases in Github. I build binaries for:
OS | Architecture |
---|---|
Mac (Darwin) | amd64 (aka x86_64) |
Linux | amd64, arm64, 386 (32 bit) |
Windows | amd64, 386 (32 bit) |
Let me know if you would like a particular os/arch binary regularly built.
Lexbelt expects your workspace to look like this:
your-lex-workspace
├──slots
├──intents
└──bots
The reason why is that it intelligently looks for dependecies when deploying bots or intents and will automatically deploy any dependecies needed.
Lexbelt supports publishing, that is promoting the $LATEST
version to the next incremental version number. This is
done by passing the --publish
flag with the command.
If you deploy a bot at it or intents has a dependecy on something who's version is $LATEST
in hte spec you provide,
lexbelt will publish the dependencies and provision new elements with the correct version id's you have just published.
The yaml/json syntax for slots, intents and bots are all based directly of the AWS API Put API calls, so any attribute supported by the AWS API will be supported in the API now or in the future can be included in a yaml file
The tool won't handle mixing json and yaml within a bot (e.g. yaml bot, json intent or slot, etc), pick one and stick with it.
AWS Lex does do some weird stuff.
For instance if your attempt to create a new version of a slot or an intent and nothing has actually changed, you'll get the last version number returned. Smart. However, if you try to create a new version of abot and nothing has actualy changed, you'll get a new version number. This inconsistency is a bit annoying.
Once a new bot is published, there seems to be some asynchronous AWS magik still going on in the background. Any subsequent request to publish the bot again can trigger a HTTP response 409 ConflictException. Wait a minute and try it again, it will work. I'm guessing this is related to the build process.
This happens quite often. Some times it requires waiting for the page to load or in the case of an alias, clicking on other settings before clicking on Aliases again.
- Any other feature requested.
- Windows Testing