

# Amazon Q Developer
<a name="studio-updated-amazon-q"></a>

Amazon Q Developer is a generative AI conversational assistant that helps you write better code. Amazon Q Developer is available in the following IDEs within Amazon SageMaker Studio:
+ JupyterLab
+ Code Editor, based on Code-OSS, Visual Studio Code - Open Source

Use the following sections to set up Amazon Q Developer and use it within your environment.

**Topics**
+ [Set up Amazon Q Developer for your users](studio-updated-amazon-q-admin-guide-set-up.md)
+ [Use Amazon Q to Expedite Your Machine Learning Workflows](studio-updated-user-guide-use-amazon-q.md)
+ [Customize Amazon Q Developer in Amazon SageMaker Studio applications](q-customizations.md)

# Set up Amazon Q Developer for your users
<a name="studio-updated-amazon-q-admin-guide-set-up"></a>

Amazon Q Developer is a generative AI conversational assistant. You can set up Amazon Q Developer within a new domain or an existing domain. Use the following information to set up Amazon Q Developer.

With Amazon Q Developer, your users can:
+ Receive step-by-step guidance on using SageMaker AI features independently or in combination with other AWS services.
+ Get sample code to get started on your ML tasks such as data preparation, training, inference, and MLOps.
+ Receive troubleshooting assistance to debug and resolve errors encountered while running code.

**Note**  
Amazon Q Developer in Studio doesn't use user content to improve the service, regardless of whether you use the Free-tier or Pro-tier subscription. For IDE-level telemetry sharing, Amazon Q might track your users' usage, such as the number of questions asked and whether recommendations were accepted or rejected. This telemetry data doesn't include personally identifiable information such as the users' IP address. For more information on data protection and instructions for opting out, see [Opt out of data sharing in the IDE](https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/opt-out-IDE.html).

You can set up Amazon Q Developer with either a Pro or Free tier subscription. The Pro tier is a paid subscription service with higher usage limits and other features. For more information about the differences between the tiers, see [Understanding tiers of service for Amazon Q Developer](https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/q-tiers.html).

For information about subscribing to Amazon Q Developer Pro, see [Subscribing to Amazon Q Developer Pro](https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/q-admin-setup-subscribe-general.html).

## Set up instructions for Amazon Q Developer Free Tier:
<a name="studio-updated-amazon-q-developer-free-tier-set-up"></a>

To set up Amazon Q Developer Free Tier, use the following procedure:

**To set up Amazon Q Developer Free Tier**

1. Add the following policy to the IAM role that you've used to create your JupyterLab or Code Editor space:

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

****  

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

------

1. Navigate to Amazon SageMaker Studio.

1. Open your JupyterLab or Code Editor space.

1. Navigate to the **Launcher** and choose **Terminal**.

1. In JupyterLab, do the following:

   1. Specify `restart-jupyter-server`.

   1. Restart your browser and navigate back to Amazon SageMaker Studio.

## Set up instructions for Amazon Q Developer Pro tier:
<a name="studio-updated-amazon-q-developer-pro-set-up"></a>

**Prerequisites**  
To set up Amazon Q Pro, you must have:  
An Amazon SageMaker AI domain set up for your organization with IAM Identity Center configured as the means of access.
An Amazon Q Developer Pro subscription.

If you're updating a domain that you've already set up for your organization, you need to update it to use Amazon Q Developer. You can use either the AWS Management Console or the AWS Command Line Interface to update a domain.

