Using Amazon Q Developer with AWS Lambda - Amazon Q Developer

Using Amazon Q Developer with AWS Lambda

This document describes how to set up and activate Amazon Q Developer for the Lambda console. Once activated, Amazon Q can make code recommendations on demand in the Lambda code editor as you develop your function.

Note

In the Lambda console, Amazon Q only supports functions using the Python and Node.js runtimes.

AWS Identity and Access Management permissions for Lambda

For Amazon Q to provide recommendations in the Lambda console, you must enable the correct IAM permissions for either your IAM user or role. You must add the codewhisperer:GenerateRecommendations permission, as outlined in the sample IAM policy below:

Note

The codewhisperer prefix is a legacy name from a service that merged with Amazon Q Developer. For more information, see Amazon Q Developer rename - Summary of changes.

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

It is best practice to use IAM policies to grant restrictive permissions to IAM principals. For details about working with IAM for AWS Lambda, see Identity and access management in AWS Lambda in the AWS Lambda Developer Guide.

Activating Amazon Q Developer with Lambda

To activate Amazon Q in the Lambda console code editor, complete these steps.

Note

Amazon Q for Lambda is only supported in US East (N. Virginia).

  1. Open the Functions page of the Lambda console, and choose the function that you want to edit.

  2. In the code editor under Code source, choose Tools in the top menu bar.

  3. Choose Amazon Q code suggestions. This immediately activates the Amazon Q service, and a check mark appears next to this option. To deactivate, choose this option again.

For shortcut keys, see Using shortcut keys.