How to use EMR studio notebooks with EMR serverless

17 Views Asked by At

I am trying to use the EMR studio workspace (notebooks) with EMR serverless application but its giving me this error when I go to select the kernel (like python3). I have explored all the docs on the polices and trust polices but I don't understand why I am getting this error as a root user.

Error when selecting kernel

My trust policy for the role:

{
"Version": "2012-10-17",
"Statement": [
    {
        "Effect": "Allow",
        "Principal": {
            "Service": "elasticmapreduce.amazonaws.com"
        },
        "Action": "sts:AssumeRole",
        "Condition": {
            "StringEquals": {
                "aws:SourceAccount": "123"
            },
            "ArnLike": {
                "aws:SourceArn": "arn:aws:elasticmapreduce:us-east-2:123:*"
            }
        }
    },
    {
        "Effect": "Allow",
        "Principal": {
            "Service": "emr-serverless.amazonaws.com"
        },
        "Action": [
            "sts:AssumeRole",
            "sts:SetContext"
        ]
    }
]
}

My policies attached to the role:

{
"Version": "2012-10-17",
"Statement": [

    {
        "Sid": "EMRServerlessInteractiveAccess",
        "Effect": "Allow",
        "Action": "emr-serverless:AccessInteractiveEndpoints",
        "Resource": "arn:aws:emr-serverless:us-east-2:123:/applications/*"
    },
    {
        "Sid": "ReadAccessForEMRSamples",
        "Effect": "Allow",
        "Action": [
            "s3:GetObject",
            "s3:ListBucket"
        ],
        "Resource": [
            "arn:aws:s3:::*.elasticmapreduce",
            "arn:aws:s3:::*.elasticmapreduce/*"
        ]
    },
    {
        "Sid": "EMRServerlessRuntimeRoleAccess",
        "Effect": "Allow",
        "Action": "iam:PassRole",
        "Resource": "*"
    },
    {
        "Sid": "FullAccessToOutputBucket",
        "Effect": "Allow",
        "Action": [
            "s3:PutObject",
            "s3:GetObject",
            "s3:GetEncryptionConfiguration",
            "s3:ListBucket",
            "s3:DeleteObject"
        ],
        "Resource": [
            "arn:aws:s3:::s3bu",
            "arn:aws:s3:::s3bu/*"
        ]
    },
    {
        "Sid": "GlueCreateAndReadDataCatalog",
        "Effect": "Allow",
        "Action": [
            "glue:GetDatabase",
            "glue:CreateDatabase",
            "glue:GetDataBases",
            "glue:CreateTable",
            "glue:GetTable",
            "glue:UpdateTable",
            "glue:DeleteTable",
            "glue:GetTables",
            "glue:GetPartition",
            "glue:GetPartitions",
            "glue:CreatePartition",
            "glue:BatchCreatePartition",
            "glue:GetUserDefinedFunctions"
        ],
        "Resource": [
            "*"
        ]
    },
    {
        "Sid": "AllowEMRReadOnlyActions",
        "Effect": "Allow",
        "Action": [
            "elasticmapreduce:ListInstances",
            "elasticmapreduce:DescribeCluster",
            "elasticmapreduce:ListSteps"
        ],
        "Resource": "*"
    },
    {
        "Sid": "AllowEC2ENIActionsWithEMRTags",
        "Effect": "Allow",
        "Action": [
            "ec2:CreateNetworkInterfacePermission",
            "ec2:DeleteNetworkInterface"
        ],
        "Resource": [
            "arn:aws:ec2:*:*:network-interface/*"
        ],
        "Condition": {
            "StringEquals": {
                "aws:ResourceTag/for-use-with-amazon-emr-managed-policies": "true"
            }
        }
    },
    {
        "Sid": "AllowEC2ENIAttributeAction",
        "Effect": "Allow",
        "Action": [
            "ec2:ModifyNetworkInterfaceAttribute"
        ],
        "Resource": [
            "arn:aws:ec2:*:*:instance/*",
            "arn:aws:ec2:*:*:network-interface/*",
            "arn:aws:ec2:*:*:security-group/*"
        ]
    },
    {
        "Sid": "AllowEC2SecurityGroupActionsWithEMRTags",
        "Effect": "Allow",
        "Action": [
            "ec2:AuthorizeSecurityGroupEgress",
            "ec2:AuthorizeSecurityGroupIngress",
            "ec2:RevokeSecurityGroupEgress",
            "ec2:RevokeSecurityGroupIngress",
            "ec2:DeleteNetworkInterfacePermission"
        ],
        "Resource": "*",
        "Condition": {
            "StringEquals": {
                "aws:ResourceTag/for-use-with-amazon-emr-managed-policies": "true"
            }
        }
    },
    {
        "Sid": "AllowDefaultEC2SecurityGroupsCreationWithEMRTags",
        "Effect": "Allow",
        "Action": [
            "ec2:CreateSecurityGroup"
        ],
        "Resource": [
            "arn:aws:ec2:*:*:security-group/*"
        ],
        "Condition": {
            "StringEquals": {
                "aws:RequestTag/for-use-with-amazon-emr-managed-policies": "true"
            }
        }
    },
    {
        "Sid": "AllowDefaultEC2SecurityGroupsCreationInVPCWithEMRTags",
        "Effect": "Allow",
        "Action": [
            "ec2:CreateSecurityGroup"
        ],
        "Resource": [
            "arn:aws:ec2:*:*:vpc/*"
        ],
        "Condition": {
            "StringEquals": {
                "aws:ResourceTag/for-use-with-amazon-emr-managed-policies": "true"
            }
        }
    },
    {
        "Sid": "AllowAddingEMRTagsDuringDefaultSecurityGroupCreation",
        "Effect": "Allow",
        "Action": [
            "ec2:CreateTags"
        ],
        "Resource": "arn:aws:ec2:*:*:security-group/*",
        "Condition": {
            "StringEquals": {
                "aws:RequestTag/for-use-with-amazon-emr-managed-policies": "true",
                "ec2:CreateAction": "CreateSecurityGroup"
            }
        }
    },
    {
        "Sid": "AllowEC2ENICreationWithEMRTags",
        "Effect": "Allow",
        "Action": [
            "ec2:CreateNetworkInterface"
        ],
        "Resource": [
            "arn:aws:ec2:*:*:network-interface/*"
        ],
        "Condition": {
            "StringEquals": {
                "aws:RequestTag/for-use-with-amazon-emr-managed-policies": "true"
            }
        }
    },
    {
        "Sid": "AllowEC2ENICreationInSubnetAndSecurityGroupWithEMRTags",
        "Effect": "Allow",
        "Action": [
            "ec2:CreateNetworkInterface"
        ],
        "Resource": [
            "arn:aws:ec2:*:*:subnet/*",
            "arn:aws:ec2:*:*:security-group/*"
        ],
        "Condition": {
            "StringEquals": {
                "aws:ResourceTag/for-use-with-amazon-emr-managed-policies": "true"
            }
        }
    },
    {
        "Sid": "AllowAddingTagsDuringEC2ENICreation",
        "Effect": "Allow",
        "Action": [
            "ec2:CreateTags"
        ],
        "Resource": "arn:aws:ec2:*:*:network-interface/*",
        "Condition": {
            "StringEquals": {
                "ec2:CreateAction": "CreateNetworkInterface"
            }
        }
    },
    {
        "Sid": "AllowEC2ReadOnlyActions",
        "Effect": "Allow",
        "Action": [
            "ec2:DescribeSecurityGroups",
            "ec2:DescribeNetworkInterfaces",
            "ec2:DescribeTags",
            "ec2:DescribeInstances",
            "ec2:DescribeSubnets",
            "ec2:DescribeVpcs"
        ],
        "Resource": "*"
    },
    {
        "Sid": "AllowSecretsManagerReadOnlyActionsWithEMRTags",
        "Effect": "Allow",
        "Action": [
            "secretsmanager:GetSecretValue"
        ],
        "Resource": "arn:aws:secretsmanager:*:*:secret:*",
        "Condition": {
            "StringEquals": {
                "aws:ResourceTag/for-use-with-amazon-emr-managed-policies": "true"
            }
        }
    },
    {
        "Sid": "AllowWorkspaceCollaboration",
        "Effect": "Allow",
        "Action": [
            "iam:GetUser",
            "iam:GetRole",
            "iam:ListUsers",
            "iam:ListRoles",
            "sso:GetManagedApplicationInstance",
            "sso-directory:SearchUsers"
        ],
        "Resource": "*"
    }
]
}
0

There are 0 best solutions below