How aws-samples/amazon-connect-contact-lens-rules-library works
Project Type & Purpose
• This is an AWS CLI / PowerShell–based deployment tool that bundles JSON rule templates for Amazon Connect Contact Lens.
• It provides categorized rule definitions (Airline, Financial Services, General, Insurance, Telecommunications) in JSON, plus a PowerShell script (Install-CLRuleLibrary.ps1) to batch-install them.
• Users (contact-center managers, DevOps engineers) run commands or the script to push rules via the Connect Rules API.
File Structure
• Top-level directories:
• Airline, Financial Services, General, Insurance, Telecommunications – each contains Voice/Post-Call and/or Voice/Real-Time subfolders with JSON files.
• Install-CLRuleLibrary – holds the deployment script.
• Root files: README.md, LICENSE, CONTRIBUTING.md, CODE_OF_CONDUCT.md, .gitignore.
• Patterns:
• Hierarchical categorization by business domain → voice context → timing (post-call vs real-time) → individual rule JSON.
• Deployment artifacts:
• JSON rule definitions (inputs to AWS Connect APIs).
• PowerShell script orchestrates AWS CLI calls.
README for Architecture Hints
• The README outlines two installation methods: direct aws connect create-rule CLI commands, or via the PowerShell script in CloudShell.
• It references AWS services: Amazon Connect, Contact Lens Rules API, IAM for authentication.
Main Components & Their Interactions
a. Local Developer/Operator (user)
– Runs commands locally or in AWS CloudShell.
b. Rule Library Directory
– File system with categorized JSON files.
c. Installer Script (Install-CLRuleLibrary.ps1)
– PowerShell wrapper; lists directories → prompts user → invokes AWS CLI.
d. AWS CLI / AWS SDK
– Authenticated calls to CreateRule API against the Amazon Connect instance.
e. Amazon Connect Service
– Contact Lens Rules engine stores and enforces rules.
f. AWS Account & IAM
– Permission boundary; credentials used by CLI/Script.
Architectural Patterns & Principles
• Separation of Concerns:
• Rule definitions (data) are decoupled from deployment logic (script).
• Extensibility:
• New business domains or rule types simply add JSON under a new folder.
• Infrastructure as Code (IaC) Lite:
• JSON files act as declarative inputs to an AWS API.
• Interactive Deployment:
• Script prompts for folder selection, enabling selective installs.
Elements
• Labels: e.g., “Rule Library (JSON)”, “Install-CLRuleLibrary.ps1”, “AWS CLI”, “Amazon Connect CreateRule API”.
• Annotations: note folder hierarchy for clarity (e.g., Airline → Voice → Post-Call → create-*.json).