Skip to content

Commit fea882c

Browse files
committed
Release 1.0.0
1 parent 473043e commit fea882c

File tree

81 files changed

+66021
-21
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+66021
-21
lines changed

.gitignore

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
8+
#ignore cdk-exports.json, as it's generated by CDK
9+
cdk-exports.json
10+
11+
# testing
12+
/coverage
13+
14+
# production
15+
/build
16+
17+
# misc
18+
.env.local
19+
.env.development.local
20+
.env.test.local
21+
.env.production.local
22+
.eslintcache
23+
/.vscode
24+
.vscode
25+
/.idea/
26+
27+
npm-debug.log*
28+
yarn-debug.log*
29+
yarn-error.log*
30+
31+
# General
32+
.DS_Store
33+
.AppleDouble
34+
.LSOverride
35+
36+
# Icon must end with two \r
37+
Icon
38+
39+
40+
# Thumbnails
41+
._*
42+
43+
# Files that might appear in the root of a volume
44+
.DocumentRevisions-V100
45+
.fseventsd
46+
.Spotlight-V100
47+
.TemporaryItems
48+
.Trashes
49+
.VolumeIcon.icns
50+
.com.apple.timemachine.donotpresent
51+
52+
# Directories potentially created on remote AFP share
53+
.AppleDB
54+
.AppleDesktop
55+
Network Trash Folder
56+
Temporary Items
57+
.apdisk
58+
Binary file not shown.

CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Change Log
2+
All notable changes to this project will be documented in this file.
3+
4+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6+
7+
## [1.0.0] - 2022-11-11
8+
Initial Release

LICENSE

+11-12
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
22

3-
Permission is hereby granted, free of charge, to any person obtaining a copy of
4-
this software and associated documentation files (the "Software"), to deal in
5-
the Software without restriction, including without limitation the rights to
6-
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
7-
the Software, and to permit persons to whom the Software is furnished to do so.
8-
9-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
10-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
11-
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
12-
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
13-
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
14-
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
3+
Permission is hereby granted, free of charge, to any person obtaining a copy of this
4+
software and associated documentation files (the "Software"), to deal in the Software
5+
without restriction, including without limitation the rights to use, copy, modify,
6+
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
7+
permit persons to whom the Software is furnished to do so.
158

9+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
10+
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
11+
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
12+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
13+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
14+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

+179-9
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,187 @@
1-
## My Project
1+
# Amazon Connect Global Resiliency dashboard starter project
22

