DEV Community

Cover image for Amazon Q: Your GenAI Assistant for Business Processes, Code Reviews, and Documentation
Girish Bhatia
Girish Bhatia

Posted on

Amazon Q: Your GenAI Assistant for Business Processes, Code Reviews, and Documentation

If you followed re:Invent 2024, you likely noticed that Generative AI/ML was one of the hottest topics. In addition to Amazon Bedrock and Sage Maker, there were numerous sessions dedicated to Amazon Q. According to the session catalog, around 100 sessions, including breakout sessions, were conducted, covering topics such as Amazon Q Business, Amazon Q Developer, and Amazon Q Quick Sight.

In this article, let's see two quick examples of how Amazon Q can help.

In first example, I will use Amazon Q to ask questions about AWS account resources, like how many EC2 in the account, or how many APIs in the account, How many S3 buckets etc.?

In the second example, I will show how Amazon Q can help with code documentation or even with some code refactor!

Prerequisites

  • Familiarity with the AWS Management Console.
  • A basic understanding of Amazon Q.
  • Access to VS Code IDE with:
  • The AWS Toolkit installed.
  • A basic knowledge of Python programming.

Let's get started:

  • What is Amazon Q?
  • First Example: Amazon Q as your go to assistant for your account questions
  • Second Example: Amazon Q as your assistant to document your code or refactor

What is Amazon Q

Amazon Q is a Generative AI assistant designed to enhance efficiency across various domains, similar to other Generative AI technologies. It provides valuable support for businesses by streamlining knowledge management, automating repetitive tasks, and assisting professionals across diverse roles.

Here's how Amazon Q can help:

Business Users: Simplifies knowledge management and automates routine tasks.
Data Engineers: Assists with data analysis and insights generation.
Call Center and Supply Chain Associates: Supports domain-specific tasks by integrating with services like AWS Connect.
Developers and Software Engineers: Integrates with IDEs to enhance productivity, offering features like:

  • Code documentation and review
  • Unit test generation
  • Code refactoring and optimization

Amazon Q is available in several specialized variants to suit different business use cases, including:

  • Amazon Business Q
  • Amazon Developer Q
  • Amazon Q for Connect
  • Amazon Q for QuickSight
  • And more

In this article, I’ll demonstrate examples of Amazon Q for AWS Account and Amazon Q Developer for VS Code.

First Example: Amazon Q as your go to assistant for your account questions

Amazon Q can become your go-to assistant for account-related questions, saving you valuable time. While it’s possible to look up the same information manually or through various reports, Amazon Q simplifies the process by providing quick, at-a-glance insights at your fingertips whenever you need them.

Here are a few examples of questions you can ask:

  • How many EC2 instances are running in the account?
  • How many APIs are deployed?
  • How many S3 buckets exist?
  • What is my average monthly cost?
  • And more!

To engage Amazon Q in your account, log in to the AWS Management Console and click on the Amazon Q icon.

Image amazonq

Example Prompts and Results

Prompt:

I asked Amazon Q, "How many S3 buckets do I have?"

Image prompt1

Result:

Amazon Q analyzed the resources in my account and summarized that I have 11 S3 resources.

Image result1

Prompt:

Next, I wanted to check my average cost over the last three months, so I asked Amazon Q, "What is my average cost in the last 3 months?"

Image prompt2

Result:

Amazon Q provided a clear breakdown of my average monthly cost based on the last three months of account data.

Image result2

This concludes our overview of Amazon Q for AWS accounts. Next, let’s explore how Amazon Q Developer can act as your assistant for code-related tasks.

Second Example: Amazon Q as your assistant to document your code or refactor

Amazon Q Developer is GenAI powered assistant that can be embedded in your IDE such as VS Code. When Amazon Q Developer is used in in the IDE, it can provide recommendation to optimize the code, refactor the code, can generate comments/doc for the code and can also scan the code for security vulnerabilities.

Example Code snippet

Image code1

Right click and ask Amazon Q to Refactor

Image code2

Amazon Q not only created the function but it also provided an example of how to use this function in your code.

Example of how to use the function:

Image code3

While Amazon Q provided the recommended code, developer retain the final control and can select if recommended code should be inserted or rejected.

In 2024, Amazon Q introduced inline chat feature, allowing you to add prompts directly within the code at the cursor. This enhancement further simplifies the use of Generative AI-assisted Amazon Q, increasing efficiency. The more time you save in your software development cycle, the more time you can dedicate to developing additional features, accelerating the software's speed to market.

Inline chat

Image inchat1

And here is the resulted code, recommended by Amazon Q.

Image inresult1

These recommendations either can be accepted or rejected by the developer.

Let's look at another feature. Amazon Q can help add comments/document the code.

Document the code by adding comments

Image inchat2

And here is the resulted code, comments added by Amazon Q.

Image inresult2

Again, These recommendations either can be accepted or rejected by the developer.

Conclusion

GenAI-based solutions are here to stay, as they continue to revolutionize technology's impact on businesses. Implementing these solutions with appropriate guardrails enables businesses to optimize repetitive tasks and enhance customer service.

Amazon Q is one such GenAI tool, catering to both business SMEs and technical SMEs with features tailored to their specific needs. For instance, business users can leverage Amazon Q to interact with policy documents, while engineers can use it for code optimization, code reviews, and documentation assistance.

As these solutions advance, I remain committed to exploring their potential and sharing valuable insights with you. Stay tuned for more content!

Thank you for reading!

Watch the video here:


https://www.youtube.com/watch?v=fVgW0o-UToU

π’’π’Ύπ“‡π’Ύπ“ˆπ’½ ℬ𝒽𝒢𝓉𝒾𝒢
𝘈𝘞𝘚 𝘊𝘦𝘳𝘡π˜ͺ𝘧π˜ͺ𝘦π˜₯ 𝘚𝘰𝘭𝘢𝘡π˜ͺ𝘰𝘯 𝘈𝘳𝘀𝘩π˜ͺ𝘡𝘦𝘀𝘡 & π˜‹π˜¦π˜·π˜¦π˜­π˜°π˜±π˜¦π˜³ 𝘈𝘴𝘴𝘰𝘀π˜ͺ𝘒𝘡𝘦
𝘊𝘭𝘰𝘢π˜₯ π˜›π˜¦π˜€π˜©π˜―π˜°π˜­π˜°π˜¨π˜Ί 𝘌𝘯𝘡𝘩𝘢𝘴π˜ͺ𝘒𝘴𝘡

Top comments (0)