Skip to content

Commit 7dea4e9

Browse files
committed
Update for Q Business CLI tutorial
1 parent dadcec8 commit 7dea4e9

3 files changed

Lines changed: 61 additions & 34 deletions

File tree

tuts/040-qbusiness-ica/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,15 @@
33
This tutorial guides you through creating an Amazon Q Business application with Identity Center Authentication (ICA) using the AWS CLI. Amazon Q Business is a generative AI-powered assistant that helps your employees find information and complete tasks within your organization. The tutorial covers setting up AWS IAM Identity Center, creating necessary IAM roles and policies, configuring user access, and optionally creating a web experience for browser-based access.
44

55
You can either run the automated shell script `qbusiness-ica.sh` to create all the resources at once, or follow the step-by-step instructions in the `qbusiness-ica.md` tutorial to understand each component in detail. The tutorial includes cleanup steps to avoid ongoing charges and best practices for production deployments.
6+
7+
## Resources Created
8+
9+
The script creates the following AWS resources in order:
10+
11+
• IAM role for Amazon Q Business application (with CloudWatch and logging permissions)
12+
• IAM policy with necessary permissions for the application role
13+
• Amazon Q Business application
14+
• User assignment to the application
15+
• User subscription for the application
16+
17+
The script prompts you to clean up resources when you run it, including if there's an error part way through. If you need to clean up resources later, you can use the script log as a reference point for which resources were created.

tuts/040-qbusiness-ica/qbusiness-ica.sh

100644100755
Lines changed: 47 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -169,11 +169,20 @@ cat > qbusiness-trust-policy.json << EOF
169169
"Version": "2012-10-17",
170170
"Statement": [
171171
{
172+
"Sid": "AmazonQApplicationPermission",
172173
"Effect": "Allow",
173174
"Principal": {
174175
"Service": "qbusiness.amazonaws.com"
175176
},
176-
"Action": "sts:AssumeRole"
177+
"Action": "sts:AssumeRole",
178+
"Condition": {
179+
"StringEquals": {
180+
"aws:SourceAccount": "$AWS_ACCOUNT_ID"
181+
},
182+
"ArnLike": {
183+
"aws:SourceArn": "arn:aws:qbusiness:$AWS_REGION:$AWS_ACCOUNT_ID:application/*"
184+
}
185+
}
177186
}
178187
]
179188
}
@@ -185,57 +194,47 @@ cat > qbusiness-permissions-policy.json << EOF
185194
"Version": "2012-10-17",
186195
"Statement": [
187196
{
197+
"Sid": "AmazonQApplicationPutMetricDataPermission",
188198
"Effect": "Allow",
189199
"Action": [
190-
"qbusiness:CreateApplication",
191-
"qbusiness:GetApplication",
192-
"qbusiness:DeleteApplication",
193-
"qbusiness:CreateSubscription",
194-
"qbusiness:ListSubscriptions",
195-
"qbusiness:CreateWebExperience",
196-
"qbusiness:GetWebExperience",
197-
"qbusiness:ListWebExperiences",
198-
"qbusiness:DeleteWebExperience"
200+
"cloudwatch:PutMetricData"
199201
],
200-
"Resource": "*"
202+
"Resource": "*",
203+
"Condition": {
204+
"StringEquals": {
205+
"cloudwatch:namespace": "AWS/QBusiness"
206+
}
207+
}
201208
},
202209
{
210+
"Sid": "AmazonQApplicationDescribeLogGroupsPermission",
203211
"Effect": "Allow",
204212
"Action": [
205-
"sso:DescribeApplication",
206-
"sso:DescribeInstance",
207-
"sso:CreateApplication",
208-
"sso:PutApplicationAssignmentConfiguration",
209-
"sso:PutApplicationAuthenticationMethod",
210-
"sso:PutApplicationGrant",
211-
"sso:PutApplicationAccessScope"
213+
"logs:DescribeLogGroups"
212214
],
213-
"Resource": [
214-
"${IDENTITY_CENTER_ARN}",
215-
"${IDENTITY_CENTER_ARN}/*"
216-
]
215+
"Resource": "*"
217216
},
218217
{
218+
"Sid": "AmazonQApplicationCreateLogGroupPermission",
219219
"Effect": "Allow",
220220
"Action": [
221-
"sso-admin:CreateApplicationAssignment",
222-
"sso-admin:DeleteApplicationAssignment",
223-
"sso-admin:ListApplicationAssignments"
221+
"logs:CreateLogGroup"
224222
],
225223
"Resource": [
226-
"${IDENTITY_CENTER_ARN}",
227-
"${IDENTITY_CENTER_ARN}/*"
224+
"arn:aws:logs:$AWS_REGION:$AWS_ACCOUNT_ID:log-group:/aws/qbusiness/*"
228225
]
229226
},
230227
{
228+
"Sid": "AmazonQApplicationLogStreamPermission",
231229
"Effect": "Allow",
232230
"Action": [
233-
"identitystore:DescribeUser",
234-
"identitystore:DescribeGroup",
235-
"identitystore:ListUsers",
236-
"identitystore:ListGroups"
231+
"logs:DescribeLogStreams",
232+
"logs:CreateLogStream",
233+
"logs:PutLogEvents"
237234
],
238-
"Resource": "*"
235+
"Resource": [
236+
"arn:aws:logs:$AWS_REGION:$AWS_ACCOUNT_ID:log-group:/aws/qbusiness/*:log-stream:*"
237+
]
239238
}
240239
]
241240
}
@@ -394,7 +393,22 @@ echo "User subscription created with ID: $USER_SUBSCRIPTION_ID" | tee -a "$LOG_F
394393

