Test driving the Amazon CodeWhisperer customization capability (Preview)

Mani
4 min readNov 30, 2023

Unless you have been living under a rock, you probably know that GenAI assisted coding assistants like Amazon CodeWhisperer are making an impact on developer productivity !! I have written a bunch of blogs in my personal blog on various facets of CodeWhisperer, and you can view them at https://cmani.medium.com/

While, the vast majority of the folks I work have been more than satisfied with the key features of CodeWhisperer — that its free for individual use (!!!), the in-built security scan feature, the flag or filter code suggestions from CodeWhisperer that resemble open-source training data and many other features. But a few customers/developers also have large existing code bases, frameworks/api’s that they would like to utilize, and also would like coding companions like CodeWhisperer to use these private codebases while generating the coding recommendations. To address this segment of customers, AWS has recently released a public preview of Amazon CodeWhisperer customization capability.

I wanted to try the customization feature of CodeWhisperer myself, which is explained in the launch blog. This short blog shows the steps to test the CodeWhisperer customization.

Masala Dosa — CTR, Bengaluru — https://www.zomato.com/bangalore/ctr-shri-sagar-since-1920-malleshwaram-bangalore — November 2023

Let us get started ..

There are a few pre-reqs before you can get started, from the documentation:

Currently, you can customize CodeWhisperer recommendations on codebases written in Java, JavaScript, TypeScript, and Python.

Your data source must contain at least 10 MB, and at most 7 GB, of source code files from supported languages. There is no limit on the number of files, but you must include at least 10 files for each language that you want your customization to support. In the Amazon S3 data source, ensure that all source code is placed within a directory and not at the root level. Any files at the root level will be ignored.

Please check the documentation for the latest updates.

Step 0: Getting the source code aligned

The first hurdle that I encountered (completely my own limitations), was that I did not have a code base which was at-least 10MB, and so I had to fork the popular Apache spark open source project to test this feature 😊 !!

fork of Apache Spark project — https://github.com/cmanikandan/spark

Step 1: Setting up the Customization

This is a very straightforward process, and can be completed from the CodeWhisperer console

CodeWhisperer customization

The proof in the pudding is to ensure that your codebase gets a rating of 4 and above, which indicates that your codebase is good enough for activation for use by CodeWhisperer.

from https://docs.aws.amazon.com/codewhisperer/latest/userguide/customizations-admin-activate.html

Fortunately, the fork of Apache Spark got a rating of 5, which was good enough.

effectiveness score of 5

Step 2: Using CodeWhisperer customizations

Once the customization is activated, we need to add the user who can access this customization.

users who can access customization, in this case its user mani

Step 3: Start using the code recommendations ..

I am using VS Code with the AWS toolkit installed to access the recommendations from CodeWhisperer. Since, we have deployed a customization, we need to select the customization which we created and activated in the AWS console.

VS code — CodeWhisperer customization

Cool, that’s all there is and now we can check if the code recommendations incorporate the APIs/libraries from the Apache Spark project.

code recommendations leveraging the CodeWhisperer customization !!

That’s it folks and this was pretty straightforward. I am sure this will be very useful for folks who have existing codebases, and who want to leverage them for generating the code recommendations.

Hope this blog was useful, and helps you to get started in your journey with Amazon CodeWhisperer !!

Namaskara, ping me on LinkedIn, if you need additional information 🙏

Resources:

  1. CodeWhisperer customization documentation — https://docs.aws.amazon.com/codewhisperer/latest/userguide/customizations-dev.html
  2. Blog on customization — https://aws.amazon.com/blogs/aws/new-customization-capability-in-amazon-codewhisperer-generates-even-better-suggestions-preview/

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Mani
Mani

Written by Mani

Principal Solutions Architect at AWS India, and I blog/post about interesting stuff that I am curious about and which is relevant to developers & customers.

No responses yet

Write a response