# aws-samples/amazon-connect-workshop architecture

> Architecture diagram of the GitHub repository aws-samples/amazon-connect-workshop, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-08-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/aws-samples/amazon-connect-workshop
- Repository: https://github.com/aws-samples/amazon-connect-workshop

## Overview

##### Project Type and Purpose
- This is a “serverless telephony” workshop repository demonstrating how to build a modern contact center using AWS services (Amazon Connect, Amazon Lex, AWS Lambda, DynamoDB, SQS).
- It provides CloudFormation templates (`full-template.yml`), contact-flow definitions, a pre-built Lex bot (`ConnectBot.zip`), and instructions to wire up an end-to-end IVR and callback system.

a. Amazon Connect Instance
- Telephony front-end (Contact Control Panel / CCP)
- Hosts Contact Flows imported from the `contact-flows/` folders
b. Amazon Lex Bot (“ConnectBot”)
- Conversational router for voice intent (WaitOnHold, CallBack, Emergency)
c. AWS Lambda Functions (deployed via CloudFormation)
- GetHotMessageLambda
- ContactLookupLambda
- ContactRouterLambda
- PutContactInQueueLambda
- InitiateOutboundDialLambda
d. DynamoDB Tables
- ContactHistoryTable (tracks caller status)
- HotMessageTable (stores dynamic messages)
e. SQS Queue
- OutboundDialQueue (triggers outbound survey calls)
f. IAM Roles & Policies
- Permissions linking Connect → Lambda, Lex, SQS, DynamoDB
g. CloudFormation Stack
- Orchestrates the creation of the above resources

##### Relationships and Data Flows
- Inbound call arrives at Amazon Connect
→ EntryPoint Contact Flow
→ Invoke GetHotMessageLambda
→ Invoke ContactLookupLambda
→ Ask user via Amazon Lex
→ Branch to one of:
- InboundCallRouter
- InboundLexRouter
- TransferToQueue or TransferToCallbackQueue
- OnCallFlow (Invoke ContactRouterLambda)
- When a caller opts for callback:
→ PutContactInQueueLambda posts to OutboundDialQueue
→ SQS triggers InitiateOutboundDialLambda
→ InitiateOutboundDialLambda calls Connect outbound survey flow (CallerSurvey)
- Lambdas interact with DynamoDB tables to read/write caller state or hot messages.

##### Architectural Patterns and Principles
- Serverless microservices: each Lambda handles a single responsibility
- Event-driven: SQS queue triggers asynchronous outbound calls
- Configuration-as-code: CloudFormation defines infra
- Clear separation of concerns:
- Telephony (Connect) vs. Conversational AI (Lex) vs. Business logic (Lambda) vs. Data (DynamoDB / SQS)

## Diagram (Mermaid)

```mermaid
flowchart TD
    Start["Inbound Call"]:::external
    subgraph "AWS Connect"
        direction TB
        CCP["Contact Control Panel (CCP)"]:::telephony
        EF["EntryPoint"]:::telephony
        ICR["InboundCallRouter"]:::telephony
        ILR["InboundLexRouter"]:::telephony
        TTQ["TransferToQueue"]:::telephony
        TTCQ["TransferToCallbackQueue"]:::telephony
        OCF["OnCallFlow"]:::telephony
        CS["CallerSurvey"]:::telephony
    end

    subgraph "Amazon Lex"
        direction TB
        LEX["ConnectBot"]:::ai
    end

    subgraph "AWS Lambda"
        direction TB
        GHM["GetHotMessageLambda"]:::compute
        CLK["ContactLookupLambda"]:::compute
        CR["ContactRouterLambda"]:::compute
        PQ["PutContactInQueueLambda"]:::compute
        IOD["InitiateOutboundDialLambda"]:::compute
    end

    subgraph "DynamoDB"
        direction TB
        CHT["ContactHistoryTable"]:::data
        HMT["HotMessageTable"]:::data
    end

    subgraph "SQS"
        direction TB
        ODQ["OutboundDialQueue"]:::messaging
    end

    subgraph "CloudFormation"
        direction TB
        Cfn["full-template.yml"]:::infra
    end

    Start -->|"StartCall"| CCP
    CCP -->|"InvokeFlow"| EF
    EF -->|"InvokeFunction"| GHM
    EF -->|"InvokeFunction"| CLK
    EF -->|"AskUser"| LEX
    LEX -->|"RouteIntent"| ICR
    LEX -->|"RouteIntent"| ILR
    LEX -->|"RouteIntent"| TTQ
    LEX -->|"RouteIntent"| TTCQ
    LEX -->|"RouteIntent"| OCF

    ICR -->|"InvokeFunction"| CR
    ILR -->|"InvokeFunction"| CR
    TTQ -->|"InvokeFunction"| PQ
    TTCQ -->|"InvokeFunction"| PQ
    OCF -->|"InvokeFunction"| CR

    PQ -->|"PostMessage"| ODQ
    ODQ -->|"Trigger"| IOD
    IOD -->|"StartOutboundCall"| CS

    GHM -->|"QueryTable"| HMT
    CLK -->|"QueryTable"| CHT
    CR -->|"QueryTable/Update"| CHT

    Cfn -.-> GHM
    Cfn -.-> CLK
    Cfn -.-> CR
    Cfn -.-> PQ
    Cfn -.-> IOD
    Cfn -.-> CHT
    Cfn -.-> HMT
    Cfn -.-> ODQ

    click EF "https://github.com/aws-samples/amazon-connect-workshop/tree/master/contact-flows/EntryPoint"
    click ICR "https://github.com/aws-samples/amazon-connect-workshop/tree/master/contact-flows/InboundCallRouter"
    click ILR "https://github.com/aws-samples/amazon-connect-workshop/tree/master/contact-flows/InboundLexRouter"
    click TTQ "https://github.com/aws-samples/amazon-connect-workshop/tree/master/contact-flows/TransferToQueue"
    click TTCQ "https://github.com/aws-samples/amazon-connect-workshop/tree/master/contact-flows/TransferToCallbackQueue"
    click OCF "https://github.com/aws-samples/amazon-connect-workshop/tree/master/contact-flows/OnCallFlow"
    click CS "https://github.com/aws-samples/amazon-connect-workshop/tree/master/contact-flows/CallerSurvey"
    click LEX "https://github.com/aws-samples/amazon-connect-workshop/blob/master/ConnectBot.zip"
    click Cfn "https://github.com/aws-samples/amazon-connect-workshop/blob/master/full-template.yml"

    classDef telephony fill:#cce5ff,stroke:#3385ff,color:#000
    classDef compute fill:#d4edda,stroke:#28a745,color:#000
    classDef data fill:#fff3cd,stroke:#ffcd39,color:#000
    classDef messaging fill:#ffe5b4,stroke:#ff8c00,color:#000
    classDef ai fill:#e2e3f3,stroke:#6f42c1,color:#000
    classDef infra fill:#e2e3e5,stroke:#6c757d,color:#000
    classDef external fill:#f8f9fa,stroke:#adb5bd,color:#000
```
