When Amazon Q Developer was first announced at the re:Invent 2023 in Las Vegas, NV, I felt like I had finally found what I had been looking for throughout my entire career as a DevOps Engineer in SRE. I couldn't wait to get my hands dirty and meet this amazing best friend of mine "in person" as I immediately knew this buddy (available 24/7 only for me) will save me hours of a day's work.
Amazon Q Developer is part of Amazon Q family which is generative AI powered assistant for software development (Amazon Q Developer) and company knowledge (Amazon Q Business), and in this blog, I'll dive deep into Amazon Q Developer.
By the way, did you know why it's called Q? Q is short for 'Question,' but it also calls to mind fictional characters from both Star Trek and James Bond who are known for their power, resourcefulness, and expertise.
Statistics and Facts
Organizations want to enable employees with generative AI as productivity improves more than 30% on average.
More than 80% of enterprises will have used generative AI APIs or deployed generative AI-enabled apps by 2026.
*According to Gartner, October 2023
How much time do developers spend coding?
Software.com analyzed data from more than 250 000 developers worldwide over a 3 month period, and they found that:
the median time that developers spend writing or editing code in their IDE is less than an hour per day (52 minutes),
per work week, developers spend less than 4 1/2 hours writing code,
only 10 % of developers spend more than 2 hours per day coding.
Amazon Q Developer vs. Amazon CodeWhisperer
Maybe you think now: "OK, but isn't it the same as Amazon CodeWhisperer?"
CodeWhisperer is where we got started [with code generation], but we really wanted to have a brand - and name - that fit a wider set of use cases.
(Doug Seven, Director, GM @ AWS| AWS AI Developer Experiences)
All of the features of CodeWhisperer were moved to Amazon Q Developer in April 2024, that means CodeWhisperer is now Amazon Q Developer. In addition, there are some more features of Amazon Q Developer that weren't available in CodeWhisperer, such as:
- diagnosing console errors (with Amazon Q),
- transforming your code with Amazon Q Developer agents for transformation,
- developing software with Amazon Q Developer agents for software development,
- chatting about your costs (retrieve and analyze cost data from AWS Cost Explorer),
- chatting about your resources (list, describe, and get guidance based on resources in your AWS account).
By including @workspace in yur prompt, Amazon Q Developer will automaticaly ingest and index all code files, configurations and project structure
UPDATE Recently announced
Why to use Amazon Q Developer?
Amazon Q Developer is your assistant for the entire software development lifecycle (SDLC):
- helps developers and IT profesionals with all of their tasks - from coding, testing and upgrading to troubleshooting, performing security scanning and fixes, optimizing AWS resources and creating data engineering pipelines,
- helps developers build faster and more securely by generating code suggestions and recommendations in near real time,
- converses with developers to explore new AWS capabilities, learn unfamiliar technologies, and architect solutions.
Core Use Cases
Retire tech debt at scale
Modernize projects and upgrade language version and dependencies
with Amazon Q Developer Agent for code transformation.Drive developer productivity
Get inline coding recommendations, summarize and document code,
scan for security issues, diagnose and troubleshoot bugs, and write
unit tests.Improve security and code quality
Ship more secure code with less effort with code scanning and automated code recommendation.
Subsription and Pricing
Amazon Q Developer comes in two different tiers of use:
a Free tier (has limitation how much you interact with the service, for example user can have only 50 chat interaction per month) ,
a Professional tier called Q Developer Pro (has no limitation or much higher limits and costs $19 a month per user).
While this might sound high, you might find that the efficiency and productivity boost from using the service is worth the cost.
The main features, such as chat, code completions, security scans, and reference tracking are available in both.
You can find official Amazon Q Developer pricing page here.
You can also find some key differences between tiers below:
*LOC is lines of code.
Amazon Q Developer Integration and Setup
Amazon Q lives where you work, right inside your IDEs (JetBrains, IntelliJ IDEA, VS and VSCode), Slack and Teams (through AWS Chatbot), AWS consoles or even in the CLI (on Mac).
Now Also support for an Eclipse and GitLab Duo.
UPDATE Recently announced
Workflow is as follows:
In your IDE download the extension for Amazon Q. It’s available as an extension or plugin for JetBrains IDEs and VSCode and as the AWS Toolkit extension in Visual Studio.
Authenticate yourself. You can do this in two ways:
- the first way, if you want to use the service for free, is to authenticate yourself through your Builder ID.
- the second way is through the Amazon Q Developer Pro plan, that requires your administrator to set up an identity for you in IAM Identity Center (AWS SSO):
Your Administration needs to provide you Start URL and Region:
Integrate Q Developer into your organization and gain organization-wide capabilities to control what your accounts, users, and groups do with the service.
Now AWS account administrators can create subscriptions for standalone or AWS Organizations member accounts.
UPDATE Recently announced
Amazon Q Developer is available as a feature in several other AWS services:
- Amazon Q in Amazon SageMaker Studio,
- Amazon Q Business,
- Amazon Q in Amazon CodeCatalyst,
- Amazon Q in Amazon Connect,
- Amazon Q in AWS Glue,
- Amazon Q in Lambda,
- Amazon Q in Amazon QuickSight,
- Amazon Q in VPC Reachability Analyzer,
- Amazon Q in Amazon EC2,
- Amazon Q in AWS Chatbot,
- Amazon Q in AWS CloudFormation,
- Amazon Q in Amazon Cloudwatch,
- Amazon Q in Amazon SageMaker Canvas,
- Amazon Q in GitLab Duo (preview).
UPDATE Recently announced
(Separate Article about GitLab Duo in progress..)
Amazon Q Developer "Magic"
Now that we are already familiar with Q Developer, I'll show the features I like the most.
Dashboard for user activity
Amazon Q Developer Pro tier now provides a detailed usage activity dashboard that gives administrators greater visibility into how their subscribed users are leveraging Amazon Q Developer features and improving their productivity.
UPDATE Recently announced
New customers will have this usage dashboard enabled by default. Existing Amazon Q Developer administrators can activate the dashboard through the AWS Management Console to start tracking detailed usage metrics.
3rd party Plugins
Amazon Q Developer Agent for code transformation
With Code Transform feature you can:
- complete language upgrades in a fraction of the time (currently supports upgrades from Java 8 or 11 to Java 17),
and enhanced Java upgrages to Java 21.
transform embedded SQL from Oracle to PostgreSQL.
also added transformation capabilities for:
.NET application porting from Windows to Linux,
Mainframe application modernization,
VMware workload migration to AWS.UPDATE Recently announced
How does /transform work?
Open Amazon Q chat in your IDE and type /transform.
Amazon Q Developer code transformation recieved new CLI tool (public preview).
UPDATE Recently announced
- It will automatically prompt to upgrade Java as follows (example for upgrade to Java17):
Then you need to add path to your Java code and your transformation starts. It takes usually up to 30 mins.
/dev Looking at this project, can you tell me which version of java this project is using?
/usr/libexec/java_home -V #Current java varsion
/usr/libexec/java_home -v 1.8 #Path to java8 (need to update ~/.zshrc or ~/.bash_profile #depends what you are using in your IDE terminal)
#if MAC:
brew tap adoptopenjdk/openjdk
brew install --cask adoptopenjdk8
brew install maven
Below you can see newly generated Code Transformation plan by Amazon Q and Code Transformation Summary by Amazon Q.
Java has been successfully upgraded even you can see some red flags.
The reason why upgrade succeeded is that during the process Gen AI fixed errors itself.
At the end we can review our pom.xml file before and after upgrade.
Amazon has migrated tens of thousands of production applications from Java 8 or 11 to Java 17 with assistance from Amazon Q Developer. This represents a savings of over 4,000 years of development work for over a thousand developers (when compared to manual upgrades) and performance improvements worth $260 million dollars in annual cost savings.
Don't forget to verify your new created tests by following command:
mvn verify -f "PATH to pom.xml file"
or as follows
- It will automatically prompt to upgrade Java as follows (example for upgrade to Java21):
Amazon Q Developer Agent for software development
Amazon Q Developer has an agent for software development (type /dev in chat window) that can autonomously perform a range of tasks–everything from writing and implementing entire application features in minutes right from a simple natural language prompt in your IDE.
This agent got new capabilities, such:
- enhanced documentation in codebases (type /doc in chat window),
- supporting code reviews to detect and resolve security and code quality issues (type /review in chat window),
- generating unit tests automatically and improving test coverage (type /test in chat window).UPDATE Recently announced
Developers can collaborate with the agent to review and iterate on the plan before the agent implements it, connecting multiple steps together and applying updates across source files, code blocks, and test suites.
How does /doc work?
Type /doc in IDE Q chat window and choose if you want to create new README or update an existing README.
After you choose an existing README, you can select from update README to reflect code or make a specific change.
Then approve project by clicking on YES button or write specific change.
How does /test work?
Type /test in IDE Q chat window and write your description. This agent support only tests (Java and Python) for selected code.
How does /review work?
Type /review in IDE Q chat window to identify and fix code issues before committing. Then you can choose if you want to scan whole project (workspace) or active file only.
Scan detects security vulnerabilities, scans for secrets, and assesses the security of your infrastructure as code files. You can scan an entire codebase or you can analyze your code as you write it using automatic scans.
For example, it might detect resource leaks, SQL injection, hardcoded database connection strings, infrastructure as code misconfiguration, and more.
After it scans your code it will provide you with a list of security issues found in your files.
You can then select each problem detected in the list of issues. It will take you to the line in your code where it found the issue. You can then hover over the line and see more details about the problem.
Sometimes you can see fix your issue button that is only available for certain issues. This option is an automatic code fix. The description will show that there’s a code fix available, and you can select this fix and it will directly update your code for you.
How does /dev work?
Type /dev in IDE Q chat window and describe your task or feature in as much detail as possible.
Once the /dev command is entered in the IDE, the agent packages the project and securely uploads it to Amazon Q, initiating project-specific code generation. The Amazon Q Developer agent not only focuses on code generation, but also maintains a real-time connection with the developer, providing updates throughout the process and delivering a polished patch or implementation for the requested feature.
This real-time execution is powered by a Devfile, which defines the development environment and commands the agent can use. If a project doesn’t already have a Devfile, Amazon Q Developer will prompt users to create one after their first run of /dev. Without a Devfile, the agent will develop solutions without the additional feedback provided by running builds or unit tests, limiting developers’ ability to receive real-time feedback during the development process.
The Devfile must conform to the Devfile 2.2.0 schema. Currently, Amazon Q Developer supports the install, build, and test commands.
Core enhancements in the latest Amazon Q Developer update
- Customizable Commands: Developers can specify commands in a Devfile to control which commands the AI agent runs, reducing unnecessary steps and improving accuracy.
- Flexible Environment Setup: Developers can use custom Docker images preloaded with dependencies for faster startup times, providing the agent has all necessary tools.
- Sandboxed Security: Amazon Q Developer secures the execution within isolated environments, offering comprehensive logging and robust permission controls to safeguard any changes made.
With this setup, Amazon Q Developer can execute tests, apply migrations, and run installation commands directly within a sandbox, providing feedback to the agent for iterative improvements.
Customers have reported efficiency improvements of 25% faster initial development and up to a 40% increase in developer productivity.
Explain code with conversational coding
This is especially useful for new developers who may have just inherited a legacy code base and who may have questions about what some of the various code modules do.
As you can see, there is much more you can do, such as:
- Refactor Code for Code Readability: Improve the readability of a specific code module by refactoring it. Break down complex functions into smaller, more manageable units, and apply meaningful variable and function names for better clarity.
- Optimising your code can help you towards cost and sustainability goals, and so may provide you with some good options.
- and many more...
Amazon Q Developer in the AWS Management Console
Ask questions and get guidance from 17 years of AWS knowledge, best practices, well-architected advice (best practices, AWS WAF, Amazon EC2 instance optimization).
You can also tetrieve and analyze cost data from AWS Cost Explorer (in preview).
Inline coding companion in IDE and CLI
How does this kind of coding work?
- based on your natural language prompt,
- generate up to 5 suggestions (Tab for accept, Arrows for moving between suggestions),
- by pressing Enter Q Developer generates code for you based on your private repositories.
Plus
I find this very helpful because if I were to write the code manually, I would have had to look up some of the exact wording and syntax, which would have taken me much longer and potentially could have been less accurate.
Even though the generated code need some manual fixes to meet IaC best practices, it still can save developers a lot of time.
Cons
You really need to know where your code is going for Q Developer to be helpful, though. Sometimes, Q Developer might get it wrong, suggest something you're not looking for, or not follow common coding best practices, so you need to stay focused. This tool isn't a replacement for a programmer and to get the most out of it, you need to know what you want your code to look like so you can pick the right suggestions from Q Developer.
EC2 instance type suggestion
Amazon Q can help you with choosing right instance type while creating EC2 instance.
Troubleshooting
Amazon Q Developer has expanded its AWS Console error coverage from US East (N. Virginia) and US West (Oregon) to AWS Commercial regions. Users can now troubleshoot AWS Console errors using Amazon Q Developer regardless of their console region, including locations like Europe (Frankfurt).
UPDATE Announced on February 2024
- Troubleshoot errors from the following services - Amazon S3, AWS Lambda, Amazon EC2, Amazon Elastic Container Service and
also Amazon CloudFormation.
UPDATE Recently announced
- Troubleshoots IAM Permission and Athena console errors across all AWS Console pages.
- AWS announced a new capability to investigate and remediation operational issues, which seamlessly integrated into Amazon CloudWatch and AWS Systems Manager UPDATE Recently announced
- Lambda troubleshooting example This is my fave! I have written basic lambda for creating object in S3 bucket with some text. While testing it I've got an error. What now?
Just click on Diagnose with Q and Q will help to troubleshoot.
So I was missing inline policy, fixed it and rerun test and test succeeded.
- VPC Reachability Analyzer troubleshooting example
In case you are experiencing a network problem, you can ask in AWS Management Console for help. It will forward you to network troubleshooting chat.
Q will help you identify and fix the issue.
Conclusion and Findings
I believe that Q will become part of every aspect of how developers complete development tasks. Across Research, Design, Test and Maintain. From how developers find the information they need and how they understand code, to writing the actual code and figuring out bugs, all the way to doing the code reviews. Q will even brainstorm with developers how to improve applications. With Q, developers can spend more time building, innovating and experimenting.
Like all new tools, we need to learn how to get the best of them.
PS: If you're looking for information on Amazon Q Developer Security and couldn't find it, it's because I wrote a separate article on the topic. Check it out here.
https://dev.to/lydiadely/the-security-of-amazon-q-developer-50g