CloudFormation template reference
The template is for Salesforce. To connect another system, add it to the gateway the stack creates; see Add the system to the gateway.
| Resource | Created by |
|---|---|
Integration user and API credentials (Step 2) |
You, in Salesforce |
Token refresh function, which gets a Salesforce access token with your consumer secret every five minutes and stores it in a token secret, and the API key credential provider in AgentCore Identity that sends that token on every call |
Stack |
Gateway, with your instance's Discovery URL, protocol version and its own ID in Allowed audiences |
Stack. A step that runs during deployment sets the audience, because a CloudFormation resource can't refer to its own ID. |
Salesforce target, |
Stack |
Registration of the gateway with your instance |
Stack |
Change alerts for the gateway, target, credential provider, token secret, token refresh function and registration |
Stack |
Health dashboard
( |
Stack |
Account and case guide: inbound flow, guide flow, wrap-up flow
when Wrap-up flow and form is
|
Stack |
The AI resources:
|
Stack |
The assistant's Self service default and the AI agents' security profile associations |
You, after each create or update |
Your own inbound flow (Step 4) |
You |
Use the gateway-only template if you build your own guide on the gateway; deploy it in the same way as in Step 3: Deploy the CloudFormation stack. It asks only for the Connect Customer and Salesforce fields, and the optional custom operations file; it has no test queue, wrap-up, Find the record or AI self-service fields. Its default stack name is the same as the other template's, so use a different stack name if you already have a stack in the account and Region.
| Connect Customer Region of your instance | Template |
|---|---|
US East (N. Virginia) ( |
|
US West (Oregon) ( |
|
Africa (Cape Town) ( |
Not available: neither the External Tool block nor Amazon Bedrock AgentCore Gateway is available in this Region. |
Asia Pacific (Seoul) ( |
|
Asia Pacific (Singapore) ( |
|
Asia Pacific (Sydney) ( |
|
Asia Pacific (Tokyo) ( |
|
Canada (Central) ( |
|
Europe (Frankfurt) ( |
|
Europe (London) ( |
|
AWS GovCloud (US-West) ( |
Not available: the External Tool block isn't available in this Region. |
| Template file | What it creates |
|---|---|
|
The template with the account and case guide: everything the
gateway-only template creates, plus the account and case guide in
your instance: the inbound flow, the guide flow, the wrap-up flow
when |
|
The guide's 17 views (15 with |
|
The Create a case with details flow module, which the template
with the account and case guide creates as its nested stack
|
|
The gateway-only template: the gateway, the token refresh function and the credential provider that send your Salesforce access token, the Salesforce target, the registration of the gateway with your instance, the change alerts, and the health dashboard and the four alarms. |
The templates have the following parameters. All of them are required except
SalesforceIntegrationUsername, CustomOperationsS3Uri,
FindRecordModuleArn, ExistingAssistantArn, SelfServiceAccountTool,
ConnectAssistantKnowledgeBaseArn, WrapUp and
NestedTemplateBaseUrl, which have defaults.
"With guides" means only the template with the account and case guide.
The stack's name is part of each resource's name:
the gateway;
the credential provider,
;stack-name-api-keythe token secret,
;stack-name-tokenthe token refresh function,
;stack-name-token-refreshthe integration in Connect Customer,
Salesforce -;stack-namethe guide's flows and flow modules,
, such asstack-name-account-360-partconnect-sf-real-time-account-360-inbound;the guide's views,
, such asstack-name-view-partconnect-sf-real-time-view-main.
| Parameter | Template | Default | What to enter |
|---|---|---|---|
|
Both |
None |
The ARN of your Connect Customer instance. |
|
Both |
None |
The instance's access URL, the
|
|
Both |
None |
Your org's My Domain URL, with no trailing slash, such as
|
|
Both |
None |
The External Client App's consumer key. |
|
Both |
None |
The full ARN of the Secrets Manager secret that holds the
consumer secret, including the six characters Secrets Manager adds
after the name, under the key |
|
Both |
Empty |
Optional. The integration user's Salesforce username, the External Client App's Run As user. When set, these fail if the Run As user has another username:
When empty, a change of Run As user raises the
Run As user changed alarm, and tool calls keep working. Change the
Run As user and this value in the same
change window. Either way, the
|
|
With guides |
None |
A queue that the agent you test with serves. The stack's
inbound flow sends test chats and test calls there, so that agent
gets the contact and sees the guide. Your production inbound flows keep their own
queues. It must be a queue of the instance in
|
|
Both |
Empty |
Optional. The S3 URI of an OpenAPI file with your own Salesforce
operations, which the stack adds as the
|
|
With guides |
Empty |
Optional. The alias ARN of your own Find the record flow
module, published in the instance that |
|
With guides |
Empty |
The ARN of the Connect assistant the instance already uses. Leave it empty only when the instance has none: the stack then creates an assistant, associates it with the instance, and keeps both when the stack is deleted. Empty on an instance that has an assistant makes the create or update fail and roll back, because an instance can have one assistant association. |
|
With guides |
|
|
|
With guides |
Empty |
Optional. A Connect assistant knowledge base that isn't associated with the assistant yet, for the stack to associate; the stack removes the association when it is deleted. Empty associates none, and the AI agents search the knowledge bases the assistant already has. |
|
With guides |
|
|
|
With guides |
|
Where the stack reads the templates of its two nested stacks:
|
Each stack has these outputs, on the Outputs tab of the stack in the CloudFormation console. "Both" means both templates.
| Output | Template | What it is |
|---|---|---|
|
Both |
The template version the stack runs, such as 1.2.0. |
|
Both |
The External Client App's Run As user, whom every tool call runs as, as of the last create or update that requested a token. |
|
Both |
|
|
Both |
The gateway's ID. Flows call the gateway's tools by names that include it. |
|
Both |
The gateway's MCP endpoint URL. |
|
Both |
The ID of the gateway's Salesforce target. |
|
Both |
The ID of the |
|
Both |
The API key credential provider the Salesforce target uses; it reads the token secret. |
|
Both |
The secret that holds the Salesforce access token the gateway sends. Only the token refresh function writes it. |
|
Both |
The function that refreshes the token every five minutes. Invoke it to apply a rotated consumer secret at once. |
|
Both |
The AWS AppIntegrations application that registers the gateway with Connect Customer. |
|
Both |
The integration association that links the application to your Connect Customer instance. |
|
Both |
A command to run. It should list one association, for |
|
Both |
A command to run after every create or update. It should print the gateway's ID; |
|
Both |
The Amazon SNS topic that gets every change to the gateway, target, credential provider, token secret and Connect Customer registration, and the stack's four alarms. |
|
Both |
A command to run. It lists the CloudTrail trails that cover this Region; change alerts need one that is logging write management events. |
|
Both |
The stack's health dashboard. |
|
With guides |
The inbound flow. Send a test contact to it to try the screen pop. |
|
With guides |
The guide flow and the wrap-up flow. |
|
With guides |
The |
|
With guides |
|
|
With guides |
The AI self-service flow. The stack routes no contact to it. |
|
With guides |
The two console steps to do after each create or update, and the step to do before a delete. |
|
With guides |
How the AI self-service flow is billed once contacts are routed to it. |
|
With guides |
The knowledge agent, to set as the assistant's Self service default, and the security profile to associate with it and its published version. |
|
With guides |
The account agent and its security profile. Only when the stack creates the account agent. |
|
With guides |
The agent assist AI agent, which the AI self-service flow's Connect assistant block names, and its security profile, which you also add to agents who use agent assist. |
|
With guides |
The guide's views. |
To download the template
Download the template you need, its deployer policy, and the
SHA256SUMS file:
| File | Download URL |
|---|---|
Template with the account and case guide |
|
Its deployer policy |
|
Gateway-only template |
|
Its deployer policy |
|
The AI self-service deployer policy, which the template with the account and case guide also needs |
|
The views template, which the template with the account and case guide reads as a nested stack |
|
The modules template, which the template with the account and case guide reads as a nested stack |
|
Checksums for the release folder's files |
|
Checksums for the first five files |
|
The first five files always hold the latest release. The release folder,
releases/, also holds that
version's views and modules templates, which you need only if you host the release
files yourself. Check the download:template-version/
curl -fsSO https://ac-sf-headless360-cfn-template.s3.us-west-2.amazonaws.com/connect-sf-real-time-data-integration.template.json curl -fsSO https://ac-sf-headless360-cfn-template.s3.us-west-2.amazonaws.com/SHA256SUMS grep ' connect-sf-real-time-data-integration.template.json$' SHA256SUMS | sha256sum -c
It prints OK. The check detects a download that doesn't match the
published file, such as a corrupted template. On macOS, use shasum -a 256
-c in place of sha256sum -c. For another file, put its name in
the grep; for the views and modules templates, use the release folder's
SHA256SUMS.
The deployer policy is optional: deploy with your own permissions, or with a role that holds the policy. It grants the rights CloudFormation needs to create, update and delete the stack's resources, which give administrator-level control over the following:
Every flow, flow module and view in the instance.
Every Amazon AppIntegrations application in the account and Region.
The IAM roles, functions, gateway and other resources named after the stack.
The policy can create a role named after the stack with any permissions, so holding it is equivalent to administrator access in the account. Your AWS administrator decides who can use the deployer role: give the role, and iam:PassRole to pass it to CloudFormation, to people who already have administrator access.
To deploy with the deployer role:
Fill in the policy's placeholders:
REGION,ACCOUNT_ID,STACK_NAME,INSTANCE_IDandSTAGING_BUCKET. In the policy of the template with the account and case guide, also fill inDEPLOYER_ROLE, the role's own name, which CloudFormation passes to the nested stacksGuideViewsandGuideModules. It matches only a role on the default path/.Name the role so that it doesn't start with the stack name and a hyphen, because the policy can change roles with that prefix.
Choose the stack name: at most 24 characters, or the policy's patterns don't match the resource names, and not another stack's name plus a hyphen and more, or the policy's
STACK_NAME-*patterns would match that stack's resources too.Attach the policy inline to a role that only CloudFormation can assume.
Deploy with the AWS CLI and that role (
--role-arn).
The template with the account and case guide also needs the AI self-service
deployer policy on the same role. It fills in the same placeholders except
STAGING_BUCKET and DEPLOYER_ROLE. Together the two
policies are larger than a role's inline policies can be, so create this one as a
customer managed policy named
cfn-deployer-, which the
upgrade script looks for, and attach it to the role. It gives administrator-level
control over every security profile in the instance, the Connect assistant's AI agents
and prompts in the account, and the Amazon Lex bots in the account and Region. Holding
it is also equivalent to administrator access.stack-name-ai
The deployer policy covers both nested stacks, and the AI self-service policy lets the
role read the published views and modules templates. If you host the release files in
your own bucket (NestedTemplateBaseUrl), give the deployer role
s3:GetObject on both templates there.
To deploy the stack with the AWS CLI
Paste the following block at the prompt. It asks for these values:
The Region, the template and the stack name.
A staging bucket, and the deployer role if you use one.
The instance alias and the test queue.
The My Domain URL, the consumer key and the secret's name.
It looks up the instance's ARN and access URL, its Connect assistant, the queue's ARN and the secret's ARN for you. When the Region has more than one instance, type the alias from
the list; there is no default. The test queue defaults to
rtdi-test-queue, which the test setup script in Step 1 creates. Before it
deploys, it prints the instance, the Region and the stack name and asks Deploy
to ; type alias? [y/N]y to
deploy. The
templates are larger than CloudFormation accepts inline, so the block downloads the
template, checks it against SHA256SUMS, checks the views and modules
templates that the stack reads with the default NestedTemplateBaseUrl
against the release folder's SHA256SUMS,
and stages the template in the bucket, an
Amazon S3 bucket that you own in the same Region. To create a bucket, run aws s3
mb s3:// followed by a new bucket name.
( set -o pipefail W=$(mktemp -d); trap 'rm -rf "$W"' EXIT; cd "$W" || exit 1 BASE=https://ac-sf-headless360-cfn-template.s3.us-west-2.amazonaws.com R=${AWS_REGION:-us-east-1} printf 'Region of your Connect Customer instance [%s]: ' "$R"; read -r REGION; REGION=${REGION:-$R} printf 'Template, guide (with the account and case guide) or gateway (gateway only) [guide]: '; read -r KIND case "${KIND:-guide}" in guide) FILE=connect-sf-real-time-data-integration.template.json ;; gateway) FILE=connect-sf-real-time-data-integration-gateway.template.json ;; *) echo "Enter guide or gateway."; exit 1 ;; esac printf 'Stack name [connect-sf-real-time]: '; read -r STACK; STACK=${STACK:-connect-sf-real-time} printf 'Staging bucket, an S3 bucket you own in %s: ' "$REGION"; read -r BUCKET printf 'Deployer role ARN, or Enter to deploy with your own permissions []: '; read -r ROLE ROLE_ARG=(); [ -z "$ROLE" ] || ROLE_ARG=(--role-arn "$ROLE") 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."; exit 1; } INSTANCE_ARN=$(aws connect describe-instance --region "$REGION" --instance-id "$ID" --query Instance.Arn --output text) INSTANCE_URL=$(aws connect describe-instance --region "$REGION" --instance-id "$ID" --query Instance.InstanceAccessUrl --output text) PARAMS=("InstanceArn=$INSTANCE_ARN" "ConnectInstanceUrl=${INSTANCE_URL%/}") if [ "$FILE" = connect-sf-real-time-data-integration.template.json ]; then aws connect list-queues --region "$REGION" --instance-id "$ID" --queue-types STANDARD --query 'QueueSummaryList[].Name' --output text | tr '\t' '\n' | sed 's/^/ /' printf 'Test queue name [rtdi-test-queue]: '; read -r QUEUE; QUEUE=${QUEUE:-rtdi-test-queue} QUEUE_ARN=$(aws connect list-queues --region "$REGION" --instance-id "$ID" --queue-types STANDARD \ --query "QueueSummaryList[?Name=='$QUEUE'].Arn" --output text | grep -m 1 .) [ -n "$QUEUE_ARN" ] || { echo "No queue named $QUEUE in $ALIAS."; exit 1; } PARAMS+=("TestQueueArn=$QUEUE_ARN") 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:*) echo "Connect assistant: $ASSISTANT" ;; *) ASSISTANT=; echo "Connect assistant: none; the stack creates one." ;; esac PARAMS+=("ExistingAssistantArn=$ASSISTANT") fi printf 'My Domain URL, for example https://mycompany.my.salesforce.com: '; read -r MY_DOMAIN printf 'Consumer key: '; read -r KEY printf 'Secret name or ARN of the consumer secret [connect-sf-real-time/client]: '; read -r SECRET SECRET_ARN=$(aws secretsmanager describe-secret --region "$REGION" --secret-id "${SECRET:-connect-sf-real-time/client}" \ --query ARN --output text) || exit 1 PARAMS+=("SalesforceMyDomainUrl=${MY_DOMAIN%/}" "SalesforceClientId=$KEY" "SalesforceClientSecretArn=$SECRET_ARN") echo "Instance: $ALIAS Region: $REGION Stack: $STACK" printf 'Deploy to %s? [y/N]: ' "$ALIAS"; read -r GO case "$GO" in y|Y|yes|Yes) ;; *) echo "Nothing was deployed."; exit 0 ;; esac curl -fsSO "$BASE/$FILE" && curl -fsSO "$BASE/SHA256SUMS" || { echo "Download failed."; exit 1; } # sha256sum where it exists (Linux, CloudShell), else shasum (macOS) sum_ok() { if command -v sha256sum >/dev/null 2>&1; then sha256sum -c --status; else shasum -a 256 -c --status; fi; } grep " $FILE\$" SHA256SUMS | sum_ok || { echo "The download doesn't match its checksum; nothing was deployed."; exit 1; } if [ "$FILE" = connect-sf-real-time-data-integration.template.json ]; then # The nested views and modules templates that the stack reads, checked against the release folder's SHA256SUMS V=$(grep -o '/[0-9][0-9.]*[0-9]/connect-sf-real-time-data-integration-views.template.json' "$FILE" | head -n 1 | cut -d/ -f2) NESTED=$(grep -o 'connect-sf-real-time-data-integration-[a-z]*[.]template[.]json' "$FILE" | sort -u) ( mkdir -p rel && cd rel && curl -fsSO "$BASE/releases/$V/SHA256SUMS" \ && for F in $NESTED; do curl -fsSO "$BASE/releases/$V/$F" && grep " $F\$" SHA256SUMS | sum_ok || exit 1; done ) \ || { echo "The release $V views or modules template doesn't match its checksum; nothing was deployed."; exit 1; } fi aws cloudformation deploy --region "$REGION" --stack-name "$STACK" --template-file "$FILE" \ --s3-bucket "$BUCKET" "${ROLE_ARG[@]}" --capabilities CAPABILITY_IAM \ --parameter-overrides "${PARAMS[@]}" )
It ends with Successfully created/updated stack. If it ends with
Failed to create/update the stack, find the cause as
If the stack fails in Step 3: Deploy the CloudFormation stack describes. A stack whose first
deployment failed stays in ROLLBACK_COMPLETE or
ROLLBACK_FAILED; delete it before you deploy again with the same stack
name. The script finds the Connect assistant that a failed create kept, so you don't
need to enter it.
Check that change alerts reach you
-
Run the command in the
VerifyTrailoutput. If it lists no trail, the stack sends no change alerts; the four alarms still publish to the topic. To check that a trail logs management events, expand the block that follows, copy it, and paste it at the prompt:
( R=${AWS_REGION:-us-east-1} printf 'Region of the stack [%s]: ' "$R"; read -r REGION; REGION=${REGION:-$R} TRAILS=$(aws cloudtrail describe-trails --region "$REGION" --query 'trailList[].TrailARN' --output text) || exit 1 [ -n "$TRAILS" ] || { echo "No trail in $REGION: the stack sends no change alerts."; exit 1; } for T in $TRAILS; do echo "$T: logging $(aws cloudtrail get-trail-status --region "$REGION" --name "$T" --query IsLogging --output text)," \ "management events $(aws cloudtrail get-event-selectors --region "$REGION" --trail-name "$T" \ --query 'EventSelectors[0].IncludeManagementEvents' --output text)" done )
Each trail must show logging True and management events
True. management events None means the trail uses
advanced event selectors; check in the CloudTrail console that they include
management events.
Change alerts
The stack sends an alert to the ChangeAlertTopicArn topic whenever someone does one of these:
Changes or deletes the gateway.
Creates, changes or deletes a gateway target.
Changes or deletes the API key credential provider.
Changes the token secret, other than the token refresh function's own writes.
Changes the token refresh function's code, configuration or invoke permission, or its schedule.
Changes or deletes the Connect Customer application, or deletes the integration association.
A failed attempt alerts too. The same changes to other gateways and applications in the account and Region also alert. Each alert names these, never the request body:
the call;
the caller;
the source IP address;
the time;
any error code;
the resource.
For the template with the account and case guide, the stack also alerts on changes to these:
its AI agents and prompts;
the assistant's default AI agents;
security profiles in your instance;
the Read the verified account module;
the seven flow modules that agent assist runs.
Change alerts don't cover:
Changes to the consumer secret that you store in Secrets Manager.
Changes to the stack's IAM roles, including the token refresh function's role.
Edits to flows and views in Connect Customer, and, with the gateway-only template, to security profiles.
Changes that turn the alerts off, such as disabling the rule, deleting the topic or stopping the trail.
A stack update can also alert; act on an alert you can't match to a change you made.
Launch Stack by Region
Choose Launch Stack for the Region of your Connect Customer instance. The tables list Connect Customer Regions and whether the template is available in each.
| Connect Customer Region of your instance | Template |
|---|---|
US East (N. Virginia) ( |
|
US West (Oregon) ( |
|
Africa (Cape Town) ( |
Not available: neither the External Tool block nor Amazon Bedrock AgentCore Gateway is available in this Region. |
Asia Pacific (Seoul) ( |
|
Asia Pacific (Singapore) ( |
|
Asia Pacific (Sydney) ( |
|
Asia Pacific (Tokyo) ( |
|
Canada (Central) ( |
|
Europe (Frankfurt) ( |
|
Europe (London) ( |
|
AWS GovCloud (US-West) ( |
Not available: the External Tool block isn't available in this Region. |