AWS Training and Certification Blog

Use Amazon CodeWhisperer to advance your cloud knowledge

April 30, 2024 update: Amazon CodeWhisperer is now Amazon Q Developer.

Amazon CodeWhisperer is a revolutionary artificial intelligence (AI)-powered productivity tool that improves developer productivity and can serve as an accelerated learning path for cloud computing. Amazon CodeWhisperer uses machine learning (ML) to provide intelligent code suggestions in an integrated development environment (IDE).

Amazon CodeWhisperer is trained on billions of lines of Amazon and publicly available code. It has built-in security scans, provides code suggestions to remediate any issues it identifies, and makes it easy for developers to deploy AWS services that meet AWS best practices. Whether you are a new cloud architect or an experienced developer, Amazon CodeWhisperer can increase your cloud fluency by generating code examples, API references, and infrastructure-as-code (IaC) templates.

In this blog, we’ll explore three practical ways developers and cloud architects can use Amazon CodeWhisperer as an educational catalyst in their cloud learning journey.

1. Generate templates for infrastructure-as-code

When starting out with AWS, many people will manually deploy resources using the AWS Management Console. However, as cloud proficiency grows, the best practice is to adopt IaC approaches using services like AWS CloudFormation or Terraform. IaC allows you to deploy your entire AWS infrastructure via declarative code template, enabling repeatability and scalability in a controlled manner with less room for error. These templates serve as blueprints and are a great way to learn how to deploy AWS resources.

Using Amazon CodeWhisperer

Amazon CodeWhisperer can help you overcome the IaC learning curve by synthesizing IaC templates based on your instructions and previous code context. In the example below, I provided a high-level comment instructing Amazon CodeWhisperer to create an AWS CloudFormation template. Amazon CodeWhisperer generated the AWSTemplateFormatVersion section, which is the first step in creating a CloudFormation template.

Next, I gave Amazon CodeWhisperer additional instructions to create a Virtual Private Cloud (VPC), Subnet, and Elastic Compute Cloud (EC2) instance. Amazon CodeWhisperer knows this is a CloudFormation template based on the AWSTemplateFormatVersion line and generates the code, in grey, needed to accomplish the instructions. To accept, simply hit tab and the code is placed into the IDE.

Amazon CodeWhisperer speeds up the development process by generating code for you so you don’t have to manually look up syntax, documentation, and resources specifications.

If you’re new to cloud, you can use Amazon CodeWhisperer to quickly understand the format of AWS CloudFormation templates and method to deploy AWS services programmatically. This synthesized starting point can be helpful when learning a new IaC language or when you need to quickly learn about cloud environments. Amazon CodeWhisperer gives you a head start based on the specifications and instructions you provide.

2. Learn about your organization’s code base

When you join a new team or start work on a new project, it can be challenging to learn the intricacies of the organization’s coding and cloud architecting best practices. Amazon CodeWhisperer can be customized to generate recommendations based on an organization’s internal libraries and architectural patterns. This enables Amazon CodeWhisperer to recommend more relevant code, onboard developers faster, and help you get up to speed on AWS cloud services.

→ Using Amazon CodeWhisperer

Amazon CodeWhisperer can be connected to your organization’s GitHub, AWS CodeCommit, or other Git repositories. Amazon CodeWhisperer will then generate code suggestions in the context of your organization, helping you quickly learn the organization’s coding style and architectural patterns without having to go through documentation and different development projects.

Further, Amazon CodeWhisperer can be a continuous learning tool for seasoned developers and architects. Organizations can add new standards, libraries, and frameworks to their codebase, and Amazon CodeWhisperer will incorporate it into recommendations. This provides an avenue for veteran developers to stay up-to-date on organizational changes and technologies without having to read announcements or change documentation.

3. Integrate Amazon CodeWhisperer with Amazon Q to further your learning

Sometimes, you need more in-depth explanations or guidance than the code suggested by Amazon CodeWhisperer. For this, Amazon CodeWhisperer can be integrated with Amazon Q, an interactive, generative AI-powered assistant available in the IDE. You can ask Amazon Q to explain, refactor, fix, or optimize code right in your IDE, giving you deeper insights so you learn more about the code being recommended.

Going back to our first example, we can highlight and right click on the code generated, requesting Amazon Q to explain the code (right side of image below). This opens the Amazon Q chatbot (left side of image), explaining the highlighted code.

The integration between Amazon CodeWhisperer and Amazon Q creates a loop of code generation and knowledge acquisition, allowing developers to continuously upskill on cloud while increasing their coding productivity.

Build your knowledge of Amazon CodeWhisperer

To learn more about Amazon CodeWhisperer, check out the free 30-minute Amazon CodeWhisperer – Getting Started course on AWS Skill Builder, our online learning center. In the course, you’ll learn the key features of Amazon CodeWhisperer and how to install, configure, and start using Amazon CodeWhisperer in your preferred IDE. Amazon CodeWhisperer is available in Visual Studio Code, JetBrains IDEs, AWS Cloud9, AWS Lambda, JupterLab, and more.

You can then get hands-on via the AWS Jam, Build using Amazon CodeWhisperer, where you’ll learn how to effectively tackle time-consuming coding tasks and maximize your productivity. This AWS Jam contains seven engaging challenges and can be completed at your own pace. Take advantage of the 7-day free trial of AWS Skill Builder subscription to access this Jam for free.

Conclusion

Amazon CodeWhisperer is a powerful AI tool that can enhance the way developers and cloud architects learn about AWS and their organization’s application development process. You can use Amazon CodeWhisperer’s code synthesis, knowledge of your organization’s code base, and integration with Amazon Q to learn about AWS, all while building build cloud-native applications. Dive in and let Amazon CodeWhisperer guide your cloud education!

Additional learning resources

This blog was written with minimal assistance from generative AI tools: Claude (2023). Used to augment and improve the syntax and content of this blog. Anthropic AI assistant. https://www.anthropic.com