In software development, it's not uncommon to encounter roadblocks while writing code, and often we turn to the internet for assistance. However, constantly switching between our IDE and a web browser can be cumbersome and time-consuming. To address this issue, AWS has recently introduced "AWS CodeWhisperer," a service that provides code suggestions within your IDE.
AWS CodeWhisperer is an AI-powered tool designed to help developers write code more efficiently. By leveraging machine learning algorithms, CodeWhisperer generates real-time code suggestions based on your existing code and comments, ranging from single-line comments to fully-formed functions. Additionally, the tool can scan your code for security vulnerabilities and provide remediations to mitigate them.
CodeWhisperer supports many programming languages, including Python, Java, JavaScript, TypeScript, C#, Go, Rust, PHP, Ruby, Kotlin, C, C++, Shell scripting, SQL, and Scala. It also seamlessly integrates with popular IDE platforms such as Visual Studio Code, IntelliJ IDEA, CLion, GoLand, WebStorm, Rider, PhpStorm, PyCharm, RubyMine, and DataGrip.
AWS has conducted extensive testing on CodeWhisperer, and the results have been impressive. The tool has demonstrated a 27% higher success rate in completing tasks and a 57% faster completion time than traditional coding methods. Additionally, CodeWhisperer can filter out biased or unfair code suggestions and identify potential security vulnerabilities that are difficult to detect through manual code reviews.
In this blog, we are going to look at how to connect CodeWhisperer with Visual Studio Code.
How do I integrate AWS CodeWhisperer with Visual Studio Code?
Launch Visual Studio Code and open the extension tab on the left-hand side of the window.
Search for and install the AWS Toolkit.
Once installed, you will see the AWS icon on the left panel. Click on the icon to expand the AWS options.
Look for the "CodeWhisperer" option under the Developer Tools section and click on it.
Click the "Start" button to begin using the CodeWhisperer tool.
You will be prompted to use a personal email to sign up and sign in with your AWS Builder ID. Click on this option.
When prompted, click "Open" to allow the CodeWhisperer tool to open the external website.
You will be directed to a browser window where you need to enter an authorization code, which will be prompted in Visual Studio Code.
Next, you will be directed to the Create AWS Builder ID page. Provide your email address in the appropriate field.
AWS will send a confirmation code to the email address you provided. Enter the code on the email verification screen and click "Verify".
Finally, you will be asked if you want to keep your AWS Builder ID in the background. Click "Yes" to confirm.
For getting better recommendations,
Give CodeWhisperer something to work with. The more code your file contains, the more context CodeWhisperer has for generating recommendations.
Write descriptive comments. “Function to upload a file to S3” will get better results than “Upload a file”.
Specify the libraries you prefer by using import statements.
Use descriptive names for variables and functions. A function called “upload_file_to_S3” will get better results than a function called “file_upload”.
Break down complex tasks into simpler tasks.
Billing of AWS CodeWhisperer
Pricing in AWS CodeWhisperer is very simple to understand. It will be done in two ways.
Individual Tier:
This service is available to all users at no cost upon sign-up. The free tier provides access to 50 security scans per month but does not offer any organizational features.
Professional Tier:
In addition to the individual tier, the professional tier of CodeWhisperer provides administrative capabilities for organizations. With these capabilities, organizations can establish organization-level policies and provide access to employees. Additionally, this tier offers support for up to 500 security scans per month for a particular user.