Amazon Q is a brand new generative synthetic intelligence (AI)-powered assistant designed for work that may be tailor-made to your online business. Amazon Q may help you get quick, related solutions to urgent questions, remedy issues, generate content material, and take actions utilizing the info and experience present in your organization’s data repositories and enterprise methods. Once you chat with Amazon Q, it gives rapid, related data and recommendation to assist streamline duties, pace up decision-making, and spark creativity and innovation at work. For extra data, see Amazon Q Enterprise, now usually accessible, helps enhance workforce productiveness with generative AI.
This publish demonstrates easy methods to construct a customized UI for Amazon Q Enterprise. The custom-made UI permits you to implement particular options like dealing with suggestions, utilizing firm model colours and templates, and utilizing a customized login. It additionally permits conversing with Amazon Q by means of an interface personalised to your use case.
Answer overview
On this resolution, we deploy a customized net expertise for Amazon Q to ship fast, correct, and related solutions to your online business questions on prime of an enterprise data base. The next diagram illustrates the answer structure.
The workflow consists of the next steps:
The consumer accesses the chatbot software, which is hosted behind an Utility 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 as a way to alternate a token with AWS IAM Identification Heart and in a while 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 functions with a trusted token issuer. If you have already got an OAuth-compatible IdP, you should use it as an alternative of setting an Amazon Cognito consumer pool.
Provisioning native customers within the consumer pool and reconciling them with IAM Identification Heart may be error-prone. You may streamline the combination of IAM Identification Heart customers into the consumer pool by utilizing a federated IdP and making a second customized software (SAML) in IAM Identification Heart. For directions, seek advice from How do I combine IAM Identification Heart with an Amazon Cognito consumer pool and the related demo video.
The UI software, 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 appliance permissions to entry Amazon Q.
The UI software assumes an AWS Identification and Entry Administration (IAM) function 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 appliance to work together with Amazon Q. For extra details about the token alternate circulation between IAM Identification Heart and the IdP, seek advice from Find out how to develop a user-facing information software 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 software 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 at all times refers to a number of paperwork from enterprise data bases which are listed in Amazon Q.
Stipulations
For this walkthrough, it’s best to have the next conditions:
An AWS account arrange.
A VPC the place you’ll deploy the answer.
An IAM function within the account with adequate permissions to create the mandatory sources. When you’ve got administrator entry to the account, no extra motion is required.
An current, working Amazon Q software, built-in with IAM Identification Heart. If you happen to haven’t set one up but, see Creating an Amazon Q software.
Entry to IAM Identification Heart to create a buyer managed software.
An SSL certificates created and imported into AWS Certificates Supervisor (ACM). For extra particulars, seek advice from Importing a certificates. If you happen to 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 may skip this part.
You’ll obtain a warning out of your browser when accessing the UI when you didn’t present a customized SSL certificates when launching the AWS CloudFormation stack. The directions on this part present you easy methods to create a self-signed certificates. This isn’t advisable for manufacturing use circumstances. 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 improvement functions), it’s best to be capable to proceed previous the browser warning web page. With Chrome, you will note the message Your connection just isn’t non-public error message (NET::ERR_CERT_AUTHORITY_INVALID), however by selecting Superior, it’s best to then see a hyperlink to proceed.
The next command generates a pattern self-signed certificates (for improvement functions) and uploads the certificates to ACM. You may also discover the script on the GitHub repo.
Observe down the CertificateARN to make use of later whereas provisioning the CloudFormation template.
Provision sources with the CloudFormation template
The total 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 Utility 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 title – The title of the CloudFormation stack (for instance, AmazonQ-UI-Demo).
AuthName – A globally distinctive title to assign to the Amazon Cognito consumer pool. Be certain that your area title doesn’t embrace any reserved phrases, similar to cognito, aws, or amazon.
CertificateARN – The CertificateARN generated from the earlier step.
IdcApplicationArn – That is the Amazon Useful resource Identify (ARN) for the AWS Identification Heart buyer software. Depart it clean on the primary run, as a result of you want to create the Amazon Cognito consumer pool as a part of this stack. This can create an IAM Identification Heart software 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 recommend conserving the default worth.
PublicSubnetIds – The ID of the general public subnet that can be utilized to deploy the EC2 occasion and the Utility Load Balancer.
QApplicationId – The prevailing software 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 software in IAM Identification Heart
RoleArn – ARN of the IAM function 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 software
Create an IAM Identification Heart software
The actions described on this part are one-time actions. The objective is to configure an software in IAM Identification Heart to symbolize the appliance you’re constructing. Particularly, on this step, you configure IAM Identification Heart to have the ability to belief the id tokens by which your software will symbolize its authenticated customers. Full the next steps:
On the IAM Identification Heart console, add a brand new customized managed software.
For Utility kind, choose OAuth 2.0, then select Subsequent.
Enter an software title and outline.
Set Utility 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 title and hold the map attributes as E-mail.
Within the IAM Identification Heart software 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 software credentials tab, select Enter a number of IAM roles and supply the worth for RoleArn you copied from the CloudFormation stack output.
Assessment all of the steps and create the appliance.
After the appliance is created, go to the appliance, select Assign customers and teams, and add the customers who may have entry to the UI software.
On the Choose setup kind web page, select All functions for service with identical entry, select Amazon Q from the Companies listing, and select Belief functions.
After the IAM Identification Heart software is created, copy the appliance ARN.
On the AWS CloudFormation console, replace the stack and supply the IAM Identification Heart software 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 duplicate the URL offered there.
Customized UI
The CloudFormation stack deploys and begins the Streamlit software on an EC2 occasion on port 8080. To view the well being of the appliance working behind the Utility Load Balancer, open the Amazon EC2 console and select Load Balancing below Goal teams within the navigation pane. For debugging functions, you may also connect with Amazon EC2 by means of Session Supervisor, a functionality of AWS Programs Supervisor.
To entry the customized UI, use the URL that you just copied from the CloudFormation stack output. Select Join and use the identical e mail deal with for the customers that had been registered in IAM Identification Heart.
After profitable authentication, you’re redirected to the customized UI. You may improve it by implementing customized options like dealing with suggestions, utilizing your corporations 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 whenever you’re performed.
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 realized easy 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 online business. You may embrace your organization branding and design, and have management and possession over the consumer expertise. For instance, you possibly can introduce customized suggestions dealing with options.
The pattern customized UI for Amazon Q mentioned on this publish is offered as open supply—you should use it as a place to begin in 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 examine again for the most recent updates. We welcome your solutions for enhancements and new options.
For extra data on Amazon Q enterprise, seek advice from the Amazon Q Enterprise Developer Information.
In regards to the Authors
Ennio Emanuele Pastore is a Senior Architect on the AWS GenAI Labs group. He’s an fanatic of the whole lot associated to new applied sciences which have a optimistic influence on companies and common 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 group. He has intensive expertise throughout large information, information science, and IoT, throughout consulting and industrials. He’s an advocate of cloud-centered information and ML platforms and the worth they’ll drive for patrons throughout industries.
Joseph de Clerck is a senior Cloud Infrastructure Architect at AWS. He leverages his experience to assist enterprises remedy their enterprise challenges by successfully using AWS companies. His broad understanding of cloud applied sciences permits him to plan tailor-made options on matters similar to analytics, safety, infrastructure, and automation.