Skip to content

CodeWhisperer/Amazon Q Not Enabled in AWS Glue Interactive Notebook Despite IAM Permissions

0

I'm encountering a CodeWhisperer: CodeWhisperer isn't enabled error in my AWS Glue interactive notebook, even after adding the necessary IAM permissions.

Environment:

  • AWS Glue version: 5.0
  • Region: us-west-2
  • Notebook type: Interactive session

What I've tried:

Added CodeWhisperer and Amazon Q permissions to my Glue notebook execution IAM role:

{
  "Effect": "Allow",
  "Action": [
    "codewhisperer:*",
    "q:*"
  ],
  "Resource": "*"
}
{
    "Effect": "Allow",
    "Action": [
        "glue:StartCompletion",
        "glue:GetCompletion"
    ],
    "Resource": [
        "arn:aws:glue:*:*:completion/*"
    ]
}
  • Verified the IAM role is properly attached to the Glue notebook
  • Restarted the Glue session

Questions:

  1. Are there additional steps needed to enable CodeWhisperer/Amazon Q in Glue interactive notebooks?
  2. Is there a specific service or feature that needs to be enabled at the account level?

asked 10 months ago108 views

2 Answers
0

To enable Amazon Q data integration in AWS Glue Studio notebooks, you need to ensure your IAM permissions are correctly configured. Based on your current setup, there are a few adjustments needed:

  1. Your IAM permissions should be more specific. Instead of using wildcard permissions like "codewhisperer:" and "q:", you should use the exact permissions required:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"glue:StartCompletion",
"glue:GetCompletion"
],
"Resource": [
"arn:aws:glue:*:*:completion/*"
]
},
{
"Sid": "AmazonQDeveloperPermissions",
"Effect": "Allow",
"Action": [
"codewhisperer:GenerateRecommendations"
],
"Resource": "*"
}
]
}
  1. Make sure this policy is attached to the notebook IAM role that you're using for your interactive session.

  2. For AWS Glue interactive sessions, you might need to use a specific role like AWSGlueSessionUserRestrictedNotebookServiceRole which provides sufficient access to interact with AWS Glue Studio notebook sessions.

  3. If you're using a custom role, ensure it has the necessary permissions for both the AWS Glue Studio notebook and the interactive session resources.

  4. Verify that your AWS region supports CodeWhisperer integration with AWS Glue Studio. According to the information available, CodeWhisperer support in AWS Glue Studio is available in all AWS regions where Glue is accessible.

After making these adjustments, restart your Glue session to apply the changes. There are no additional account-level features that need to be enabled specifically for CodeWhisperer in Glue notebooks, as this integration is available by default in supported regions.
Sources
Configuring IAM permissions - AWS Glue
Community | 2023 CodeWhisperer Year in Review
Interactive sessions with IAM - AWS Glue
Granting AWS managed policies for AWS Glue - AWS Glue

answered 10 months ago

0

Hello.

Have you attached an IAM policy with "iam:PassRole" set?
https://docs.aws.amazon.com/glue/latest/dg/glue-is-security.html

EXPERT

answered 10 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.