Elevate Developer Efficiency and build GenAI Application with Amazon Q
Tags: aws, ai, genai, amazonq
Published: 2024-02-25 16:06:43

Begin your journey with Amazon Q by familiarizing yourself with the basics. 
Amazon Q is a fully managed, generative-AI powered assistant that can be tailored to respond to inquiries, offer summaries, create content, and execute tasks using data from your organization. It delivers timely and pertinent information to employees, streamlining operations and expediting issue resolution. You will be able to create, configure or use Amazon Q functionality either from AWS console or API.
Amazon Q comes as 4 variants – Amazon Q, Amazon Q for Amazon CodeWhisperer, Amazon Q for Amazon Connect and Amazon Q for Amazon QuickSight. Let’s explore Amazon Q deeper in this blog and touch upon Amazon Q for Amazon CodeWhisperer.

### Table of Contents

* [How Amazon Q works from User’s Lens](#users)
  * [For AWS Builder’s](#builders)
      * [Amazon Q on AWS](#aws)
      * [Amazon Q in IDEs](#ide)
* [How Amazon Q works from Developer’s Lens](#developers)	
  * [Create Amazon Q Application](#createapp)
  * [Update Amazon Q Application](#updateapp)
* [Resource Clean up](#cleanup)
* [Key Pointers](#pointers)	
* [Pricing](#pricing)	
* [Reference Links](#ref)	
* [Conclusion](#conclusion)		


### How Amazon Q works from User’s Lens <a name="users"></a>
#### For AWS Builder’s <a name="builders"></a>
* Amazon used 17 years of its knowledge and experience in training Amazon Q to provide guidance for every step of every step of the process of building, deploying, maintaining, and operating applications on AWS.
* Amazon Q is an AI assistant that answers natural language questions about AWS, offering guidance on service selection, AWS CLI usage, documentation, and best practices. It provides information summaries, step-by-step instructions, and links to relevant sources. 
* Amazon Q also uses conversation context to improve responses during the conversation. 
* Amazon Q offers code improvement suggestions and can generate new code within IDEs. 
* For troubleshooting, Amazon Q helps understand errors in the AWS Management Console and provides access to live AWS Support agents to address your AWS issues. 
* Amazon Q uses customer feedback to offer support and address technical issues.

##### Amazon Q on AWS <a name="aws"></a>
I prefer to refer to Amazon Q as a highly personalized AI assistant for AWS data.  Amazon Q is an expert on patterns in the AWS Well-Architected Framework, best practices, documentation, and solution implementations. Amazon Q can also interpret your feedback through Thumbs up or Thumbs down ratings, and it's ready to address follow-up questions with relevant answers. You have the option to clear all conversations and start fresh. Please note that conversations are preserved for 30 days by default unless you explicitly choose to clear them.

Here is a video demonstrating how to use Amazon Q chat, the AWS generative AI assistant, to gain a better understanding of AWS services, documentation, and related links.

{% embed https://youtu.be/oWAKoPu2SNI %}

##### Amazon Q in IDEs <a name="ide"></a>
You should be able to use Amazon Q within your favourite IDE – be it Visual Studio Code or JetBrains following the guide for Installing the AWS Toolkit for Visual Studio Code or  Installing the AWS Toolkit for JetBrains. 
**Setup Amazon Q in Visual Studio Code**
* For this blog, let's proceed with Visual Studio Code and you may follow the above instructions to install 
  * AWS Toolkit for Visual Studio Code.
  * Authenticate Amazon Q in Visual Studio Code
  * Enjoy the goodness of Amazon Q along with Code Whisperer

Follow the video, to explore the AWS Toolkit, demonstrate how to authenticate with your Builder's ID, show you how to use Amazon Q to request explanations for source code, generate a CloudFormation template using Amazon CodeWhisperer, and demonstrate how to resolve errors.

{% embed https://youtu.be/OcubFo6daxc %}

### How Amazon Q works from Developer’s Lens <a name="developers"></a>

Utilizing Amazon Q, you have the capability to construct an interactive chat application for your organization's end users. This can be achieved by leveraging a blend of your enterprise data and the extensive language model knowledge, or by relying solely on your enterprise data. These functionalities are supported by three separate yet interconnected workflows: admin, user, and Amazon Q.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pok6zv831rmcii3qk4rp.png)

#### Create Amazon Q Application <a name="createapp"></a>
Amazon Q Application Creation happens in 5 steps 

- **Create Application**
Enter an application name and either create a new AWS Identity and Access Management (IAM) service role or select an existing one that Amazon Q can assume. 
For the demo application, let’s name it as Intuitive-Insights. Finally, click on the Create button.

- **Select retriever**
This component fetches data from the index in real-time during a conversation. You have two options: you can either use the Amazon Q native retriever or utilize an existing Amazon Kendra retriever. The native retriever can access the data sources supported by Amazon Q. If you are already using Amazon Kendra, you can opt for the existing Amazon Kendra retriever to connect the relevant data sources to your Amazon Q application. I choose the native retriever option and proceed by selecting Next.

- **Connect data sources**
A data source in Amazon Q is a document repository which includes pre-configured connectors for a variety of popular data sources and enterprise systems. Amazon Q supports 35+ data sources covering data systems like MySQL, RDS, source control systems like GitHub, Content Management System like Confluence, Alfresco, Collaborative tools like Slack & Microsoft, Incident Management systems like Jira, Service Now etc. 
Amazon Q uses a data source connector to crawl and synchronize a data source with an Amazon Q index at a customizable interval. In this demonstration, let’s review web crawler to connect to Intuitive.cloud website – [https://intuitive.cloud](https://intuitive.cloud) to crawl and index blogs and case studies published on the website.

- **Previewing a web experience**
The Amazon Q web experience is a chat interface that you create using your Amazon Q application. You can customize this based on your requirement.

- **Deploying a web experience**
For your end users to login and chat, Amazon Q requires that you integrate your web experience with an identity provider (IdP) that's compliant with SAML 2.0. This integration is required so that only authorized end users from within your organization have access to your content. Please note that this blog recommends you to try integrating this based on the developer guide - [Deploying an Amazon Q web experience](https://docs.aws.amazon.com/amazonq/latest/business-use-dg/deploy-experience.html)

**Demo**
Follow the video, to create an application named Intuitive-Insights, select the default native retriever, connect to the Intuitive.cloud website – https://intuitive.cloud using web crawler. Wait for the application to be created successfully and Sync with the data source. After syncing with the data source, automatically the data will be indexed. You can then proceed to preview web experience by customizing the text in the web experience editor for Title, Subtitle and Welcome message. 
Finally, you are free to ask your questions. I have tried asking the following questions in the below video and you may see the answers for yourself.
- who is the founder of Intuitive.cloud
- Cloud Migration case studies 
  [Though there is a spelling mistake in the prompt, the AI assistant have corrected it and proceed to give the appropriate information to the user]

{% embed https://youtu.be/4cnWsQyjf20 %}
#### Update Amazon Q Application <a name="updateapp"></a>

* You will be able to update the following after the application is created
  * Application name
  * Create a new service role or change to an existing service role.
  * Retriever – if only you have not selected the retriever during the initial application creation
  * Index provisioning 
  * Data source – you can add / modify / delete data source of an application  

#### Resource Clean up <a name="cleanup"></a>
* _Preview Web experience_ -> The chat history is preserved for 30 days unless you clear explicitly.
* _Delete data source_ -> Delete a data source by selecting data source, Actions – Delete. This process takes a couple of minutes. Please make a note of the AWS IAM role related to the data source and delete after deleting the data source.
* _Delete Application_ -> Go to specific application in Amazon Q console and go to the top right corner of Amazon Q console, click Delete button.
* You will be getting the following dialog to capture the reason. Enter the details and submit to move forward. Deleting Amazon Q application is super quicker than data source. Please make a note of the AWS IAM role related to the data source and delete after deleting the application.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rhdlpa8ub3tqrja5a57u.png)

### Key Pointers <a name="pointers"></a>

* You can't change the retriever for your application after your application has been created. To change your retriever, you must create a new application.
* The data sources available to connect to your application change depending on your retriever choice.
During Preview, an Amazon Q application supports only 50 end users. If you would like increase, please contact AWS Support
* Amazon Q Code Transformation is available through the AWS Toolkit for JetBrains and VS Code IDEs.
* CodeWhisperer Professional – Information is not stored or monitored however for the individual tired, customer content including code snippets, conversations and file contents open in IDE may be stored and processed for service improvement.
* To verify the Amazon Q generated code is secure, you may use AWS services such as IAM Access Analyzer, Amazon Virtual Private Cloud (Amazon VPC) Network Access Analyzer, and Amazon CodeGuru to verify code and configuration security. 

### Pricing <a name="pricing"></a>
* Amazon Q offers two pricing plans: Business and Builder, priced at $20/user/month and $25/user/month, respectively. Many capabilities of Amazon Q are available at no charge during the preview period.
* The Business plan includes a business expert who can help solve problems, generate content, find insights in data, and take actions based on your company's data, information, and systems.
* The Builder plan includes both a business expert and an AWS expert who can transform the way developers and IT professionals build, optimize, and operate applications.
* The Amazon Q index is priced for units of 20K documents at a rate of $0.14/hour ($100/month) to support your business knowledge. You can start with 1 unit and add additional storage units as needed. Each storage unit includes 100 hours of connector usage per month.
* **Note:** some Amazon Q features may have additional pricing after the preview period.
* Please read  [Amazon Q Pricing ](https://aws.amazon.com/q/pricing/)for more details

### Reference Links <a name="ref"></a>
[Amazon Q Developer Guide](https://docs.aws.amazon.com/amazonq/latest/business-use-dg/what-is.html)
[Amazon Q User Guide](https://docs.aws.amazon.com/amazonq/latest/aws-builder-use-ug/what-is.html)

### Conclusion <a name="conclusion"></a>
In conclusion, Amazon Q provides a transformative experience for users and developers alike. 
Leveraging 17 years of AWS knowledge, Amazon Q serves as your ubiquitous assistant, seamlessly integrating into your workflow across the console, IDE, and documentation. It collaborates with you to develop new features, refactor existing ones, and troubleshoot issues on AWS. 
With its intuitive interface and powerful features, creating an Amazon Q application with a web crawler to sync Intuitive.cloud website's customer use cases is straightforward and efficient. Start leveraging Amazon Q today to revolutionize your data management and application development processes.