

# Generating inline suggestions in AWS coding environments
<a name="setting-up-AWS-coding-env"></a>

In addition to third-party IDEs, Amazon Q Developer can generate inline suggestions within AWS services that provide their own coding environments.

The following sections describe how to set up Amazon Q inline code suggestions within integrated AWS services.

**Note**  
If you are using Amazon Q as part of an enterprise, then you are using Amazon Q Developer Pro. In that case, administrators at your organization must complete additional steps before you can start coding. For more information, see [Getting started with Amazon Q Developer](getting-started-q-dev.md).

**Topics**
+ [Using Amazon Q Developer with Amazon SageMaker AI Studio](sagemaker-setup.md)
+ [Using Amazon Q Developer with JupyterLab](jupyterlab-setup.md)
+ [Using Amazon Q Developer with Amazon EMR Studio](emr-setup.md)
+ [Using Amazon Q Developer with AWS Glue Studio](glue-setup.md)
+ [Using Amazon Q Developer with AWS Lambda](lambda-setup.md)
+ [Using Amazon Q Developer with other services](other-setup.md)

# Using Amazon Q Developer with Amazon SageMaker AI Studio
<a name="sagemaker-setup"></a>

You can chat with Amazon Q inside Amazon SageMaker AI Studio. You can also make code recommendations automatically as you write your code.

