AWS Lex Connector Configuration

The AWS Lex connector integrates with AWS Lex v2 bots to provide virtual agent capabilities.

Configuration Options

Required

Optional

AWS Credentials

IMPORTANT: AWS credentials are NOT configured in config files for security reasons. Use one of these methods instead:

Audio Format

Example Configuration

aws_lex_connector:
  type: "aws_lex_connector"
  class: "AWSLexConnector"
  module: "connectors.aws_lex_connector"
  config:
    region_name: "us-east-1"
    # Note: Bot aliases are discovered automatically
    initial_trigger_text: "hello"  # Text sent when starting conversation
    barge_in_enabled: false
  agents: []

Bot Alias Discovery

Bot aliases are discovered automatically by the connector:

This eliminates the need for manual alias configuration and ensures the connector always uses the latest bot version.

Required AWS IAM Permissions

The AWS Lex connector requires specific IAM permissions to function properly. Ensure your AWS credentials have the following permissions:

Minimum Required Permissions

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "lex:ListBots",
        "lex:ListBotAliases",
        "lex:RecognizeUtterance",
        "lex:RecognizeText"
      ],
      "Resource": "*"
    }
  ]
}

Permission Details

Permission Purpose Required
lex:ListBots Discover available bots in the configured region Yes
lex:ListBotAliases Discover bot aliases for automatic selection Yes
lex:RecognizeUtterance Send audio/text to bots and receive responses Yes
lex:RecognizeText Process text-based interactions Yes

Using Managed Policies

Alternatively, you can use the AWS managed policy AmazonLexFullAccess, which includes all necessary permissions:

# Attach managed policy to an IAM user
aws iam attach-user-policy \
  --user-name your-username \
  --policy-arn arn:aws:iam::aws:policy/AmazonLexFullAccess

Troubleshooting Permission Issues

If you encounter permission errors:

  1. “AccessDeniedException” when starting the connector
    • Ensure your credentials have lex:ListBots permission
  2. Bots not appearing in the available agents list
    • Verify your credentials have lex:ListBotAliases permission
    • Check that bots exist in the configured region
  3. Conversation fails to start
    • Confirm lex:RecognizeUtterance permission is granted
    • Verify the bot has at least one published alias

For production deployments, use IAM roles instead of access keys:

  1. Create an IAM role with the required Lex permissions
  2. Attach the role to your EC2 instance, ECS task, or Lambda function
  3. The AWS SDK will automatically use the role credentials

Using Environment Variables (For Development)

For local development, set environment variables:

export AWS_ACCESS_KEY_ID=your_access_key_id
export AWS_SECRET_ACCESS_KEY=your_secret_access_key
export AWS_DEFAULT_REGION=us-east-1

Or configure AWS CLI:

aws configure

Why WAV Conversion is Always Enabled

WxCC always requires:

Since AWS Lex always returns raw PCM data, conversion to WAV is mandatory for compatibility.