You must use the ARN of your Amazon Q Developer profile. You can find the Q Profile ARN on the [Q Developer Settings](https://console.aws.amazon.com/amazonq/developer/settings) page.

You can use the following AWS Command Line Interface command to update your domain:

```
aws --region AWS Region sagemaker update-domain --domain-id domain-id --domain-settings-for-update "AmazonQSettings={Status=ENABLED,QProfileArn=Q-Profile-ARN}"           
```

You can also use the following procedure to update the domain within the AWS Management Console.

1. Navigate to the [Amazon SageMaker AI](https://console.aws.amazon.com/sagemaker) console.

1. Choose domains.

1. Select **App Configurations**.

1. For **Amazon Q Developer for SageMaker AI Applications**, choose **Edit**.

1. Select **Enable Amazon Q Developer on this domain**.

1. Provide the Q Profile ARN.

1. Choose **Submit**.

You must use the ARN of your Amazon Q Developer profile. You can find the ARN of the Q Profile on the **Amazon Q account details** page of the [Amazon Q Developer](https://console.aws.amazon.com/amazonq/developer) console.

The **Set up for organizations** is an advanced setup for the Amazon SageMaker AI domain that lets you use IAM Identity Center. For information about how you can set up the domain and information about setting up IAM Identity Center, see [Use custom setup for Amazon SageMaker AI](onboard-custom.md).

When setting up Amazon Q Developer in a new domain, you can either use the AWS Management Console or the following AWS Command Line Interface command from your local machine:

```
                    
aws --region AWS Region sagemaker create-domain --domain-id domain-id --domain-name "example-domain-name" --vpc-id example-vpc-id --subnet-ids example-subnet-ids --auth-mode SSO --default-user-settings "ExecutionRole=arn:aws:iam::111122223333:role/IAM-role",--domain-settings "AmazonQSettings={status=ENABLED,qProfileArn=Q-profile-ARN" --query example-domain-ARN--output text
```

You can use the following AWS CLI command to disable Amazon Q Developer:

```
aws --region AWS Region sagemaker update-domain --domain-id domain-id --domain-settings-for-update "AmazonQSettings={Status=DISABLED,QProfileArn=Q-Profile-ARN}"           
```

We recommend using the latest version of the AWS Command Line Interface. For information about updating the AWS CLI, see [Install or update to the latest version of the AWS Command Line Interface](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html).

If you need to establish a connection between Amazon Q Developer and your VPC, see [Creating an interface VPC endpoint for Amazon Q ](https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/vpc-interface-endpoints.html#vpc-endpoint-create).

**Note**  
Amazon Q Developer has the following limitations:  
It doesn't support shared spaces.
Amazon Q Developer detects whether a code suggestion might be too similar to publicly available code. The reference tracker can flag suggestions with repository URLs and licenses, or filter them out. This allows you to review the referenced code and its usage before you adopt it. All references are logged for you to review later to ensure that your code flow is not disturbed and that you can keep coding without interruption.  
For more information about code references, see [Using code references - Amazon Q Developer](https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/code-reference.html) and [AI Coding Assistant - Amazon Q Developer FAQs](https://aws.amazon.com/q/developer/faqs/?refid=255ccf7b-4a76-4dcb-9b07-68709e2b636b#:~:text=Can%20I%20prevent%20Amazon%20Q%20Developer%20from%20recommending%20code%20with%20code%20references%3F).
Amazon Q processes all user interaction data within the US East (N. Virginia) AWS Region. For more information about how Amazon Q processes data and the AWS Regions it supports, see [Supported Regions for Amazon Q Developer](https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/regions.html).
Amazon Q only works within Amazon SageMaker Studio. It is not supported within Amazon SageMaker Studio Classic.
On JupyterLab, Amazon Q works within SageMaker AI Distribution Images version 2.0 and above. On Code Editor, Amazon Q works within SageMaker AI Distribution Images version 2.2.1 and above.
Amazon Q Developer in JupyterLab works within the Jupyter AI extension. You can't use other 3P models within the extension while you're using Amazon Q.

## Amazon Q customizations in Amazon SageMaker AI
<a name="q-customizations-in-sagemaker"></a>

If you use Amazon Q Developer Pro, you have the option to create *customizations*. With customizations, Amazon Q Developer provides suggestions based on your company's codebase. If you create customizations in Amazon Q Developer, they become available for you to use in JupyterLab and Code Editor in Amazon SageMaker Studio. For more information about setting up customizations, see [Customizing suggestions](https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/customizations.html) in the *Amazon Q Developer User Guide*.

# Use Amazon Q to Expedite Your Machine Learning Workflows
<a name="studio-updated-user-guide-use-amazon-q"></a>

Amazon Q Developer is your AI-powered companion for machine learning development. With Amazon Q Developer, you can:
+ Receive step-by-step guidance on using SageMaker AI features independently or in combination with other AWS services.
+ Get sample code to get started on your ML tasks such as data preparation, training, inference, and MLOps.

 To use Amazon Q Developer, choose the **Q** from the left-hand navigation of your JupyterLab or Code Editor environment.

If you don't see the **Q** icon, your administrator needs to set it up for you. For more information about setting up Amazon Q Developer, see [Set up Amazon Q Developer for your users](studio-updated-amazon-q-admin-guide-set-up.md).

Amazon Q automatically provides suggestions to help you write your code. You can also ask for suggestions through the chat interface.

# Customize Amazon Q Developer in Amazon SageMaker Studio applications
<a name="q-customizations"></a>

You can customize Amazon Q Developer in the JupyterLab and Code Editor applications in Amazon SageMaker Studio. When you customize Q Developer, it provides suggestions and answers based on examples from your codebase. If you use Amazon Q Developer Pro, you can load any customizations that you've created with that service. 

## Customize in JupyterLab
<a name="q-customizations-jupyterlab"></a>

In JupyterLab, you can load any customizations that you've created with Amazon Q Developer Pro. Or, in your JupyterLab space, you can customize Q Developer locally with files that you upload to the space.

### To use customizations that you've created in Amazon Q Developer Pro
<a name="use-q-customizations-jupyterlab"></a>

When you load a customization, Q Developer provides suggestions based on the codebase that you used to create the customization. Also, when you use the chat in the **Amazon Q** panel, you interact with your customization.

For more information about setting up customizations, see [Customizing suggestions](https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/customizations.html) in the *Amazon Q Developer User Guide*.

**To load your customization**

Open your JupyterLab space and complete the following steps.

1. In the status bar at the bottom of JupyterLab, choose **Amazon Q**. A menu opens.

1. In the menu, choose **Other Features**. The **Amazon Q Features** tab opens in the main work area.

1. In the **Amazon Q Features** tab, under **Select Customization**, choose your Q Developer customization.

1. Interact with your customization in either of the following ways:
   + Create a notebook, and write code in it. As you do, Q Developer automatically provides tailored inline suggestions based on your customization.
   + Chat with Q Developer in the **Amazon Q** panel by following these steps:

     1. In the left sidebar in JupyterLab, choose the **Jupyter AI Chat** icon. The **Amazon Q** panel opens.

     1. Use the **Ask Amazon Q** chat box to interact with your customization.

### To customize Amazon Q Developer with files in your JupyterLab space
<a name="customize-q-in-jupyterlab"></a>

In JupyterLab, you can customize Q Developer with files that you upload to your space. Then, in the chat in the **Amazon Q** panel, you can use a command to ask Q Developer about those files.

When you customize Q Developer with files in your space, the customization exists only in your space. You can't load the customization elsewhere, such as in other spaces or in the Amazon Q Developer console.

You can customize Q Developer with files in JupyterLab if you use either Amazon Q Developer Pro or Amazon Q Developer at the Free tier.

**To customize with your files**

Open your JupyterLab space and complete the following steps.

1. Check whether your space is configured with the required embedding model. You can customize Q Developer in JupyterLab only if you use the default embedding model, which is **CodeSage :: codesage-small**. To check, do the following:

   1. In the left sidebar in JupyterLab, choose the **Jupyter AI Chat** icon. The **Amazon Q** panel opens.

   1. Choose the settings icon in the upper-right corner of the panel.

   1. For **Embedding model**, if necessary, choose **CodeSage :: codesage-small**, and choose **Save Changes**.

   1. In the upper-right corner of the panel, choose the back icon. 

1. To upload files that you want to customize Q Developer with, in the **File Browser** panel, choose the **Upload Files** icon.

1. After you upload your files, in the **Ask Amazon Q** chat box, type `/learn file path/`. Replace *file path/* with the path to your files in your JupyterLab space. When Amazon Q finishes processing your files, it confirms with a chat message in the Amazon Q panel.

1. To ask Q Developer a question about your files, type `/ask` in the chat box, and follow the command with your question. Amazon Q generates an answer based on your files, and it responds in the chat.

For more information about the `/learn` and `/ask` commands, such as their options and supported arguments, see [Learning about local data](https://jupyter-ai.readthedocs.io/en/latest/users/index.html#learning-about-local-data) in the Jupyter AI user documentation. That page explains how to use the commands with the Jupyternaut AI chatbot. JupyterLab in Amazon SageMaker Studio supports the same command syntax.

## Customize in Code Editor
<a name="q-customizations-code-editor"></a>

If you've created a customization in Amazon Q Developer Pro, you can load it in Code Editor. Then, when Q Developer provides suggestions for your code, it bases them on the codebase that you used to create the customization. Also, when you use the chat in the **Amazon Q: Chat** panel, you interact with your customization.

**To use customizations that you've created in Amazon Q Developer Pro**

Open your Code Editor space and complete the following steps.

1. In the Code Editor menu, choose **View**, and choose **Command Pallette**.

1. In the command pallet, begin typing **>Amazon Q: Select Customization**, and choose that option in the filtered list of commands when it appears. The command pallet shows your Q Developer customizations.

1. Choose your customization.

1. Interact with your customization in either of the following ways:
   + Create a Python file or a Jupyter notebook, and write code in it. As you do, Q Developer automatically provides tailored inline suggestions based on your customization.
   + Chat with Q Developer in the **Amazon Q** panel by following these steps:

     1. In the left sidebar in Code Editor, choose the **Amazon Q** icon. The **Amazon Q: Chat** panel opens.

     1. Use the chat box to interact with your customization.

For more information about the capabilities of Q Developer, see [Using Amazon Q Developer in the IDE](https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/q-in-IDE.html) in the *Amazon Q Developer User Guide*.