Getting Started with Amazon Q Developer Customizations
Summary
TLDRIn this engaging video, the narrator recounts a tale of rapid learning and code validation with Amazon Q Developer. After purchasing a book on microservices, they were tasked with implementing a new persistence layer. Initially, their PR was rejected due to non-compliance with company guidelines. Leveraging Amazon Q Developer's customization feature, they trained it on the company's coding style, leading to a successful code submission. Developer advocate Ricardo Ferreira demonstrates how to customize Amazon Q Developer with specific codebases for tailored recommendations, showcasing its potential for new developers and open-source contributions.
Takeaways
- 📚 The video tells a story of a developer who had to quickly learn microservices with Spring Boot for a new task.
- 🛠️ The developer's task was to implement a new persistence layer for an entity called 'Orders' using best practices and Spring Boot's support.
- 🔍 To ensure adherence to coding standards, the developer used Amazon Q Developer for code validation and received feedback on company guidelines.
- 🚫 The initial PR was rejected due to non-compliance with company implementation guidelines, such as base class inheritance and logging framework usage.
- 🔄 The developer then utilized Amazon Q Developer's customization feature to align with the company's coding style, inspired by the Spring Petclinic sample application.
- 👋 Ricardo Ferreira introduces the Amazon Q Developer customization feature, which trains the tool on a specific codebase for tailored recommendations.
- 🔧 The customization feature is beneficial for new contributors to open source projects or developers working with proprietary APIs.
- 📝 The process involves preparing code samples, creating a customization in Amazon Q Developer, and associating it with users or groups for access.
- 🔗 The customization connects to code repositories or Amazon S3 buckets where the training code samples are stored.
- ⏱️ Training the customization on code samples takes time, ranging from minutes to over an hour, depending on the complexity.
- 📊 Amazon Q Developer provides a score to evaluate the quality of the code samples used for training, with scores ranging from 1 to 10.
- 🎯 After activation, the customization influences the recommendations and code generation provided by Amazon Q Developer, ensuring they align with the trained codebase.
Q & A
What was the main challenge the developer faced in the script?
-The developer faced the challenge of having their pull request (PR) rejected because the code did not follow the company's implementation guidelines, despite being technically correct.
What is the purpose of the Amazon Q Developer tool mentioned in the script?
-Amazon Q Developer is a tool that helps developers by providing code recommendations and validations based on known coding best practices, and it can be customized to adhere to specific coding styles or company guidelines.
What is the Amazon Q Developer customization feature?
-The Amazon Q Developer customization feature allows developers to train the tool using a specific codebase so that future recommendations and code generations align with the practices and styles of that codebase.
How did the developer initially validate their code?
-The developer initially used Amazon Q Developer to validate their code, ensuring it was implemented based on known coding best practices.
What was the feedback given by the reviewers on the developer's PR?
-The reviewers noted that while the code was technically correct, it did not follow some of the company's implementation guidelines, such as inheriting from the right base class and using the correct logging framework.
What sample application did the reviewers recommend the developer study?
-The reviewers recommended studying the Spring Petclinic sample application, which is where the company's implementation guidelines come from.
How can Amazon Q Developer be trained to understand a specific codebase?
-Amazon Q Developer can be trained by providing it with code samples from the specific codebase, either by pulling the code directly from a repository like GitHub or by uploading the samples to Amazon S3.
What is the significance of the numeric score provided by Amazon Q Developer after training?
-The numeric score indicates the quality of the code samples provided for training, with 1 to 3 being poor, 4 to 7 fair, and 8 to 10 very good, reflecting how well the tool has learned from the samples.
What steps are involved in setting up the Amazon Q Developer customization feature?
-The steps include preparing code samples, creating customization in Amazon Q Developer, providing the URI of the S3 bucket or repository, activating the customization, and associating it with users or groups to make it available for them.
How does the developer ensure that the customization is available in their IDE?
-The developer needs to ensure that the customization is activated and then associated with the user or group that the developer's IAM belongs to, allowing access to the customization within the IDE.
What was the result when the developer used the customization feature in Amazon Q Developer?
-The developer received code recommendations that were more aligned with the company's guidelines, including extending the correct base entity and using the appropriate logging framework.
Outlines
📚 Learning Microservices with Amazon Q Developer
The video script begins with the narrator recounting a personal experience where they had to quickly learn microservices using Spring Boot to complete a task. They purchased a book from Amazon and started implementing a new persistence layer for an entity called 'Orders'. After implementing the task according to best practices and using Amazon Q Developer for validation, their pull request was rejected due to not adhering to the company's specific implementation guidelines. The solution was to study the Spring Petclinic sample application and utilize the Amazon Q Developer's customization feature to align with the company's coding standards.
🛠️ Setting Up Amazon Q Developer Customization
The script continues with a detailed tutorial on setting up the Amazon Q Developer customization feature. The process involves creating a customization with a specific name, connecting to a repository or Amazon S3 bucket containing code samples for training, and activating the customization. The narrator, Ricardo Ferreira, explains the importance of providing a diverse set of code samples to train Amazon Q Developer to understand and replicate the coding style across various scenarios. The customization score is also discussed, which quantifies the quality of the training samples, and the process of associating the customization with users or groups to grant access.
🔑 Accessing and Utilizing Customization in IDE
The final paragraph of the script describes how to access the activated customization in an Integrated Development Environment (IDE) and use it to receive recommendations and code generations based on the trained code samples. The narrator demonstrates how to select the customization and test it by asking Amazon Q Developer to create a new entity class and repository implementation. The results show that the customization successfully provided recommendations that aligned with the company's coding standards, such as extending the base entity and using Log4J. The video concludes by encouraging developers to leverage the Amazon Q Developer customization feature to enhance their development process.
Mindmap
Keywords
💡Microservices
💡Spring Boot
💡Persistence Layer
💡Entity Class
💡JPA Annotations
💡Repository Pattern
💡Amazon Q Developer
💡Customization Feature
💡Code Samples
💡PR (Pull Request)
💡Implementation Guidelines
Highlights
Developers sometimes need to quickly learn new skills to complete tasks, as illustrated by the story of using Amazon Q Developer.
The task was to implement a new persistence layer for an entity called Orders using microservices with Spring Boot.
Amazon Q Developer was used to validate code based on known coding best practices.
The initial PR was rejected due to not following the company's implementation guidelines.
The Spring Petclinic sample application was recommended as a reference for the company's coding guidelines.
Amazon Q Developer's customization feature allows training with a specific codebase for tailored recommendations.
Customization is beneficial for adhering to open source project guidelines or proprietary APIs.
Ricardo Ferreira introduces the Amazon Q Developer customization feature in a tutorial.
The tutorial covers setting up the customization feature from scratch and using it in an IDE.
Code samples for training can be pulled from a repository or uploaded to Amazon S3.
Different variations of the Spring Petclinic sample were used to train Amazon Q Developer.
The training process uses machine learning APIs and generative AI technologies.
A score is given by Amazon Q Developer to evaluate the quality of the provided code samples.
Customization needs to be associated with users or groups to be accessible.
Identity Center and AWS organization setup is required for associating customization with users or groups.
After activation, the customization influences the recommendations and code generations provided by Amazon Q Developer.
The customization feature allows for more specific and unique code recommendations based on learned code samples.
The video concludes by encouraging developers to start using the Amazon Q Developer customization feature.
Transcripts
(pages rustling)
- Every once in a while,
developers have to learn something really quick
so they can finish up a task.
We're gonna tell the story
about when that happened with me,
and how Amazon Q Developer saved the day.
Let's go. (lively music)
It all started with me buying a book at Amazon
about microservices with Spring Boot.
I needed to learn this
to be ready for a new task I was assigned to.
The task was fairly simple,
implement a new persistence layer
for a entity of the system called Orders.
All I needed to do was create a new entity class,
add JPA annotations,
and implement a repository pattern
using the Spring Boot support for it.
The stances had shown everything was working as expected.
To make sure I was on the right track,
I used an Amazon Q Developer to validate my code.
Everything was implemented,
based on known coding best practices.
I filed a PR with my code
and waited for the development team to review the task.
(instrument squeaks)
However, my PR got rejected. (instrument thuds)
The reviewers shared that my code was technically correct,
but it was not following
some of the company's implementation guidelines.
Details like inheriting from the right base class,
usage of the correct login framework,
was missing.
They recommended studying
the Spring Petclinic sample application,
which is where the company's implementation guidelines
come from.
That's when I had the idea
of using the Amazon Q Developer customization feature.
Let me show you how I did it.
Hi, there, my name is Ricardo Ferreira,
and I'm a developer advocate here with AWS.
I'm super excited to show you
the Amazon Q Developer customization feature.
So what this feature is about,
it allows you to use a specific code base
for training purposes
so the next time you ask for a recommendation
for an Amazon Q Developer,
or perhaps even code generation,
this is going to be provided,
based on the training code.
This is interesting for a lot of situations.
For example, let's say you wanna start contributing
to an open source project
and you have to adhere to the implementation guidelines,
so instead of spending weeks, and perhaps months,
studying the code base,
you can use that code base,
send it to Amazon Q Developer,
who is going to train for a couple of hours,
and then you can start asking questions
about how to do things,
giving the specific code implementation practice
of that sample code.
The other situation could be
you are the new developer
of a team from a company that uses proprietary APIs,
and obviously, those proprietary APIs
are not available elsewhere,
and Amazon Q Developer would never know
how to handle them.
So what you can do is ask your team leader
to send a specific sample code to Amazon Q Developer,
who is going to learn all the gimmicks
and the implementation style
from those APIs,
and then the next time you ask for a recommendation
about how to complete a task,
guess what?
Your recommendation is going to be custom-tailored
specifically for you.
In this video, I'm gonna show you
how to set up from scratch
the Amazon Q Developer customization feature,
and also how you can use that customization
specifically in your IDE
to ask for recode recommendations.
So without further ado, let's get to it.
Your first step should be preparing your code samples
for training purposes,
and you can accomplish this in two ways.
The first one is having Amazon Q Developer
to pull the code directly from your repository,
such as GitHub,
or you can upload those code samples to Amazon S3,
which is going to be the strategy I'm going to use here now.
So as you can see here,
I have this bucket called spring-petclinic-code,
and then inside that folder,
I've created a subfolder called code-content,
where I've uploaded all my code samples
that I want to use for training purposes.
So in this scenario,
I'm using famous Spring Petclinic sample,
but as you can see here,
I've provided different variations of the same sample.
So the first one is using angular
as the frontend framework,
same backend, but a different frontend,
and then the same backend,
but using reactjs as frontend,
and also a complete 100% sample of the same code
using the rest APIs
for communicating across the layer.
So this is important
for Amazon Q Developer to understand,
in a more specific manner,
how you are going to leverage your coding style,
and how it can reuse it across multiple scenarios.
When you start asking questions
and you're creating your prompt
about how the code should be generated,
or even code suggestions,
this is going to be extremely important
about how Amazon Q Developer is going to,
"Oh, okay, I'm going to match your intentions
to what I have learned."
Once you have uploaded all your code samples,
you can go to Amazon Q Developer
and then start creating your customization.
So how you can do this,
you're going to use this menu here,
and then the customization feature,
which is currently in preview,
but probably, by the time you are watching this video
it's going to be generally available for you to use,
but the workflow is going to be virtually the same.
So you're going to use this button here,
Create Customization,
and then you are going to name your customization.
And this case, I'm gonna call spring-petclinic
to remind me that all this training purpose
is based on the famous Spring Petclinic code samples.
And then you can use different connection providers.
In this case, CodeStar, we can connect
to different repositories such as GitHub,
or you can select Amazon S3,
which is going to be this case for this demo.
So in here, you have to provide the URI of your S3 buckets
to which you can click here, Browse S3,
and then you can simply select the URI
that you want to use.
So in this case, I'm going to use this URI over here
from the code-content,
you're gonna click copy S3 URI,
and then going back to Enter S3 URI,
I'm going to simply paste here the content.
Once you have done this, you can simply go,
scroll down and click on Create Customization.
Before I do this, just a heads-up
that you can also use this feature called Log Deliveries,
which is a way for you to kind of follow up
and perhaps troubleshoot
the whole training purposes,
because as Amazon Q Developer is trained,
it's going to flush events to whatever you set here.
So in this case, I'm going to set for CloudWatch logs
so we can actually perhaps go there
if something goes wrong,
and then follow up
about what was the flow of the training purposes.
Once you have done this,
you can simply create customization.
So how this works,
because the training process, it's something
that is going to leverage machine learning APIs
and all the fancy generative AI technologies
that Amazon is backed behind Amazon Q Developer.
And then this is going to take a little bit of time.
So this is not something
that we're talking about, like, a couple of minutes,
or perhaps ten minutes.
In my tasks here, it usually takes from four or five minutes
to one hour and a half.
So what's gonna happen now
is that I am going to fast-forward
to the point where this process has finished.
So see you in a minute.
All right, so our customization has been properly created,
and then we can go ahead and do the review of the score.
So what is the score?
It's a numeric value that Amazon Q Developer gives you
to quantify how good or how bad your code samples are.
So in order to review this,
you are going to click here on this I button,
and then you are going to use the scoring model number.
So 1 to 3, it means
that you've provided a poor set of code samples,
4 to 7 is fair,
it means that you can go ahead and activate,
and chances are that you are going to receive
some good recommendations from that,
and 8 to 10 is very good,
it means that there's no doubt
that whatever recommendations are provided
are going to provide some benefit for you.
So in this case, we've ended up
with the evaluation score of 5,
which is in a range of fair,
so we can actually go ahead and use this revision.
So to activate this revision,
just scroll down to the bottom of the page,
and you are going to select the version
that you are going to use.
This is important, because once given,
customization can have multiple versions,
and this is important
because even after you reactivate,
you might decide to provide more code samples
for the same customization,
so you're gonna end up with multiple revisions.
So I'm going to select this version and click on Activate.
Now that your customization has been activated,
it is ready to be used.
However, there's one thing
that I would like you to keep in mind
before trying to use that customization.
If you jump to your ID right now,
and if you go to the Select Any Custom customization,
you are going to see this message,
"You don't have access to any Amazon Q customization,"
and the only one available to you
is going to be the Amazon Q foundation,
which is the default one
that comes out of the box with Amazon Q Developer.
So why this happens,
because the customization has to be associated
with users and/or groups,
so it becomes available to them.
So what's gonna happen now
is that you need to go back to your customization
and then scroll down here to the bottom of the page
and go to this tab, Users and Groups.
So we're gonna click on here,
and then either you are going to select specific individuals
from your organization,
or you can select specific groups
that comprises one or multiple users.
So in my case here, I'm going to select a group
that I call StandardDeveloper,
and this group is associated
with multiple developers in my organization,
and I'm going to add this group to my customization.
So what's gonna happen right now
is that any user that belongs to that organization
is gonna be able to not only see, but to leverage
that customization
and any information that pertain
from the code samples that was used for training purposes.
If you are wondering
where those users and/or groups are coming from,
they are coming from the identity center
that is associated
with your Amazon Q Developer professional subscription.
So if you have never done this before
and you want to learn how to set up this,
you can follow up this blog post that I've wrote
that teaches you how to set up your own AWS organization,
the Identity Center,
and how to activate the pro subscription
of Amazon Q Developer.
In this tutorial, I show you everything about,
since the creation of the organization,
how to actually set the right permissions,
the IAM roles for your AWS users
so everything works flawlessly.
The link is on the description below.
Now that the customization has been associated
with the proper group,
I'm going to try one more time
to select the customization from my ID.
So I'm gonna click Amazon Q Developer
and then select customization.
So right now, you can see
that the spring-petclinic customization is available to me.
Remember that this is only available
because the user IAM connected in the IDE
belongs to that group called StandardDeveloper
that I've associated with the customization.
So I'm going to select this customization,
and from this point on,
all the recommendations and code generations
that Amazon Q Developer is going to give me
is going to be based on the learnings
for the code samples that was used for training purposes.
Let's now test if Amazon Q Developer is gonna be able
to provide me with the recommendation I am expecting
since I am using the customization created.
So I am going to repeat the same prompt
that I've used before
to create me a new entity class,
and a repository implementation using based on JPA.
So I'm gonna hit Enter, and let's see how that goes.
So let's review the code provided here as a suggestion.
I'm gonna go back real quick,
and then let's start by reviewing the entity implementation.
So the first thing I've noticed
is that now, it is extending base entity.
This was part of the feedback provided on the PR,
so it's good.
It seems to be following the expected best practices,
and also, it's using Log4J
as the implementation framework,
so it's no longer using Java Logging,
which was also something that I did wrong
when I submitted the PR originally.
And for the repository implementation,
it seems also to be using the right interface.
So overall, I think it worked,
because it seems to be using everything
that was provided in the code samples
as a reference about how the code should look like.
So this is the proof
that when you're using Amazon Q Developer,
the customization feature is going to allow you
to create more specific and unique recommendations
for you to use and leverage in your code.
So how did you like the new, exciting
Amazon Q Developer customization feature?
It's pretty awesome, right?
It is almost as if it was magic,
because when you ask for code recommendations
or code generation
Amazon Q Developer is able
to provide exactly what you need.
But guess what? There's no magic.
All you gotta do is to provide a set of code samples
for training purposes,
and from that point on,
Amazon Q Developer is able
to not only learn what you need,
but also to put in a context.
Given your prompts, it's going to be able to provide you
I highly encourage you to start developing
with Amazon Q Developer customization feature.
There have been never a better time to be a builder.
(no audio)
You're still here?
It's over.
Go build something.
Go.
(door slams) (quirky noise imitation)
Voir Plus de Vidéos Connexes
Discover Amazon Q: AWS’s Innovative Generative AI Assistant | Amazon Web Services
6 Ways to Boost Your Coding Productivity with Amazon Q Developer
Generative AI Powered Assistant At Work | Amazon Q Service | AI | Generative AI | AWS
GitHub's Devin Competitor, Sam Altman Talks GPT-5 and AGI, Amazon Q, Rabbit R1 Hacked (AI News)
AWS Summit Sydney 2024: Build self-healing code with generative AI on AWS
Amazon Q Developer - Your generative AI-powered assistant for work | Amazon Web Services
5.0 / 5 (0 votes)