395394
echo "" | tee -a "$LOG_FILE"
396395
echo "===========================================================" | tee -a "$LOG_FILE"
397-
echo "STEP 8: Verify Resources" | tee -a "$LOG_FILE"
396+
echo "STEP 8: Enable Creator Mode (LLM Direct Chat)" | tee -a "$LOG_FILE"
397+
echo "===========================================================" | tee -a "$LOG_FILE"
398+
399+
echo "Enabling creator mode to allow direct chat with LLM" | tee -a "$LOG_FILE"
400+
CREATOR_MODE_RESULT=$(log_cmd "aws qbusiness update-chat-controls-configuration --region $AWS_REGION \
401+
--application-id \"$APP_ID\" \
402+
--creator-mode-configuration '{\"creatorModeControl\": \"ENABLED\"}' \
403+
--query 'creatorModeConfiguration.creatorModeControl' --output text")
404+
check_error $?
405+
406+
echo "Creator mode enabled: $CREATOR_MODE_RESULT" | tee -a "$LOG_FILE"
407+
CREATED_RESOURCES+=("Creator Mode Configuration: ENABLED")
408+
409+
echo "" | tee -a "$LOG_FILE"
410+
echo "===========================================================" | tee -a "$LOG_FILE"
411+
echo "STEP 9: Verify Resources" | tee -a "$LOG_FILE"
398412
echo "===========================================================" | tee -a "$LOG_FILE"
399413

400414
echo "Verifying application" | tee -a "$LOG_FILE"

tuts/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ This directory contains a collection of AWS CLI tutorials and scripts for variou
3939
| [037](037-emr-gs/) | Amazon EMR | [Getting Started](037-emr-gs/) | Get started with Amazon EMR for big data processing |
4040
| [038](038-redshift-serverless/) | Amazon Redshift | [Serverless](038-redshift-serverless/) | Set up and use Amazon Redshift Serverless |
4141
| [039](039-redshift-provisioned/) | Amazon Redshift | [Provisioned](039-redshift-provisioned/) | Set up Amazon Redshift provisioned clusters |
42+
| [040](040-qbusiness-ica/) | Amazon Q Business | [Identity Center Authentication](040-qbusiness-ica/) | Set up Amazon Q Business with IAM Identity Center authentication |
4243
| [042](042-qbusiness-anon/) | Amazon Q Business | [Anonymous Access](042-qbusiness-anon/) | Configure anonymous access for Amazon Q Business |
4344
| [043](043-amazon-mq-gs/) | Amazon MQ | [Getting Started](043-amazon-mq-gs/) | Comprehensive introduction to Amazon MQ message brokers |
4445
| [044](044-amazon-managed-grafana-gs/) | Amazon Managed Grafana | [Getting Started](044-amazon-managed-grafana-gs/) | Introduction to Amazon Managed Grafana |
@@ -126,7 +127,7 @@ The tutorials are organized by AWS service categories:
126127
- Chime SDK (007), Connect (027), Elemental MediaConnect (081)
127128

128129
**Developer Tools & Services**
129-
- Q Business (042), End User Messaging (049), Marketplace (030), ECR (078)
130+
- Q Business (040, 042), End User Messaging (049), Marketplace (030), ECR (078)
130131

131132
**Other Services**
132133
- WorkSpaces (035), Managed Grafana (044), Fault Injection Service (069), Database Migration Service (075), OpenSearch Service (016)

0 commit comments

Comments
 (0)