Amazon Q is a brand new generative synthetic intelligence (AI)-powered assistant designed for work that may be tailor-made to your enterprise. Amazon Q may help you get quick, related solutions to urgent questions, resolve issues, generate content material, and take actions utilizing the information and experience present in your organization’s info repositories and enterprise methods. If you chat with Amazon Q, it gives quick, related info and recommendation to assist streamline duties, velocity up decision-making, and spark creativity and innovation at work. For extra info, see Amazon Q Enterprise, now usually out there, helps increase workforce productiveness with generative AI.
This publish demonstrates methods to construct a customized UI for Amazon Q Enterprise. The personalized UI lets you implement particular options like dealing with suggestions, utilizing firm model colours and templates, and utilizing a customized login. It additionally allows conversing with Amazon Q via an interface personalised to your use case.
Answer overview
On this resolution, we deploy a customized internet expertise for Amazon Q to ship fast, correct, and related solutions to your enterprise questions on prime of an enterprise information base. The next diagram illustrates the answer structure.
The workflow consists of the next steps:
The consumer accesses the chatbot utility, which is hosted behind an Software Load Balancer.
After the consumer logs in, they’re redirected to the Amazon Cognito login web page for authentication.
This resolution makes use of an Amazon Cognito consumer pool as an OAuth-compatible id supplier (IdP), which is required with a purpose to alternate a token with AWS IAM Identification Heart and afterward work together with the Amazon Q Enterprise APIs. For extra details about trusted token issuers and the way token exchanges are carried out, see Utilizing purposes with a trusted token issuer. If you have already got an OAuth-compatible IdP, you should use it as a substitute of setting an Amazon Cognito consumer pool.
Provisioning native customers within the consumer pool and reconciling them with IAM Identification Heart will be error-prone. You possibly can streamline the combination of IAM Identification Heart customers into the consumer pool by utilizing a federated IdP and making a second customized utility (SAML) in IAM Identification Heart. For directions, discuss with How do I combine IAM Identification Heart with an Amazon Cognito consumer pool and the related demo video.
The UI utility, deployed on an Amazon Elastic Compute Cloud (Amazon EC2) occasion, authenticates the consumer with Amazon Cognito and obtains an authentication token. It then exchanges this Amazon Cognito id token for an IAM Identification Heart token that grants the applying permissions to entry Amazon Q.
The UI utility assumes an AWS Identification and Entry Administration (IAM) position and retrieves an AWS session token from the AWS Safety Token Service (AWS STS). This session token is augmented with the IAM Identification Heart token, enabling the applying to work together with Amazon Q. For extra details about the token alternate move between IAM Identification Heart and the IdP, discuss with Tips on how to develop a user-facing information utility with IAM Identification Heart and S3 Entry Grants (Half 1) and Half 2.
Amazon Q makes use of the chat_sync API to hold out the dialog.
The request makes use of the next obligatory parameters:
applicationId – The identifier of the Amazon Q utility linked to the Amazon Q dialog.
userMessage – An end-user message in a dialog.
Amazon Q returns the response as a JSON object (detailed within the Amazon Q documentation). The next are just a few core attributes from the response payload:
systemMessage – An AI-generated message in a dialog.
sourceAttributions – The supply paperwork used to generate the dialog response. In Retrieval Augmentation Technology (RAG), this all the time refers to a number of paperwork from enterprise information bases which might be listed in Amazon Q.
Conditions
For this walkthrough, you need to have the next conditions:
An AWS account arrange.
A VPC the place you’ll deploy the answer.
An IAM position within the account with ample permissions to create the required sources. You probably have administrator entry to the account, no further motion is required.
An present, working Amazon Q utility, built-in with IAM Identification Heart. In the event you haven’t set one up but, see Creating an Amazon Q utility.
Entry to IAM Identification Heart to create a buyer managed utility.
An SSL certificates created and imported into AWS Certificates Supervisor (ACM). For extra particulars, discuss with Importing a certificates. In the event you don’t have a public SSL certificates, observe the steps within the subsequent part to generate a personal certificates.
Generate a personal certificates
If you have already got an SSL certificates, you possibly can skip this part.
You’ll obtain a warning out of your browser when accessing the UI in the event you didn’t present a customized SSL certificates when launching the AWS CloudFormation stack. The directions on this part present you methods to create a self-signed certificates. This isn’t really useful for manufacturing use instances. You must receive an SSL certificates that has been validated by a certificates authority, import it into ACM, and reference this when launching the CloudFormation stack. If you wish to proceed with the self-signed certificates (for growth functions), you need to be capable of proceed previous the browser warning web page. With Chrome, you will notice the message Your connection will not be personal error message (NET::ERR_CERT_AUTHORITY_INVALID), however by selecting Superior, you need to then see a hyperlink to proceed.
The next command generates a pattern self-signed certificates (for growth functions) and uploads the certificates to ACM. You can even discover the script on the GitHub repo.
Be aware down the CertificateARN to make use of later whereas provisioning the CloudFormation template.
Provision sources with the CloudFormation template
The complete supply of the answer on within the GitHub repository and is deployed with AWS CloudFormation.
Select Launch Stack to launch a CloudFormation stack in your account and deploy the template:
This template creates separate IAM roles for the Software Load Balancer, Amazon Cognito, and the EC2 occasion. Moreover, it creates and configures these companies to run the end-to-end demonstration.
Present the next parameters for the stack:
Stack identify – The identify of the CloudFormation stack (for instance, AmazonQ-UI-Demo).
AuthName – A globally distinctive identify to assign to the Amazon Cognito consumer pool. Make certain your area identify doesn’t embrace any reserved phrases, reminiscent of cognito, aws, or amazon.
CertificateARN – The CertificateARN generated from the earlier step.
IdcApplicationArn – That is the Amazon Useful resource Title (ARN) for the AWS Identification Heart buyer utility. Depart it clean on the primary run, as a result of you should create the Amazon Cognito consumer pool as a part of this stack. It will create an IAM Identification Heart utility with an Amazon Cognito consumer pool because the trusted token issuer.
LatestAMIId – The ID of the AMI to make use of for the EC2 occasion. We propose maintaining the default worth.
PublicSubnetIds – The ID of the general public subnet that can be utilized to deploy the EC2 occasion and the Software Load Balancer.
QApplicationId – The present utility ID of Amazon Q.
VPCId – The ID of the prevailing VPC that can be utilized to deploy the demo.
After the CloudFormation stack deploys efficiently, copy the next values on the stack’s Outputs tab:
Viewers – Viewers to arrange the client utility in IAM Identification Heart
RoleArn – ARN of the IAM position required to arrange the token alternate in IAM Identification Heart
TrustedIssuerUrl – Endpoint of the trusted issuer to arrange IAM Identification Heart
URL – The load balancer URL to entry the UI utility
Create an IAM Identification Heart utility
The actions described on this part are one-time actions. The objective is to configure an utility in IAM Identification Heart to characterize the applying you’re constructing. Particularly, on this step, you configure IAM Identification Heart to have the ability to belief the id tokens by which your utility will characterize its authenticated customers. Full the next steps:
On the IAM Identification Heart console, add a brand new customized managed utility.
For Software sort, choose OAuth 2.0, then select Subsequent.
Enter an utility identify and outline.
Set Software visibility as Not seen, then select Subsequent.
On the Trusted token issuers tab, select Create trusted token issuer.
For Issuer URL, present the TrustedIssuerUrl you copied from the CloudFormation stack output.
Enter an issuer identify and hold the map attributes as Electronic mail.
Within the IAM Identification Heart utility authentication settings, choose the trusted token issuer created within the earlier step and add the Aud declare, offering the viewers you copied from the CloudFormation stack output, then select Subsequent.
On the Specify utility credentials tab, select Enter a number of IAM roles and supply the worth for RoleArn you copied from the CloudFormation stack output.
Evaluate all of the steps and create the applying.
After the applying is created, go to the applying, select Assign customers and teams, and add the customers who can have entry to the UI utility.
On the Choose setup sort web page, select All purposes for service with identical entry, select Amazon Q from the Providers record, and select Belief purposes.
After the IAM Identification Heart utility is created, copy the applying ARN.
On the AWS CloudFormation console, replace the stack and supply the IAM Identification Heart utility ARN for the parameter IdcApplicationArn, then run the stack.
When the replace course of is full, go to the CloudFormation stack’s Outputs tab and replica the URL supplied there.
Customized UI
The CloudFormation stack deploys and begins the Streamlit utility on an EC2 occasion on port 8080. To view the well being of the applying operating behind the Software Load Balancer, open the Amazon EC2 console and select Load Balancing underneath Goal teams within the navigation pane. For debugging functions, you can even hook up with Amazon EC2 via Session Supervisor, a functionality of AWS Methods Supervisor.
To entry the customized UI, use the URL that you just copied from the CloudFormation stack output. Select Enroll and use the identical e-mail tackle for the customers that had been registered in IAM Identification Heart.
After profitable authentication, you’re redirected to the customized UI. You possibly can improve it by implementing customized options like dealing with suggestions, utilizing your firms model colours and templates, and personalizing it to your particular use case.
Clear up
To keep away from future expenses in your account, delete the sources you created on this walkthrough. The EC2 occasion with the customized UI will incur expenses so long as the occasion is lively, so cease it while you’re executed.
On the CloudFormation console, within the navigation pane, select Stacks.
Choose the stack you launched (AmazonQ-UI-Demo), then select Delete.
Conclusion
On this publish, you discovered methods to combine a customized UI with Amazon Q Enterprise. Utilizing a customized UI tailor-made to your particular wants and necessities makes Amazon Q extra environment friendly and easy to make use of for your enterprise. You possibly can embrace your organization branding and design, and have management and possession over the consumer expertise. For instance, you would introduce customized suggestions dealing with options.
The pattern customized UI for Amazon Q mentioned on this publish is supplied as open supply—you should use it as a place to begin to your personal resolution, and assist enhance it by contributing bug fixes and new options utilizing GitHub pull requests. Discover the code, select Watch within the GitHub repo to obtain notifications about new releases, and verify again for the newest updates. We welcome your strategies for enhancements and new options.
For extra info on Amazon Q enterprise, discuss with the Amazon Q Enterprise Developer Information.
In regards to the Authors
Ennio Emanuele Pastore is a Senior Architect on the AWS GenAI Labs staff. He’s an fanatic of every part associated to new applied sciences which have a constructive impression on companies and normal livelihood. He helps organizations in reaching particular enterprise outcomes by utilizing information and AI, and accelerating their AWS Cloud adoption journey.
Deba is a Senior Architect on the AWS GenAI Labs staff. He has intensive expertise throughout huge information, information science, and IoT, throughout consulting and industrials. He’s an advocate of cloud-centered information and ML platforms and the worth they will drive for purchasers throughout industries.
Joseph de Clerck is a senior Cloud Infrastructure Architect at AWS. He leverages his experience to assist enterprises resolve their enterprise challenges by successfully using AWS companies. His broad understanding of cloud applied sciences allows him to plot tailor-made options on matters reminiscent of analytics, safety, infrastructure, and automation.