Working with Amazon CodeWhisperer by using AWS Cloud9

2023/10/02閱讀時間約 5 分鐘


What is CodeWhisperer?

Amazon CodeWhisperer is a machine learning service that improves developer productivity by generating code suggestions based on their natural language comments and code in their IDE.

CodeWhisperer supports programming languages such as Java, JavaScript, Python, C#, and TypeScript, and also supports code generation for Ruby, Go, PHP, C++, C, Shell, Scala, Rust, Kotlin, and SQL. The service integrates with several integrated development environments (IDEs), including JetBrains (IntelliJ, PyCharm, WebStorm, and Rider), Visual Studio Code, AWS Cloud9, and AWS Lambda Console.


Setting up


AWS IAM CodeWhisperer permissions for AWS Cloud9

{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "CodeWhispererPermissions",
"Effect": "Allow",
"Action": ["codewhisperer:GenerateRecommendations"],
"Resource": "*"
}
]
}


Activating Amazon CodeWhisperer with AWS Cloud9

From inside your existing AWS Cloud9 environment, choose the AWS logo on the left edge of the window. A panel will expand rightward.

raw-image

In the lower part of the panel, under Developer tools, open the CodeWhisperer dropdown.

raw-image

Choose Enable CodeWhisperer.


Enter your description :# add two numbers in the python

raw-image

It will give you tips on what to do.

raw-image
raw-image

Bubble Sort

raw-image


All in all, CodeWhisperer is a powerful AI coding companion that helps developers build applications faster and more securely.


Security scans

CodeWhisperer offers a valuable Security Scan feature for your project files. It enhances application resilience by identifying security concerns like cross-site scripting vulnerabilities, log injections, weak file permissions, and hardcoded credentials. This security scan seamlessly integrates with CodeGuru, which applies multiple layers of filtering to prioritize critical issues. CodeGuru filters unsupported languages and conducts preliminary code testing, even for open source code, before initiating security scans.

raw-image


Next article Using Amazon CodeGuru Security to find out if code is vulnerable


Reference

https://aws.amazon.com/tw/codewhisperer/

https://docs.aws.amazon.com/codewhisperer/latest/userguide/cloud9-setup.html

13會員
57內容數
留言0
查看全部
發表第一個留言支持創作者!