12 Weeks AWS Workshop Challenge

Week Eleven: AI Coding Companion

Ntombizakhona Mabaso
4 min readFeb 7, 2024
AWS CodeWhisperer icon

When you think of a ‘coding companion’ you probably assume you need to find a friend in real life, who also happens to be a human being, to code with you in case coding gets monotonous. Well, using that analogy, an AI coding companion in the cloud computing world is a ‘tech friend’ that will help you enhance your productivity and efficiency by either using simple prompts using comments, or it just analyzes your code, while you’re coding, to give you better code.

On AWS, you can leverage Amazon CodeWhisperer as your AI Coding Companion.

Introduction to Amazon CodeWhisperer

Amazon CodeWhispherer is an AI powered coding companion service, trained on billions of lines of code. It provides real time coding recommendations — while you code. These recommendations can be generated based on your comments that are written in Natural Language (English) or based on your existing code written in a Programming Language.

The generated code can come in functions and blocks, based on your programming style. You can accept the suggestion by CodeWhisperer or you can continue with your own code.

Therefore, instead of heading over to StackOverFlow, ChatGPT or your browser to look for sample coding solutions and suggestions to optimize your code, CodeWhisperer speedily provides it for you in your IDE. You don’t have to open multiple tabs, and switch back and forth from your IDE to your browser because CodeWhisperer abstracts and simplifies this timeous process for you.

You can use Amazon CodeWhisperer on your IDE (if its supported), AWS Lambda or AWS Cloud9.

Amazon CodeWhisperer Tiers

CodeWhisperer comes in two tiers:

Individual Developer Tier (free): The Individual Developer Tier is free if you have a SkillBuilder ID, and it’s a great option to get your started. It supports all the languages offered by CodeWhisperer and reference tracking, but you’re limited to 50 security scans per month.

Professional Tier (not free): The Professional Tier supports all the coding languages offered by CodeWhisperer, reference tracking, and 500 security scans. With this tier, you also get license management and policy management at the organizational level.

Integrated Development Environments (IDEs) Supported by Amazon CodeWhisperer

  1. VS Code
  2. IntelliJ IDEA
  3. PyCharm
  4. AWS Cloud9
  5. AWS Lambda Console

Languages Supported by AWS CodeWhisperer

  1. AWS CDK (JSON, YAML)
  2. C
  3. C#
  4. C++
  5. Go
  6. Java
  7. JavaScript
  8. Kotlin
  9. PHP
  10. Python
  11. Ruby
  12. Rust
  13. Scala
  14. Shell
  15. SQL
  16. TypeScript

Benefits of CodeWhisperer

Productivity: CodeWhisperer increases productivity and allows developers to focus on quickly launching a product to market, instead of focusing too much time on writing code and looking for code all over the internet.

Efficiency: CodeWhisperer will help you write more efficient code, especially if you’re not familiar with a particular language or API.

Security: CodeWhisperer scans your code for security vulnerabilities, thus enabling you to write or use more secure code.

Plagiarism: CodeWhisperer helps identify licensed code, which can help you avoid it, so that you can write more original code.

AWS Optimization: CodeWhisperer is optimized to work well with various AWS Services.

Getting Started with CodeWhisperer for Free

Have you configured Amazon CodeWhisperer on Visual Studio Code?

Yes? Well, that’s cool. See you in my next post then.

No? Ok, no big deal: Configure Amazon CodeWhisperer.

Prerequisites

To Configure Amazon CodeWhisperer you will need:

(1) an AWS BuilderID.

(2) Visual Studio Code

(3) a basic understanding of python3

Step by Step Guide

Configuring Amazon CodeWhisperer on Visual Studio Code

  1. Download or Update Visual Studio Code.
  2. Navigate to Extensions on Visual Studio Code.
  3. Install the AWS Toolkit Extension.
  4. Successfully installed. Click on the AWS Toolkit Extension on the left of your screen.
  5. Click on CodeWhisperer.
  6. Select Sign in to get started.
  7. Click Use for free with AWS Builder ID.
  8. Confirm Code for AWS Builder ID: Click Proceed To Browser.
  9. Do you want Code to open the external website? Click Open.
  10. Click Confirm and continue.
  11. Select the appropriate selection. Click Next if you haven’t created your AWS Builder ID. Alternatively, Click Already have AWS Builder ID? Sign in.
  12. Allow AWS Toolkit for VSCode to access your data? Click Allow.
  13. Success Message: AWS Toolkit for VSCode can now access your data. You can close this window and start using AWS Toolkit for VSCode.
  14. Close the window and navigate back to Visual Studio Code.
  15. On the Learn CodeWhisperer tab. Next to Generate code suggestions as you type: Click Try example.
  16. Follow the instructions on screen. TODO: press Enter to generate a suggestion and Tip: press tab to accept the suggestion.
  17. Congratulations! You have Configured Amazon CodeWhisperer on Visual Studio Code.

End of Step by Step Guide

Conclusion

Congratulations! In this Step by Step Guide, you Configured Amazon CodeWhisperer on Visual Studio Code.

…And theoretically, you understand the purpose and benefits of leveraging an AI Coding Companion, particularly Amazon CodeWhisperer. In no time at all you will take full advantage of Amazon CodeWhisperer and enhance your productivity so that you can focus on your creativity when it comes to coding.

Blog Post Summary

Theory

Introduction to AI Coding Companion and Amazon CodeWhisperer.

Practical

Configuring Amazon CodeWhisperer on Visual Studio Code.

--

--

Ntombizakhona Mabaso
Ntombizakhona Mabaso

No responses yet