AWS CloudFormation does not support Amazon Lex / AWS Lex. This is a Lambda-backed custom resource to add support for AWS Lex Slot Types to CloudFormation.
This package on NPM
This package on GitHub
This Lambda makes use of the Lambda-Backed CloudFormation Custom Resource flow module, cfn-lambda
(GitHub / NPM).
This package uses cfn-lambda
(GitHub / NPM) Launcher Pages, so you can install this in your AWS Account without downloading anything! Just visit my (the maintainer) Launch Page and click Launch on the us-east-1
region. It only supports installation in the us-east-1
region right now, since that's the only AWS region Amazon Lex is supported in right now.
After using this Launch Page, your CloudFormation templates will have access to Custom::LexSlotType
resources as long as you add ServiceToken
to the Properties
for the resource and use it like in the example template. The ServiceToken
is available to you in the Outputs
of the CloudFormation Stack the Launch Page link creates.
Furthermore, you can simply Fn::ImportValue
the installed ServiceToken
Lambda ARN using:
"Fn::ImportValue": "cfn-lex-slot-type-1-0-3-ServiceToken"
If you clone this repo and run npm run deploy
, it will do the same thing / install the same way that clicking on the Launch link will.
You can then deploy the example template included in this module: Example Template for Custom::LexSlotType.
After you do, verify the slot exists in the Amazon Lex Console SlotType view!
See ./example.template.json
for a sample CloudFormation template. The example uses Condition
statements, Parameters
, and dynamic ServiceToken
ingestion using Fn::ImportValue
fully.
"ResourceLogicalIdInResourcesObject": {
"Type": "Type": "Custom::LexSlotType",
"Properties": {
"ServiceToken": "arn:aws:lambda:<cfn-region-id>:<your-account-id>:function:<this-deployed-lambda-name>",
"name": "MySlotTypeName", /* REQUIRED, name of the Lex SlotType.
Updates cause replacement. */
"checksum": "<uuid checksum>", /* Checksum of version to update.
Include this to force failure
if the checksums do not match.*/
"description": "Any text", /* Arbitrary description. Max 200 chars. */
"enumerationValues": [ /* REQUIRED. Enumerated values for SlotType */
{
"value": "hello"
},
.........
{
"value": "world"
}
]
}
}
Submit pull requests or tweet @ayetempleton if you want to get involved with roadmap as well, or if you want to do this for a living :)
Work is (extremely) active, published here:
Andrew's NPM Account