This web application automates the creation of Amazon Connect resources through a simple, user-friendly interface. Users authenticate via AWS Cognito, fill out a form, and trigger the automated creation of hours of operation, queues, contact flows, and phone number assignment - all with a single click.
Primary Objective: Eliminate manual, repetitive tasks in Amazon Connect by providing a self-service portal for creating standardized contact center resources.
Specific Goals:
- Reduce time to provision new contact flows from hours to minutes
- Ensure consistency across all created resources using templates
- Minimize human error in resource configuration
- Enable non-technical users to provision Connect resources safely
- Provide audit trail of all automated resource creation
- Login: User authenticates via AWS Cognito
- Select Instance: Choose the Amazon Connect instance from a dropdown menu
- Configure Hours of Operation:
- Enter a name for the hours of operation
- Select timezone
- Use visual time picker to set operating hours
- Configure Queue:
- Enter queue name
- Automatically links to the hours of operation created above
- Configure Contact Flow:
- Enter contact flow name
- Provide S3 URI to the contact flow template (JSON file)
- System automatically updates the "Set Working Queue" block with the new queue
- Phone Number (Optional):
- System attempts to claim a toll-free number
- Associates it with the newly created contact flow
- If claiming fails, resources are still created successfully
- Submit: Click submit and watch the progress
User Submits Form
↓
API Gateway (Cognito Authorizer validates JWT)
↓
Step Functions State Machine Starts
↓
┌───────────────────────────────────┐
│ Step 1: Validate Input │
└───────────┬───────────────────────┘
↓
┌───────────────────────────────────┐
│ Step 2: Create Hours of Operation│ → Returns HoO ID & ARN
└───────────┬───────────────────────┘
↓
┌───────────────────────────────────┐
│ Step 3: Create Queue │ → Uses HoO ID, Returns Queue ARN
└───────────┬───────────────────────┘
↓
┌───────────────────────────────────┐
│ Step 4: Copy Contact Flow │
│ - Download template from S3 │
│ - Update Queue ARN in JSON │
│ - Create in Connect │ → Returns Contact Flow ID & ARN
└───────────┬───────────────────────┘
↓
┌───────────────────────────────────┐
│ Step 5: Claim Phone Number │ → Returns Phone Number (Optional)
│ (Failure here doesn't rollback) │
└───────────┬───────────────────────┘
↓
┌───────────────────────────────────┐
│ Step 6: Associate Phone to Flow │
└───────────┬───────────────────────┘
↓
┌───────────────────────────────────┐
│ Step 7: Notify User of Success │
└───────────────────────────────────┘
Rollback Logic:
- If Hours of Operation fails → No rollback needed (first step)
- If Queue fails → Delete Hours of Operation
- If Contact Flow fails → Delete Queue → Delete Hours of Operation
- If Phone Claiming fails → NO ROLLBACK (resources remain, phone can be assigned manually later)
- Technology: React 18 with Vite
- Hosting: Amazon S3 (static site) + CloudFront (CDN)
- Authentication: AWS Amplify UI + Cognito User Pools
- Styling: CSS Modules (or Tailwind CSS - TBD)
- State Management: React Context API
- API Layer: Amazon API Gateway (REST API)
- Orchestration: AWS Step Functions (Standard Workflows)
- Compute: AWS Lambda (Python 3.12 with boto3)
- Storage: Amazon S3 (for contact flow templates)
- State Tracking: Amazon DynamoDB (optional, for execution history)
| Service | Purpose | Configuration |
|---|---|---|
| Cognito User Pool | User authentication | Email/password, MFA optional |
| S3 Bucket (Templates) | Store contact flow JSON templates | Versioning enabled, private |
| S3 Bucket (Frontend) | Host React application | Public read, static website hosting |
| CloudFront | CDN for frontend | Origin: S3 frontend bucket |
| API Gateway | REST API endpoints | Cognito authorizer, CORS enabled |
| Step Functions | Workflow orchestration | Standard workflow, 7 Lambda integrations |
| Lambda Functions | Business logic (7 functions total) | Python 3.12, 512MB RAM, 30s timeout |
| IAM Roles | Permissions | Lambda execution role, Step Functions role |
| DynamoDB (optional) | Execution history tracking | On-demand billing |
- Fixed Region:
us-east-1
- Purpose: Authentication and authorization
- Users: Manual creation or self-registration
- Attributes: Email (required), name
- MFA: Optional (can be enabled later)
Bucket Name: connect-automation-templates-{account-id}
├── templates/
│ ├── customer-service-flow.json
│ ├── sales-flow.json
│ └── support-flow.json
└── README.md
Bucket Name: connect-automation-frontend-{account-id}
├── index.html
├── assets/
│ ├── index-{hash}.js
│ └── index-{hash}.css
└── favicon.ico
| Function Name | Purpose | Timeout |
|---|---|---|
ListConnectInstances |
Populate instance dropdown | 10s |
CreateHoursOfOperation |
Create HoO in Connect | 30s |
CreateQueue |
Create queue with HoO reference | 30s |
CopyUpdateContactFlow |
Download template, update queue, create flow | 60s |
ClaimPhoneNumber |
Search and claim toll-free number | 30s |
AssociatePhoneToFlow |
Link phone to contact flow | 30s |
NotifyUser |
Send success/failure notification | 10s |
Rollback Functions:
RollbackHoursOfOperationRollbackQueueRollbackContactFlowRollbackPhoneNumber(only disassociates, doesn't release)
POST /automation/start
- Trigger: User submits form
- Auth: Cognito authorizer (requires valid JWT)
- Request Body: { instanceId, hoursConfig, queueConfig, flowConfig, templateS3Uri }
- Response: { executionArn, message }
GET /automation/status/{executionId}
- Trigger: Frontend polls for status
- Auth: Cognito authorizer
- Response: { status, currentStep, result }
GET /instances
- Trigger: Page load (populate dropdown)
- Auth: Cognito authorizer
- Response: { instances: [{id, name, alias}] }
State Machine Name: ConnectResourceAutomation
States:
- ValidateInput (Lambda)
- CreateHoursOfOperation (Lambda)
- CreateQueue (Lambda)
- CopyAndUpdateContactFlow (Lambda)
- ClaimPhoneNumber (Lambda - optional)
- AssociatePhoneToFlow (Lambda - optional)
- NotifySuccess (Pass state)
- RollbackQueue (Lambda - on error)
- RollbackHoursOfOperation (Lambda - on error)
- NotifyFailure (Pass state)
Execution Input Example:
{
"instanceId": "connect-instance-id-here",
"hoursOfOperation": {
"name": "Business Hours - Sales",
"description": "Mon-Fri 9am-5pm EST",
"timeZone": "America/New_York",
"config": [
{ "Day": "MONDAY", "StartTime": {"Hours": 9, "Minutes": 0}, "EndTime": {"Hours": 17, "Minutes": 0} },
{ "Day": "TUESDAY", "StartTime": {"Hours": 9, "Minutes": 0}, "EndTime": {"Hours": 17, "Minutes": 0} },
{ "Day": "WEDNESDAY", "StartTime": {"Hours": 9, "Minutes": 0}, "EndTime": {"Hours": 17, "Minutes": 0} },
{ "Day": "THURSDAY", "StartTime": {"Hours": 9, "Minutes": 0}, "EndTime": {"Hours": 17, "Minutes": 0} },
{ "Day": "FRIDAY", "StartTime": {"Hours": 9, "Minutes": 0}, "EndTime": {"Hours": 17, "Minutes": 0} }
]
},
"queueConfig": {
"name": "Sales Queue - East",
"description": "Sales team queue for East region",
"maxContacts": 10
},
"flowConfig": {
"name": "Sales IVR - East",
"description": "Customer-facing sales IVR",
"templateS3Uri": "s3://connect-automation-templates-123456789012/templates/sales-flow.json"
},
"claimPhoneNumber": true,
"phoneNumberDescription": "Sales line - East"
}{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"connect:ListInstances",
"connect:CreateHoursOfOperation",
"connect:CreateQueue",
"connect:CreateContactFlow",
"connect:SearchAvailablePhoneNumbers",
"connect:ClaimPhoneNumber",
"connect:AssociatePhoneNumberContactFlow",
"connect:DeleteHoursOfOperation",
"connect:DeleteQueue",
"connect:DeleteContactFlow"
],
"Resource": [
"arn:aws:connect:us-east-1:*:instance/*",
"arn:aws:connect:us-east-1:*:instance/*/queue/*",
"arn:aws:connect:us-east-1:*:instance/*/hours-of-operation/*",
"arn:aws:connect:us-east-1:*:instance/*/contact-flow/*",
"arn:aws:connect:us-east-1:*:phone-number/*"
]
},
{
"Effect": "Allow",
"Action": [
"s3:GetObject"
],
"Resource": "arn:aws:s3:::bucketnamehere-*/*"
},
{
"Effect": "Allow",
"Action": [
"logs:CreateLogGroup",
"logs:CreateLogStream",
"logs:PutLogEvents"
],
"Resource": "arn:aws:logs:us-east-1:*:*"
}
]
}connect-automation-webapp/
├── PROJECT-README.md # This file
├── frontend/ # React application
│ ├── src/
│ │ ├── components/
│ │ │ ├── Login.jsx # Cognito login
│ │ │ ├── InstanceSelector.jsx # Connect instance dropdown
│ │ │ ├── HoursOfOperationForm.jsx # HoO configuration
│ │ │ ├── QueueForm.jsx # Queue configuration
│ │ │ ├── ContactFlowForm.jsx # Flow configuration
│ │ │ ├── TimePicker.jsx # Visual time picker
│ │ │ └── ProgressTracker.jsx # Step Functions progress
│ │ ├── services/
│ │ │ ├── api.js # API Gateway calls
│ │ │ └── auth.js # Cognito auth helpers
│ │ ├── App.jsx # Main app component
│ │ └── main.jsx # Entry point
│ ├── package.json
│ ├── vite.config.js
│ └── index.html
├── infrastructure/ # AWS infrastructure code
│ ├── cloudformation/
│ │ ├── 01-cognito.yaml # User pool
│ │ ├── 02-s3-buckets.yaml # Template & frontend buckets
│ │ ├── 03-lambda-functions.yaml # All Lambda functions
│ │ ├── 04-step-functions.yaml # State machine
│ │ ├── 05-api-gateway.yaml # REST API
│ │ ├── 06-cloudfront.yaml # CDN
│ │ └── main-stack.yaml # Master stack (nested)
│ ├── lambda/ # Lambda function code
│ │ ├── list_instances/
│ │ │ └── index.py
│ │ ├── create_hours_of_operation/
│ │ │ └── index.py
│ │ ├── create_queue/
│ │ │ └── index.py
│ │ ├── copy_update_contact_flow/
│ │ │ └── index.py
│ │ ├── claim_phone_number/
│ │ │ └── index.py
│ │ ├── associate_phone_to_flow/
│ │ │ └── index.py
│ │ └── rollback/
│ │ ├── rollback_hoo.py
│ │ ├── rollback_queue.py
│ │ └── rollback_flow.py
│ └── scripts/
│ ├── deploy.sh # Deployment script
│ └── package-lambdas.sh # ZIP Lambda functions
└── templates/ # Sample contact flow templates
├── sample-customer-service-flow.json
└── README.md
- AWS Account with Amazon Connect instance created
- AWS CLI configured with appropriate credentials
- Node.js 18+ and npm
- Python 3.12+ (for Lambda functions)
-
Navigate to frontend directory:
cd /connect-contactflow-generator/frontend -
Install dependencies:
npm install
-
Configure environment variables: Create
.env.localfile:VITE_AWS_REGION=us-east-1 VITE_COGNITO_USER_POOL_ID=your-user-pool-id VITE_COGNITO_CLIENT_ID=your-client-id VITE_API_GATEWAY_URL=your-api-url
-
Start development server:
npm run dev
-
Access locally: Open browser to
http://localhost:5173
cd infrastructure
./scripts/deploy.shThis will:
- Create all CloudFormation stacks
- Package and upload Lambda functions
- Deploy API Gateway
- Create Cognito User Pool
- Set up S3 buckets
- Configure CloudFront distribution
aws s3 cp templates/sample-customer-service-flow.json \
s3://connect-automation-templates-{account-id}/templates/cd frontend
npm run build
aws s3 sync dist/ s3://connect-automation-frontend-{account-id}/
aws cloudfront create-invalidation --distribution-id {dist-id} --paths "/*"aws cognito-idp admin-create-user \
--user-pool-id {pool-id} \
--username admin@example.com \
--user-attributes Name=email,Value=admin@example.com \
--temporary-password TempPass123!cd frontend
npm run dev- Test UI components visually
- Verify form validation
- Test time picker functionality
- Login with test Cognito user
- Fill out form with test data
- Monitor Step Functions execution in AWS Console
- Verify resources created in Amazon Connect console
- Test phone number claiming (if applicable)
- Modify Lambda to intentionally fail at specific step
- Submit form
- Verify rollback deletes resources in correct order
- Check CloudWatch Logs for error messages
Create dashboard to monitor:
- Step Functions execution success rate
- Lambda function errors
- API Gateway 4xx/5xx errors
- Average execution time
- Step Functions: View execution history in console
- Lambda: CloudWatch Logs group per function
- API Gateway: Access logs (if enabled)