3-
TODO: Fill this README out!
3+
>**BE AWARE:** This code base is an [Open Source](LICENSE) starter project designed to provide a demonstration and a base to start from for specific use cases.
4+
It should not be considered fully Production-ready.
5+
If you plan to deploy and use this in a Production environment please review the [Using this in Production](#using-this-in-production) section at the end for some additional guidance.
46

5-
Be sure to:
7+
## Use-case scenario
8+
9+
[Amazon Connect](https://docs.aws.amazon.com/connect/latest/adminguide/what-is-amazon-connect.html) is an omnichannel cloud contact center that allows you to set up a contact center in just a few steps.
10+
11+
Using [Amazon Connect Global Resiliency](https://docs.aws.amazon.com/connect/latest/adminguide/setup-connect-global-resiliency.html) you can link an Amazon Connect instance to one in another AWS Region and provision and manage phone numbers that are global and accessible in both Regions.
12+
You can distribute traffic between instances in 10% increments allowing failover between regions.
13+
14+
Currently you can interact with these features through the AWS CLI or APIs.
15+
This is a starter project that demonstrates and provides a starting point for how you can build a dashboard that can interact with Amazon Connect's Global Resiliency features through a UI instead.
16+
17+
**Before using the Amazon Connect Global Resiliency features through this dashboard you should review the [requirements](https://docs.aws.amazon.com/connect/latest/adminguide/get-started-connect-global-resiliency.html) and pricing for Amazon Connect.
18+
You may need to engage with your Account team in order to enable these features.**
19+
20+
21+
## The dashboard
22+
The dashboard provides screens that let you navigate through and replicate your instances, view and create traffic distribution groups, and view and associate phone numbers to them. It also lets you redistribute the traffic between instances.
23+
24+
![instance overview screen](documentation/images/instance-overview-screen.png)
25+
26+
27+
### Key limitations
28+
- Once an instance has been replicated it will be empty. You will need to use the AWS Console (and Amazon Connect console) to configure it..
29+
- You cannot claim new numbers from the dashboard, only move them into and out of your traffic distribution group.
30+
- You cannot associate numbers to queues from the dashboard, please ensure any phone numbers moved to your traffic distribution groups are associated to queues on both instances through the standard Amazon Connect dashboard.
31+
- Certain actions can only be taken on the source Connect instance and not on the replica created from it, for instance adding TDGs and assigning numbers to a TDG. This is a limitation of the APIs themselves.
32+
Please ensure that you have all your configuration set up prior to needing failover.
33+
Check the [docs](https://docs.aws.amazon.com/connect/latest/adminguide/setup-connect-global-resiliency.html) for more details on specific operations.
34+
(NOTE: you **can** distribute traffic between instances from either instance).
35+
36+
> This application MUST be deployed into **both regions** where your linked Amazon Connect instances are. This is necessary for a failover situation where you might not be able to access one of the environments.
37+
38+
39+
40+
----
41+
42+
## Solution components
43+
44+
On a high-level, the solution consists of the following components, each contained in these folders:
45+
46+
* **website** - The dashboard front-end written in React
47+
* **cdk-stacks** - AWS CDK stacks:
48+
- `cdk-backend-stack` with all the backend resources needed for the solution (AWS Lambda, Amazon API Gateway, Amazon Cognito, etc)
49+
- `cdk-front-end-stack` with front-end resources for hosting the webapp (Amazon S3, Amazon CloudFront distribution)
50+
51+
52+
### Solution architecture:
53+
54+
![architecture](documentation/diagrams/GlobalResiliency-Architecture.png)
55+
56+
57+
## Solution prerequisites
58+
* AWS Account
59+
* [AWS IAM user](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_users_create.html) with Administrator permissions
60+
* Amazon Connect instance (SSO/SAML enabled)
61+
* [Node](https://nodejs.org/) (v16) and [NPM](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) (v8.5) installed and configured on your computer
62+
* [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html) (v2) installed and configured on your computer
63+
* [AWS CDK](https://docs.aws.amazon.com/cdk/v2/guide/getting_started.html) (v2) installed and configured on your computer
64+
65+
## Solution setup
66+
67+
The below instructions show how to deploy the solution using AWS CDK CLI. If you are using a Windows device please use the [Git BASH](https://gitforwindows.org/) terminal
68+
and use alternative commands where highlighted.
69+
70+
These instructions assume you have completed all the prerequisites, and you have an existing Amazon Connect instance with SSO/SAML enabled.
71+
72+
1. Clone the solution to your computer (using `git clone`)
73+
74+
2. Check AWS CLI
75+
- AWS CDK will use AWS CLI local credentials and region
76+
- check your AWS CLI configuration by running an AWS CLI command (e.g. `aws s3 ls`)
77+
- you can also use profiles (i.e. `export AWS_PROFILE=<<yourProfile>>`)
78+
- you can confirm the configured region with
79+
`aws ec2 describe-availability-zones --output text --query 'AvailabilityZones[0].[RegionName]'`
80+
81+
82+
3. Install NPM packages
83+
- Open your Terminal and navigate to `amazon-connect-global-resiliency/cdk-stacks`
84+
- Run `npm run install:all`
85+
- This script goes through all packages of the solution and installs necessary modules (webapp, cdk-stacks, lambdas, lambda-layers)
86+
87+
88+
4. Configure CDK stacks
89+
- In your terminal, navigate to `amazon-connect-global-resiliency/cdk-stacks`
90+
- To see the full instructions for the configuration script, run
91+
`node configure.js -h`
92+
- For the purpose of this guide, start the configuration script in interactive mode which will guide you through each input one at a time.
93+
(Note, it is possible to configure it via single command, by directly providing parameters, as described in the script help instructions)
94+
95+
`node configure.js -i`
96+
- When prompted, provide the following parameters:
97+
- `cognito-domain-prefix`: Amazon Cognito hosted UI domain prefix, where users will be redirected during the login process.
98+
The domain prefix has to be unique. It can include only lowercase letters, numbers, and hyphens. Do not use a hyphen for the first or last character. Use periods to separate subdomain names. You can't use the text aws, amazon, or cognito in the domain prefix.
99+
- `webapp-api-allowed-origins`: Allowed Origins for web app APIs, please keep * at this point, we will come back to it once our front-end is deployed.
100+
- `cognito-saml-enabled`: as a starting point, set this parameter to `false`. _(If setting to `true`, please review the help instructions for information on additional parameters you will need to fill out: `node configure.js -h`)_
101+
102+
103+
5. Deploy CDK stacks
104+
- In your terminal, navigate to navigate to `amazon-connect-global-resiliency/cdk-stacks`
105+
- Run the script: `npm run build:frontend` (remember to complete this step whenever you want to deploy new front end changes)
106+
- **On Windows devices use `npm run build:frontend:gitbash`**.
107+
- This script builds frontend applications (webapp)
108+
- If you have started with a new environment, please bootstrap CDK: `cdk bootstrap`
109+
- Run the script: `npm run cdk:deploy`
110+
- This script deploys CDK stacks
111+
- Wait for all resources to be provisioned before continuing to the next step
112+
- AWS CDK output will be provided in your Terminal. You should see the Amazon Cognito User Pool Id as `userPoolId` from your Backend stack,
113+
and Amazon CloudFront Distribution URL as `webAppURL` from your Frontend stack.
114+
**Save these values as you will be using them in the next few steps.**
115+
116+
117+
6. Create Cognito User
118+
- To create an Amazon Cognito user, you'll need Cognito User Pool Id (created in step 5 - check for the AWS CDK Output, or check it in your AWS Console > Cognito User Pools)
119+
- Create an Amazon Cognito user either user directly in the [Cognito Console](https://docs.aws.amazon.com/cognito/latest/developerguide/how-to-create-user-accounts.html#creating-a-new-user-using-the-users-tab) or by executing:
120+
`aws cognito-idp admin-create-user --region <<yourDesiredRegion>> --user-pool-id <<yourUserPoolId>> --username <<yourEmailAddress>> --user-attributes "Name=name,Value=<<YourName>>" --desired-delivery-mediums EMAIL`
121+
- You will receive an email, with a temporary password, which you will need in step 7
122+
**You can repeat this step for each person you want to give access to either now or at a later date. Remember to create each user in both regions**
123+
124+
125+
7. Configure API Allowed Origins (optional)
126+
- Cross-origin resource sharing (CORS) is a browser security feature that restricts cross-origin HTTP requests that are initiated from scripts running in the browser. At this point, we can restrict our APIs to be accessible only from our Amazon CloudFront Distribution domain (origin).
127+
- In your terminal, navigate to `amazon-connect-global-resiliency/cdk-stacks`
128+
- Start the configuration script in interactive mode, with additional `-l` (load) parameter
129+
`node configure.js -i -l`
130+
- The script loads all the existing parameters, and prompts for new parameters to be provided
131+
- Accept all the existing parameters, but provide a new value for:
132+
- webapp-api-allowed-origins: Domain of your agent application, in this case Amazon CloudFront Distribution URL. For instance: `https://aaaabbbbcccc.cloudfront.net`
133+
- The script stores the deployment parameters to AWS System Manager Parameter Store
134+
- While in `amazon-connect-global-resiliency/cdk-stacks`, run the deploy script: `npm run cdk:deploy`
135+
- Wait for the CDK stacks to be updated
136+
137+
138+
8. Test the solution
139+
- Open your browser and navigate to Amazon CloudFront Distribution URL (Output to the console and also available in the Outputs of the Frontend Cloudformation Stack)
140+
- On the Login screen, provide your email address and temporary password you received via email
141+
- If logging in the first time you will be prompted to reset your password.
142+
- You should now see a list of your Amazon Connect instances and be able to select one and interact with the Global Resiliency features. You can learn more about the screens from the [User Guide](./Amazon-Connect-Global-Resiliency-Dashboard-User-Guide-v1.pdf).
143+
144+
145+
9. Deploy your solution into the second region
146+
- Switch the region either in your profile or alternatively in your CLI using `export AWS_DEFAULT_REGION=<<desiredregion>>`
147+
- You can confirm the configured region with
148+
`aws ec2 describe-availability-zones --output text --query 'AvailabilityZones[0].[RegionName]'`-
149+
- Rerun steps 4-8 to deploy into the second region
150+
151+
152+
153+
## Clean up
154+
155+
To remove the solution from your account, please follow these steps in each region you have deployed into:
156+
157+
1. Remove CDK Stacks
158+
- Run `cdk destroy --all`
159+
160+
1. Remove deployment parameters from AWS System Manager Parameter Store
161+
- Run `node configure.js -d`
162+
163+
164+
---
165+
166+
## Using this in Production
167+
168+
It is critical that before you use any of this code in Production that you work with your own internal Security and Governance teams to get the appropriate Code and AppSec reviews for your organization.
169+
170+
Although the code has been written with best practices in mind, your own company may require different ones, or have additional rules and restrictions.
171+
172+
You take full ownership and responsibility for the code running in your environment, and are free to make whatever changes you need to.
173+
174+
>It is critical that you test this solution once deployed AND incorporate frequent failover tests throughout the year as part of your organization's larger Disaster Recovery Drills.
175+
176+
**Some of the things you will want to consider**
177+
- The starter project has extensive logging to CloudWatch, but does not have any monitoring or tracing included, you may want to look at using tools like Cloudwatch Alarms and X-ray.
178+
- The starter project uses Cognito user pools, but you may want to consider using Cognito identity pools (federated identities) to connect it to your current identity providers.
179+
- If you decide to use Cognito, you will want to check the password policy matches your expectations and you may want to enable MFA.
180+
- The starter project only provides access through Cloudfront, you will likely want to integrate it with a firewall like AWS WAF, and should verify if any restrictions should be added to your Cloudfront distribution (e.g. geo restrictions).
181+
- The starter project does not currently have tags on any resources
6182

7-
* Change the title in this README
8-
* Edit your repository description on GitHub
9183

10-
## Security
11184

12-
See [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for more information.
13185

14-
## License
15186

16-
This library is licensed under the MIT-0 License. See the LICENSE file.
17187

cdk-stacks/.gitignore

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# *.js
2+
!jest.config.js
3+
*.d.ts
4+
node_modules/
5+
6+
# CDK asset staging directory
7+
.cdk.staging
8+
cdk.out
9+
10+
# Parcel default cache directory
11+
.parcel-cache
12+
13+
# CDK js
14+
cdk-backend*.js
15+
16+
# CDK config, produced by configure.sh
17+
config.cache.json
18+
19+
# Local template file
20+
template.yaml
21+
22+
# CDK context - auto-generated
23+
cdk.context.json
24+
25+
#build folder
26+
build

cdk-stacks/.npmignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
*.ts
2+
!*.d.ts
3+
4+
# CDK asset staging directory
5+
.cdk.staging
6+
cdk.out

cdk-stacks/README.md

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# AWS CDK stacks with all the backend and frontend resources
2+
3+
## Useful commands
4+
5+
* `npm run install:all` install all necessary modules
6+
* `npm run build` compile typescript to js
7+
* `npm run configure` start the configuration script
8+
* `npm run sync-config` download frontend-config.js for local frontend testing (agent-app, demo-website)
9+
* `npm run build:frontend` build frontend applications (agent-app, demo-website)
10+
* `npm run cdk:deploy` deploy backend and frontend stacks to your default AWS account/region
11+
* `npm run build:deploy:all` build frontend applications and deploy stacks to your default AWS account/region
12+
* `npm run build:deploy:all:gitbash` build frontend applications and deploy stacks to your default AWS account/region (WINDOWS)

cdk-stacks/bin/cdk-stacks.ts

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env node
2+
3+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4+
// SPDX-License-Identifier: MIT-0
5+
6+
import 'source-map-support/register';
7+
import {App} from 'aws-cdk-lib'
8+
import { CdkBackendStack } from '../lib/cdk-backend-stack';
9+
import { CdkFrontendStack } from '../lib/cdk-frontend-stack';
10+
import { AwsSolutionsChecks } from 'cdk-nag'
11+
import { Aspects } from 'aws-cdk-lib';
12+
13+
const configParams = require('../config.params.json');
14+
15+
const app = new App();
16+
Aspects.of(app).add(new AwsSolutionsChecks({ verbose: true })) //Comment this line to bypass cdk-nag
17+
18+
console.log("Running in stack mode...");
19+
const cdkBackendStack = new CdkBackendStack(app, configParams['CdkBackendStack'], {
20+
env: { account: process.env.CDK_DEFAULT_ACCOUNT, region: process.env.CDK_DEFAULT_REGION }
21+
});
22+
23+
const cdkFrontendStack = new CdkFrontendStack(app, configParams['CdkFrontendStack'], {
24+
env: { account: process.env.CDK_DEFAULT_ACCOUNT, region: process.env.CDK_DEFAULT_REGION },
25+
webAppBucket: cdkBackendStack.webAppBucket,
26+
accessLogsBucket: cdkBackendStack.accessLogsBucket,
27+
webAppCloudFrontOAI: cdkBackendStack.webAppCloudFrontOAI
28+
});
29+
cdkFrontendStack.addDependency(cdkBackendStack);

0 commit comments

Comments
 (0)