Step 1: Prepare your Connect Customer instance
In this step, you prepare the test Connect Customer instance for the guide and for a test chat. Do these tasks in order:
-
If you don't have a test instance, create one.
-
Enable Connect Customer on the instance.
-
Check the instance.
-
Create the test agent and its Modern layout, with the test setup script (recommended) or in the Connect Customer admin website.
-
Give your security profile the permissions to edit the guide's flows.
Several tasks use the Connect Customer admin website. To open it, do one of the following:
-
In the AWS Management Console, search for Connect Customer and choose it, choose the instance alias, and choose Log in for emergency access. Use emergency access on the test instance; in production, sign in as a named user.
-
Open the instance's access URL, which the check in this step prints, and sign in with your Connect Customer user.
Create a test instance
To create a test instance
-
Follow Create a Connect Customer instance in the Connect Customer console, in a Region from the prerequisites.
-
Choose Store users in Amazon Connect.
-
In Add administrator, choose Specify an administrator, so that you can sign in to the admin website as that user.
-
To test with calls, keep Allow incoming calls selected in the telephony options. You claim a test phone number in Step 4.
Enable Connect Customer on the instance
The External Tool block, which the guide uses to call the gateway, works only on an instance with Connect Customer enabled. Without it, the stack fails to deploy. An instance created before Connect Customer was available might need to be updated to it. The change applies at once and also sets the plan that the External Tool block needs; no API sets it.
To enable Connect Customer on the instance
-
In the AWS Management Console, search for Connect Customer and choose it, then choose the instance alias.
-
In the navigation pane, choose Customer. If the Confirm Amazon Connect Customer section shows Amazon Connect Customer Basic, choose Change. It doesn't ask you to confirm.
If the navigation pane shows Connect Customer instead, and the Enable Connect Customer across your entire instance section shows Not enabled, choose Enable.
The check that follows prints Connect Customer plan (must be true):
true when the instance is ready. See Enable Connect Customer. For pricing, see Connect Customer
pricing
Check the instance
The check confirms that your AWS CLI has the commands this guide uses, that the instance is on Connect Customer, and that it uses a service-linked role, which the integration needs. It also prints the instance's ARN and access URL, its Connect assistant, and its queues with their ARNs, which you enter when you deploy the stack in Step 3. It changes nothing.
To check the instance
-
Sign in to the AWS Management Console, open https://console.aws.amazon.com/cloudshell/home
, and in the Region selector in the navigation bar, choose your instance's Region. If CloudShell isn't available in that Region, it opens in a nearby Region; type your instance's Region at the prompt in the next step. To use your computer instead, see Where to run the AWS commands. -
Expand the instance check script, copy it, paste it at the prompt, and press Enter. It asks for the Region and the instance alias. If the default Region in brackets isn't your instance's Region, type your instance's Region at the prompt. When the Region has more than one instance, the alias has no default: type it from the list.
( R=${AWS_REGION:-us-east-1} printf 'Region of your Connect Customer instance [%s]: ' "$R"; read -r REGION; REGION=${REGION:-$R} echo "AWS CLI: $(aws --version 2>&1 | cut -d' ' -f1)" if AC=$(aws bedrock-agentcore-control list-gateways --region "$REGION" --max-results 1 2>&1 >/dev/null); then echo "AgentCore commands: ok" else case "$AC" in *"nvalid choice"*) echo "AgentCore commands: missing; update the AWS CLI" ;; *AccessDenied*) echo "AgentCore commands: ok, but your IAM identity can't list gateways" ;; *) echo "AgentCore commands: failed: $AC" ;; esac fi ACCOUNT=$(aws sts get-caller-identity --region "$REGION" --query Account --output text) || exit 1 echo "AWS account: $ACCOUNT" ALIASES=$(aws connect list-instances --region "$REGION" --query 'InstanceSummaryList[].InstanceAlias' --output text) || exit 1 ALIASES=$(echo "$ALIASES" | tr '\t' '\n' | grep .) [ -n "$ALIASES" ] || { echo "No Connect Customer instances in $REGION. Check the Region."; exit 1; } echo "Connect Customer instances in $REGION:"; echo "$ALIASES" | sed 's/^/ /' if [ "$(echo "$ALIASES" | wc -l)" -eq 1 ]; then printf 'Instance alias [%s]: ' "$ALIASES"; read -r ALIAS; ALIAS=${ALIAS:-$ALIASES} else printf 'Instance alias, typed from the list (there is no default): '; read -r ALIAS fi [ -n "$ALIAS" ] || { echo "No instance alias entered; nothing was changed."; exit 1; } ID=$(aws connect list-instances --region "$REGION" --query "InstanceSummaryList[?InstanceAlias=='$ALIAS'].Id" --output text | grep -m 1 .) [ -n "$ID" ] || { echo "No instance named $ALIAS in $REGION. Check the Region and the alias."; exit 1; } echo "Connect Customer plan (must be true): $(aws connect describe-instance-attribute --region "$REGION" --instance-id "$ID" \ --attribute-type MAX_PACKAGE --query Attribute.Value --output text)" echo "Connect instance ARN: $(aws connect describe-instance --region "$REGION" --instance-id "$ID" --query Instance.Arn --output text)" URL=$(aws connect describe-instance --region "$REGION" --instance-id "$ID" --query Instance.InstanceAccessUrl --output text) echo "Connect instance access URL: ${URL%/}" echo "Service role (must contain aws-service-role): $(aws connect describe-instance --region "$REGION" --instance-id "$ID" --query Instance.ServiceRole --output text)" ASSISTANT=$(aws connect list-integration-associations --region "$REGION" --instance-id "$ID" --integration-type WISDOM_ASSISTANT \ --query 'IntegrationAssociationSummaryList[0].IntegrationArn' --output text) case "$ASSISTANT" in arn:*) ;; *) ASSISTANT=none ;; esac echo "Connect assistant (Existing Connect assistant field): $ASSISTANT" echo "Queues, each with its ARN (for Test queue ARN, if you create the test agent in the admin website):" aws connect list-queues --region "$REGION" --instance-id "$ID" --queue-types STANDARD \ --query 'QueueSummaryList[].[Name,Arn]' --output text | sed 's/^/ /' )
It prints the AWS CLI version, AgentCore commands: ok, your
account ID, your instances, Connect Customer plan (must be true):
true, the instance's ARN and access URL, its service role, its
Connect assistant's ARN or none, and its queues with their ARNs.
Keep this output: Step 3 uses the ARN, the access URL and the Connect assistant
line, and Step 4 uses the access URL. If you create the test agent in the admin
website rather than with the test setup script, Step 3 also uses the ARN of the
test agent's queue from this list. To print the values again,
run the block again. If it prints something else:
-
AgentCore commands: ok, but your IAM identity can't list gateways: the CLI has the gateway commands, but your identity lacksbedrock-agentcore:ListGateways. The stack still deploys if your identity can create the stack's resources; see CloudFormation template reference for the permissions. -
AgentCore commands: missing: the AWS CLI is older than the gateway commands. In CloudShell, close and reopen it; on your computer, update the AWS CLI. See Installing or updating to the latest version of the AWS CLI. -
Service role (must contain aws-service-role)withoutaws-service-role: the instance doesn't use a service-linked role. See Use service-linked roles for Connect Customer. -
An
AccessDeniedException: your IAM identity can't read Connect Customer instances. Ask your AWS administrator for read access to Connect Customer. -
No instance named: the instance is in another Region, or the alias is misspelled. Run the block again with the Region that the instance's ARN shows. -
Connect Customer plan (must be true): false: enable Connect Customer on the instance, as Enable Connect Customer on the instance describes, and run the block again.
Create the test agent and its Modern layout
The test agent is the Connect Customer user who accepts the test chat or test call in Step 4. It needs a queue, a routing profile, a security profile, a user and a Modern workspace, none of which changes what your other agents have. The test setup script creates all five in one run; to create them yourself, use the admin website steps.
After you deploy the stack, you add the flow modules agent assist runs to the test security profile; see Give agents agent assist in the agent workspace.
( set -uo pipefail TAG=rtdi-test-setup ask() { local reply; read -r -p "$1 [$2]: " reply; printf '%s' "${reply:-$2}"; } say() { printf '%-8s %s\n' "$1" "$2"; } stop() { echo "STOPPED: $1"; exit 1; } # The AWS CLI applies --query to each page of a list, so a lookup filters, and the first non-empty line is the match. first() { grep -m 1 . || true; } REGION=$(ask "Region of your Connect Customer instance" "${AWS_REGION:-us-east-1}") ACTION=$(ask "create (set up the test resources) or remove (delete them)" "create") case "$ACTION" in create|remove) ;; *) stop "type create or remove." ;; esac c() { aws connect "$@" --region "$REGION"; } echo "Connect Customer instances in $REGION:" ALIASES=$(c list-instances --query 'InstanceSummaryList[].InstanceAlias' --output text) || stop "couldn't list instances in $REGION; see the error above." ALIASES=$(echo "$ALIASES" | tr '\t' '\n' | grep . || true) [ -n "$ALIASES" ] || stop "no instances in $REGION. Check the Region." echo "$ALIASES" | sed 's/^/ /' if [ "$(echo "$ALIASES" | wc -l)" -eq 1 ]; then ALIAS=$(ask "Instance alias" "$ALIASES") else read -r -p "Instance alias, typed from the list (there is no default): " ALIAS fi [ -n "$ALIAS" ] || stop "no instance alias entered." ID=$(c list-instances --query "InstanceSummaryList[?InstanceAlias=='$ALIAS'].Id" --output text) || stop "couldn't list instances in $REGION; see the error above." ID=$(echo "$ID" | first) [ -n "$ID" ] || stop "no instance named $ALIAS in $REGION." ARN_BASE="" IDM="" read -r ARN_BASE IDM < <(c describe-instance --instance-id "$ID" --query 'Instance.[Arn,IdentityManagementType]' --output text) case "$ARN_BASE" in arn:*) ;; *) stop "couldn't read the instance $ALIAS; see the error above." ;; esac PARTITION=${ARN_BASE#arn:}; PARTITION=${PARTITION%%:*} if [ "$IDM" = CONNECT_MANAGED ]; then USERNAME=$(ask "Test agent's username" "rtdi-test-agent") else echo "This instance signs users in through $IDM, so the test agent has no password in Connect Customer." USERNAME=$(ask "Username of a user in your identity provider or directory who isn't yet a Connect Customer user" "") [ -n "$USERNAME" ] || stop "enter the username of a user that exists in your identity provider or directory." fi # With remove, a failed read is counted and the script carries on; with create, it stops. SOFT=no FAILED=0 failed() { [ "$SOFT" = yes ] || stop "$1" echo "Failed $1"; FAILED=$((FAILED + 1)) } # lookup TYPE LIST-COMMAND...: sets FID and FARN to the resource the filter matches, None if there is none, # or Error if the list failed during remove. lookup() { local type=$1 out line; shift FID=None FARN=None out=$(c "$@" --output text) || { failed "couldn't read $type in $ALIAS; see the error above."; FID=Error; return; } line=$(echo "$out" | first) [ -z "$line" ] || read -r FID FARN <<< "$line" } queue() { lookup queues list-queues --instance-id "$ID" --queue-types STANDARD --query "QueueSummaryList[?Name=='$1'].[Id,Arn]"; } routing() { lookup "routing profiles" list-routing-profiles --instance-id "$ID" --query "RoutingProfileSummaryList[?Name=='$1'].[Id,Arn]"; } profile() { lookup "security profiles" list-security-profiles --instance-id "$ID" --query "SecurityProfileSummaryList[?Name=='$1'].[Id,Arn]"; } user() { lookup users list-users --instance-id "$ID" --query "UserSummaryList[?Username=='$1'].[Id,Arn]"; } workspace() { lookup workspaces list-workspaces --instance-id "$ID" --query "WorkspaceSummaryList[?Name=='$1'].[Id,Arn]"; } # ours TYPE: sets OURS to yes if this script created the resource FARN, from the tag it adds to everything it creates, # or to Error if the tags couldn't be read during remove. ours() { local value value=$(c list-tags-for-resource --resource-arn "$FARN" --query "tags.\"$TAG\"" --output text) \ || { failed "couldn't read the tags of the $1 in $ALIAS; see the error above."; OURS=Error; return; } OURS=no; [ "$value" = true ] && OURS=yes } # mine TYPE NAME: stops if FID exists but this script didn't create it, so the script changes nothing. mine() { [ "$FID" = None ] && return 0 ours "$1" [ "$OURS" = yes ] || stop "the $1 $2 already exists and this script didn't create it, so the script leaves it alone. Nothing was changed." } if [ "$ACTION" = remove ]; then OK=$(ask "Delete the test resources that this script created in $ALIAS, and the user $USERNAME? yes or no" "no") [ "$OK" = yes ] || { echo "Nothing was deleted."; exit 0; } SOFT=yes # gone TYPE NAME DELETE-COMMAND...: deletes the resource FID if this script created it. gone() { local type=$1 name=$2; shift 2 [ "$FID" != Error ] || return 0 if [ "$FID" = None ]; then say Skipped "$type $name: not found"; return; fi ours "$type" [ "$OURS" != Error ] || return 0 if [ "$OURS" != yes ]; then say Skipped "$type $name: not created by this script"; return; fi if c "$@" "$FID"; then say Deleted "$type $name"; else failed "couldn't delete the $type $name; see the error above."; fi } workspace rtdi-modern; gone workspace rtdi-modern delete-workspace --instance-id "$ID" --workspace-id user "$USERNAME"; gone user "$USERNAME" delete-user --instance-id "$ID" --user-id profile rtdi-test-agent; gone "security profile" rtdi-test-agent delete-security-profile --instance-id "$ID" --security-profile-id routing rtdi-test-routing; gone "routing profile" rtdi-test-routing delete-routing-profile --instance-id "$ID" --routing-profile-id queue rtdi-test-queue; gone queue rtdi-test-queue delete-queue --instance-id "$ID" --queue-id [ "$FAILED" -eq 0 ] || { echo "NOT DONE: $FAILED resources weren't deleted; fix the error above and run remove again."; exit 1; } echo "DONE. Your other users and every resource this script did not create are unchanged." exit 0 fi # Every name is checked before anything is created, so the script changes nothing if a name belongs to someone else. user "$USERNAME"; U=$FID UARN=$FARN if [ "$U" != None ]; then ours user [ "$OURS" = yes ] || stop "the user $USERNAME already exists and this script didn't create it, so the script leaves it alone. Run it again with a new username." fi queue rtdi-test-queue; mine queue rtdi-test-queue routing rtdi-test-routing; mine "routing profile" rtdi-test-routing profile rtdi-test-agent; mine "security profile" rtdi-test-agent workspace rtdi-modern; mine workspace rtdi-modern PW="" if [ "$U" = None ] && [ "$IDM" = CONNECT_MANAGED ]; then IFS= read -r -s -p "Password for $USERNAME, 8 to 64 characters with an uppercase letter, a lowercase letter and a number (input hidden): " PW; echo { [ ${#PW} -ge 8 ] && [ ${#PW} -le 64 ] && [[ "$PW" =~ [A-Z] ]] && [[ "$PW" =~ [a-z] ]] && [[ "$PW" =~ [0-9] ]]; } \ || stop "the password needs 8 to 64 characters, with an uppercase letter, a lowercase letter and a number. Nothing was created." [[ ! "$PW" =~ [[:cntrl:]] ]] || stop "the password can't contain tabs or other control characters. Nothing was created." fi # 1. The test queue, rtdi-test-queue, on the instance's Basic Hours or its first hours of operation. queue rtdi-test-queue; Q=$FID QARN=$FARN if [ "$Q" != None ]; then say Reused "queue rtdi-test-queue" else H=$(c list-hours-of-operations --instance-id "$ID" --query "HoursOfOperationSummaryList[?Name=='Basic Hours'].Id" --output text) \ || stop "couldn't read hours of operation in $ALIAS; see the error above." H=$(echo "$H" | first) if [ -z "$H" ]; then H=$(c list-hours-of-operations --instance-id "$ID" --query 'HoursOfOperationSummaryList[].Id' --output text) \ || stop "couldn't read hours of operation in $ALIAS; see the error above." H=$(echo "$H" | tr '\t' '\n' | first) fi [ -n "$H" ] || stop "the instance has no hours of operation for the test queue." Q="" QARN="" read -r Q QARN < <(c create-queue --instance-id "$ID" --name rtdi-test-queue --description "Test queue for real-time data integration" \ --hours-of-operation-id "$H" --tags "$TAG=true" --query '[QueueId,QueueArn]' --output text) [ -n "$Q" ] || stop "couldn't create the queue rtdi-test-queue." say Created "queue rtdi-test-queue" fi # 2. The routing profile: chat from the test queue, one chat at a time. routing rtdi-test-routing; RP=$FID if [ "$RP" != None ]; then say Reused "routing profile rtdi-test-routing" else RP=$(c create-routing-profile --instance-id "$ID" --name rtdi-test-routing \ --description "Test agent for real-time data integration" --default-outbound-queue-id "$Q" \ --media-concurrencies Channel=CHAT,Concurrency=1 \ --tags "$TAG=true" --query RoutingProfileId --output text) || stop "couldn't create the routing profile rtdi-test-routing." say Created "routing profile rtdi-test-routing" fi HAVE=$(c list-routing-profile-queues --instance-id "$ID" --routing-profile-id "$RP" \ --query "RoutingProfileQueueConfigSummaryList[?QueueId=='$Q' && Channel=='CHAT'].QueueId" --output text) \ || stop "couldn't read the queues of rtdi-test-routing in $ALIAS; see the error above." if [ -z "$(echo "$HAVE" | first)" ]; then c associate-routing-profile-queues --instance-id "$ID" --routing-profile-id "$RP" \ --queue-configs "QueueReference={QueueId=$Q,Channel=CHAT},Priority=1,Delay=0" || stop "couldn't add rtdi-test-queue to rtdi-test-routing." say Added "rtdi-test-queue for chat to rtdi-test-routing" fi # 3. The security profile: Access Contact Control Panel and Custom views for the guide, and Connect assistant - View, # Views - View and ContactFlowModules.Execute (run flow modules as tools; the admin website grants it when you tick a # module under Flow modules) for the agent assist test. An existing one is reused as it is. profile rtdi-test-agent; P=$FID if [ "$P" != None ]; then say Reused "security profile rtdi-test-agent" else P=$(c create-security-profile --instance-id "$ID" --security-profile-name rtdi-test-agent \ --description "Test agent for real-time data integration" \ --permissions BasicAgentAccess CustomViews.Access Wisdom.View Views.View ContactFlowModules.Execute \ --tags "$TAG=true" --query SecurityProfileId --output text) || stop "couldn't create the security profile rtdi-test-agent." say Created "security profile rtdi-test-agent" fi # 4. The test agent, with only the test routing profile and the test security profile. if [ "$U" != None ]; then c update-user-routing-profile --instance-id "$ID" --user-id "$U" --routing-profile-id "$RP" && c update-user-security-profiles --instance-id "$ID" --user-id "$U" --security-profile-ids "$P" \ || stop "couldn't update the user $USERNAME." say Reused "user $USERNAME" else # The password goes to the AWS CLI in a temporary file that only you can read, which the script deletes, so it never # appears in the process list. PWJ=${PW//\\/\\\\}; PWJ=${PWJ//\"/\\\"} INPUT="{}"; [ -z "$PW" ] || INPUT="{\"Password\":\"$PWJ\"}" PWF=$(umask 077; mktemp) || stop "couldn't create a temporary file for the password." trap 'rm -f "$PWF"' EXIT printf '%s' "$INPUT" > "$PWF" U="" UARN="" read -r U UARN < <(c create-user --instance-id "$ID" --username "$USERNAME" --cli-input-json "file://$PWF" \ --identity-info FirstName=Test,LastName=Agent --phone-config PhoneType=SOFT_PHONE,AfterContactWorkTimeLimit=0 \ --security-profile-ids "$P" --routing-profile-id "$RP" --tags "$TAG=true" --query '[UserId,UserArn]' --output text) rm -f "$PWF"; trap - EXIT PW="" PWJ="" INPUT="" [ -n "$U" ] || stop "couldn't create the user $USERNAME." say Created "user $USERNAME" fi # 5. The workspace: the Modern layout, visible only to the users it is assigned to, assigned to the test agent. workspace rtdi-modern; W=$FID if [ "$W" != None ]; then say Reused "workspace rtdi-modern" else W=$(c create-workspace --instance-id "$ID" --name rtdi-modern --description "Modern layout for the real-time data integration test agent" \ --tags "$TAG=true" --query WorkspaceId --output text) || stop "couldn't create the workspace rtdi-modern." say Created "workspace rtdi-modern" fi PAGE=$(c list-workspace-pages --instance-id "$ID" --workspace-id "$W" --query "WorkspacePageList[?Page=='connect:AGENT'].ResourceArn" --output text) \ || stop "couldn't read the pages of rtdi-modern in $ALIAS; see the error above." PAGE_OK=yes if [ -z "$(echo "$PAGE" | first)" ]; then if c create-workspace-page --instance-id "$ID" --workspace-id "$W" --page connect:AGENT \ --resource-arn "arn:$PARTITION:connect:$REGION:aws:view/agent-workspace-modern:1" >/dev/null; then say Added "the Agent Workspace - Modern page to rtdi-modern" else PAGE_OK=no echo "Couldn't add the page; see the error above." fi fi c update-workspace-visibility --instance-id "$ID" --workspace-id "$W" --visibility ASSIGNED || stop "couldn't set rtdi-modern to assigned users only." c associate-workspace --instance-id "$ID" --workspace-id "$W" --resource-arns "$UARN" >/dev/null \ || stop "couldn't assign rtdi-modern to $USERNAME." say Assigned "rtdi-modern to $USERNAME only" URL=$(c describe-instance --instance-id "$ID" --query Instance.InstanceAccessUrl --output text) if [ "$PAGE_OK" = yes ]; then echo "DONE: the test agent is ready." else echo "NOT DONE: add the Modern layout in the admin website. Choose UI Management, Workspaces and rtdi-modern. In Pages, choose" echo " Add page and Use existing Connect page, then Agent Workspace, Agent Workspace - Modern and view version 1, and Save." fi echo "Test queue ARN (Test queue ARN field in Step 3): $QARN" echo "Agent workspace for the test agent: ${URL%/}/agent/ (sign in as $USERNAME)" [ "$IDM" = CONNECT_MANAGED ] || echo "This instance signs users in through $IDM: sign in as $USERNAME through it." )
The test agent sees the Modern layout the next time they open the agent workspace. See Assign an agent workspace layout to agents. If your instance signs users in through SAML, Connect Customer users have no password, so the user must also exist in your identity provider before you can sign in as it.
The agent workspace also shows the Connect Customer Customer Profiles, Cases and Connect assistant apps to agents whose security profile allows them. These apps hold Connect Customer records, not Salesforce records, and the guide never reads or writes them; see Customer Profiles and Cases. On an instance where an app isn't set up, an agent who has its permission, such as a test agent with the Admin security profile's permissions, sees a message such as The Cases feature hasn't been set up.
To hide an app your agents don't use, in the Connect Customer admin website choose Users, Security profiles and the agents' security profile, clear Customer profiles - View, Cases - View or Connect assistant - View, and choose Save. Keep Connect assistant - View to use the Connect assistant with the guide; see Use the Connect assistant with real-time data integration and List of security profile permissions.
Give your security profile the permissions to edit the guide's flows
Step-by-step guides need security profile permissions for whoever edits and publishes the guide's flows, as well as the test agent's. See Enable step-by-step guides. Check that your security profile has each of these permissions, including Views - View, which the Admin security profile doesn't always have.
To give your security profile the permissions
-
In the Connect Customer admin website, choose Users, Security profiles, and your own security profile. In Channels and flows, select View for Views, and Create, Edit and Publish for Flows. Choose Save.
Every step-by-step guide runs as a chat contact, so the guide counts toward the instance's concurrent active chats quota. For the quota, see Connect Customer service quotas. Check it before you go live; see Plan for scale.