To use Amazon Q Developer with Amazon SageMaker AI Studio, you must add Amazon Q permissions to your SageMaker AI execution role. The way you configure permissions depends on whether you are using the Amazon Q Developer Free tier or the Pro tier.

 To set up and activate Amazon Q for Amazon SageMaker AI Studio, see [Set up Amazon Q Developer for your users](https://docs.aws.amazon.com/sagemaker/latest/dg/studio-updated-jl-admin-guide-set-up.html) in the *Amazon SageMaker AI User Guide*.

# Using Amazon Q Developer with JupyterLab
<a name="jupyterlab-setup"></a>

This page describes how to set up and activate Amazon Q Developer for JupyterLab. Once activated, Amazon Q can make code recommendations automatically as you write your code.

**Note**  
Python is the only programming language that Amazon Q supports in JupyterLab.

## Installing JupyterLab
<a name="jupyterlab-setup-itself"></a>

Install [JupyterLab](https://pypi.org/project/jupyterlab) on your computer or if you already have JupyterLab installed, check its version by running the following command.

```
pip show jupyterlab
```

Note the version in the response, and follow the corresponding directions in one of the following sections.

## Installation using pip for Jupyter Lab version >= 4.0
<a name="jupyterlab-setup-pip-v4"></a>

You can install and enable the Amazon Q extension for JupyterLab 4 with the following commands.

```
# JupyterLab 4
pip install amazon-q-developer-jupyterlab-ext
```

## Installation using pip for Jupyter Lab version >= 3.6 and < 4.0
<a name="jupyterlab-setup-pip-v3"></a>

You can install and enable the Amazon Q extension for JupyterLab 3 with the following commands.

```
# JupyterLab 3
pip install amazon-q-developer-jupyterlab-ext~=3.0
jupyter server extension enable amazon-q-developer-jupyterlab-ext
```

## Authenticating with AWS Builder ID
<a name="jupyterlab-setup-bid"></a>

In the following procedure, you will set up Builder ID, which you will use to authenticate when you enable Amazon Q.

1. Refresh the browser tab on which you are using JupyterLab.

1. From the Amazon Q panel at the bottom of the window, choose **Get Started**.

1. From the pop-up window, choose **Copy Code and Proceed**.

1. On the **Get started** page, sign in or sign up for a Builder ID using your email address or Google account. For more information, see [Getting started with a personal account (Builder ID)](getting-started-builderid.md).

   If you already have a Builder ID, skip to the step about the **Authorize request** page.

1. After you receive your email verification code, enter it in the blank field and choose **Verify**.

1. On the next screen, choose and confirm a password, then choose **Create AWS Builder ID**

1. On the next page choose **Allow** to allow Amazon Q to access your data.

Now you should be logged into Amazon Q in JupyterLab with Builder ID.

To begin coding, see [Using shortcut keys](actions-and-shortcuts.md).

![\[An example of Amazon Q in use with JupyterLab.\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/qdev-demo-example.png)


# Using Amazon Q Developer with Amazon EMR Studio
<a name="emr-setup"></a>

This page describes how to set up and activate Amazon Q Developer for Amazon EMR Studio. Once activated, Amazon Q can make code recommendations automatically as you write your ETL code.

**Note**  
Amazon Q supports Python, which can be used to code ETL scripts for Spark jobs in Amazon EMR Studio.

Use the following procedure to set up Amazon EMR Studio to work with Amazon Q.

1. Set up [Amazon EMR Studio Notebook](https://docs.aws.amazon.com/emr/latest/ManagementGuide/emr-managed-notebooks-create.html).

1. Attach the following policy to the IAM user role for Amazon EMR Studio Notebook.
**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](service-rename.md). 

------
#### [ JSON ]

****  

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

------

1. Open the [Amazon EMR console](https://console.aws.amazon.com/emr).

1. Under Amazon EMR Studio, choose **Workspaces (Notebooks).**

1. Select your desired Workspace and choose **Quick launch**.

# Using Amazon Q Developer with AWS Glue Studio
<a name="glue-setup"></a>

This page describes how to set up and activate Amazon Q Developer for [AWS Glue Studio Notebook](https://docs.aws.amazon.com/glue/latest/ug/notebooks-chapter.html). Once activated, Amazon Q can make code recommendations automatically as you write your ETL code.

**Note**  
Amazon Q supports both Python and Scala, the two languages used for coding ETL scripts for Spark jobs in AWS Glue Studio.

In the following procedure, you will set up AWS Glue to work with Amazon Q.

1. [Set up AWS Glue Studio Notebook](https://docs.aws.amazon.com/glue/latest/ug/notebook-getting-started.html).

1. Attach the following policy to your IAM role for Glue Studio notebook
**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](service-rename.md). 

------
#### [ JSON ]

****  

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

------

1. Open the [Glue console](https://console.aws.amazon.com/glue)

1. Under **ETL jobs**, choose **Notebooks**.

1. Verify that **Jupyter Notebook** is selected. Choose **Create**.

1. Enter a **Job name**.

1. For IAM role, select the role that you configured to interact with Amazon Q

1. Choose **Start notebook**.

# Using Amazon Q Developer with AWS Lambda
<a name="lambda-setup"></a>

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
<a name="lambda-q-dev-IAM-policies"></a>

 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](service-rename.md). 

------
#### [ JSON ]

****  

```
{
  "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](https://docs.aws.amazon.com/lambda/latest/dg/security-iam.html) in the *AWS Lambda Developer Guide*.

## Activating Amazon Q Developer with Lambda
<a name="lambda-activation"></a>

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

1. Open the [Functions page](https://console.aws.amazon.com/lambda/home#/functions) of the Lambda console, and choose the function that you want to edit.

1. As you type in the code editor, automatic code suggestions from Amazon Q are enabled by default. To pause suggestions, choose **Amazon Q** in the bottom left corner of the **Code source** panel. The command palette opens at the top of the Code source panel. From there, choose **Pause auto-suggestions**.

For shortcut keys, see [Using shortcut keys](actions-and-shortcuts.md).

# Using Amazon Q Developer with other services
<a name="other-setup"></a>

## AWS Identity and Access Management permissions for other services
<a name="q-dev-IAM-policies-other"></a>

 For Amazon Q to provide recommendations in the context of another service, 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](service-rename.md). 

------
#### [ JSON ]

****  

```
{
  "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, see [Security best practices](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html) in the *IAM user guide*. 