skip to Main Content

After I login into a SageMaker Studio with a specific user profile, how can I find out which user profile I am logged in with? I know I can easily figure out which execution role I am using, but I wan to know which User Profile I am using. Is it even possible?

3

Answers


  1. It is possibile using boto3 describe_user_profile().

    import boto3
    
    client = boto3.client('sagemaker')
    
    response = client.describe_user_profile(
        DomainId='string',  # The domain ID
        UserProfileName='string' # The user profile name. This value is not case sensitive
    )
    

    and this is the full response:

    {
        'DomainId': 'string',
        'UserProfileArn': 'string',
        'UserProfileName': 'string',
        'HomeEfsFileSystemUid': 'string',
        'Status': 'Deleting'|'Failed'|'InService'|'Pending'|'Updating'|'Update_Failed'|'Delete_Failed',
        'LastModifiedTime': datetime(2015, 1, 1),
        'CreationTime': datetime(2015, 1, 1),
        'FailureReason': 'string',
        'SingleSignOnUserIdentifier': 'string',
        'SingleSignOnUserValue': 'string',
        'UserSettings': {
            'ExecutionRole': 'string',
            'SecurityGroups': [
                'string',
            ],
            'SharingSettings': {
                'NotebookOutputOption': 'Allowed'|'Disabled',
                'S3OutputPath': 'string',
                'S3KmsKeyId': 'string'
            },
            'JupyterServerAppSettings': {
                'DefaultResourceSpec': {
                    'SageMakerImageArn': 'string',
                    'SageMakerImageVersionArn': 'string',
                    'InstanceType': 'system'|'ml.t3.micro'|'ml.t3.small'|'ml.t3.medium'|'ml.t3.large'|'ml.t3.xlarge'|'ml.t3.2xlarge'|'ml.m5.large'|'ml.m5.xlarge'|'ml.m5.2xlarge'|'ml.m5.4xlarge'|'ml.m5.8xlarge'|'ml.m5.12xlarge'|'ml.m5.16xlarge'|'ml.m5.24xlarge'|'ml.m5d.large'|'ml.m5d.xlarge'|'ml.m5d.2xlarge'|'ml.m5d.4xlarge'|'ml.m5d.8xlarge'|'ml.m5d.12xlarge'|'ml.m5d.16xlarge'|'ml.m5d.24xlarge'|'ml.c5.large'|'ml.c5.xlarge'|'ml.c5.2xlarge'|'ml.c5.4xlarge'|'ml.c5.9xlarge'|'ml.c5.12xlarge'|'ml.c5.18xlarge'|'ml.c5.24xlarge'|'ml.p3.2xlarge'|'ml.p3.8xlarge'|'ml.p3.16xlarge'|'ml.p3dn.24xlarge'|'ml.g4dn.xlarge'|'ml.g4dn.2xlarge'|'ml.g4dn.4xlarge'|'ml.g4dn.8xlarge'|'ml.g4dn.12xlarge'|'ml.g4dn.16xlarge'|'ml.r5.large'|'ml.r5.xlarge'|'ml.r5.2xlarge'|'ml.r5.4xlarge'|'ml.r5.8xlarge'|'ml.r5.12xlarge'|'ml.r5.16xlarge'|'ml.r5.24xlarge'|'ml.g5.xlarge'|'ml.g5.2xlarge'|'ml.g5.4xlarge'|'ml.g5.8xlarge'|'ml.g5.16xlarge'|'ml.g5.12xlarge'|'ml.g5.24xlarge'|'ml.g5.48xlarge',
                    'LifecycleConfigArn': 'string'
                },
                'LifecycleConfigArns': [
                    'string',
                ]
            },
            'KernelGatewayAppSettings': {
                'DefaultResourceSpec': {
                    'SageMakerImageArn': 'string',
                    'SageMakerImageVersionArn': 'string',
                    'InstanceType': 'system'|'ml.t3.micro'|'ml.t3.small'|'ml.t3.medium'|'ml.t3.large'|'ml.t3.xlarge'|'ml.t3.2xlarge'|'ml.m5.large'|'ml.m5.xlarge'|'ml.m5.2xlarge'|'ml.m5.4xlarge'|'ml.m5.8xlarge'|'ml.m5.12xlarge'|'ml.m5.16xlarge'|'ml.m5.24xlarge'|'ml.m5d.large'|'ml.m5d.xlarge'|'ml.m5d.2xlarge'|'ml.m5d.4xlarge'|'ml.m5d.8xlarge'|'ml.m5d.12xlarge'|'ml.m5d.16xlarge'|'ml.m5d.24xlarge'|'ml.c5.large'|'ml.c5.xlarge'|'ml.c5.2xlarge'|'ml.c5.4xlarge'|'ml.c5.9xlarge'|'ml.c5.12xlarge'|'ml.c5.18xlarge'|'ml.c5.24xlarge'|'ml.p3.2xlarge'|'ml.p3.8xlarge'|'ml.p3.16xlarge'|'ml.p3dn.24xlarge'|'ml.g4dn.xlarge'|'ml.g4dn.2xlarge'|'ml.g4dn.4xlarge'|'ml.g4dn.8xlarge'|'ml.g4dn.12xlarge'|'ml.g4dn.16xlarge'|'ml.r5.large'|'ml.r5.xlarge'|'ml.r5.2xlarge'|'ml.r5.4xlarge'|'ml.r5.8xlarge'|'ml.r5.12xlarge'|'ml.r5.16xlarge'|'ml.r5.24xlarge'|'ml.g5.xlarge'|'ml.g5.2xlarge'|'ml.g5.4xlarge'|'ml.g5.8xlarge'|'ml.g5.16xlarge'|'ml.g5.12xlarge'|'ml.g5.24xlarge'|'ml.g5.48xlarge',
                    'LifecycleConfigArn': 'string'
                },
                'CustomImages': [
                    {
                        'ImageName': 'string',
                        'ImageVersionNumber': 123,
                        'AppImageConfigName': 'string'
                    },
                ],
                'LifecycleConfigArns': [
                    'string',
                ]
            },
            'TensorBoardAppSettings': {
                'DefaultResourceSpec': {
                    'SageMakerImageArn': 'string',
                    'SageMakerImageVersionArn': 'string',
                    'InstanceType': 'system'|'ml.t3.micro'|'ml.t3.small'|'ml.t3.medium'|'ml.t3.large'|'ml.t3.xlarge'|'ml.t3.2xlarge'|'ml.m5.large'|'ml.m5.xlarge'|'ml.m5.2xlarge'|'ml.m5.4xlarge'|'ml.m5.8xlarge'|'ml.m5.12xlarge'|'ml.m5.16xlarge'|'ml.m5.24xlarge'|'ml.m5d.large'|'ml.m5d.xlarge'|'ml.m5d.2xlarge'|'ml.m5d.4xlarge'|'ml.m5d.8xlarge'|'ml.m5d.12xlarge'|'ml.m5d.16xlarge'|'ml.m5d.24xlarge'|'ml.c5.large'|'ml.c5.xlarge'|'ml.c5.2xlarge'|'ml.c5.4xlarge'|'ml.c5.9xlarge'|'ml.c5.12xlarge'|'ml.c5.18xlarge'|'ml.c5.24xlarge'|'ml.p3.2xlarge'|'ml.p3.8xlarge'|'ml.p3.16xlarge'|'ml.p3dn.24xlarge'|'ml.g4dn.xlarge'|'ml.g4dn.2xlarge'|'ml.g4dn.4xlarge'|'ml.g4dn.8xlarge'|'ml.g4dn.12xlarge'|'ml.g4dn.16xlarge'|'ml.r5.large'|'ml.r5.xlarge'|'ml.r5.2xlarge'|'ml.r5.4xlarge'|'ml.r5.8xlarge'|'ml.r5.12xlarge'|'ml.r5.16xlarge'|'ml.r5.24xlarge'|'ml.g5.xlarge'|'ml.g5.2xlarge'|'ml.g5.4xlarge'|'ml.g5.8xlarge'|'ml.g5.16xlarge'|'ml.g5.12xlarge'|'ml.g5.24xlarge'|'ml.g5.48xlarge',
                    'LifecycleConfigArn': 'string'
                }
            },
            'RStudioServerProAppSettings': {
                'AccessStatus': 'ENABLED'|'DISABLED',
                'UserGroup': 'R_STUDIO_ADMIN'|'R_STUDIO_USER'
            },
            'RSessionAppSettings': {
                'DefaultResourceSpec': {
                    'SageMakerImageArn': 'string',
                    'SageMakerImageVersionArn': 'string',
                    'InstanceType': 'system'|'ml.t3.micro'|'ml.t3.small'|'ml.t3.medium'|'ml.t3.large'|'ml.t3.xlarge'|'ml.t3.2xlarge'|'ml.m5.large'|'ml.m5.xlarge'|'ml.m5.2xlarge'|'ml.m5.4xlarge'|'ml.m5.8xlarge'|'ml.m5.12xlarge'|'ml.m5.16xlarge'|'ml.m5.24xlarge'|'ml.m5d.large'|'ml.m5d.xlarge'|'ml.m5d.2xlarge'|'ml.m5d.4xlarge'|'ml.m5d.8xlarge'|'ml.m5d.12xlarge'|'ml.m5d.16xlarge'|'ml.m5d.24xlarge'|'ml.c5.large'|'ml.c5.xlarge'|'ml.c5.2xlarge'|'ml.c5.4xlarge'|'ml.c5.9xlarge'|'ml.c5.12xlarge'|'ml.c5.18xlarge'|'ml.c5.24xlarge'|'ml.p3.2xlarge'|'ml.p3.8xlarge'|'ml.p3.16xlarge'|'ml.p3dn.24xlarge'|'ml.g4dn.xlarge'|'ml.g4dn.2xlarge'|'ml.g4dn.4xlarge'|'ml.g4dn.8xlarge'|'ml.g4dn.12xlarge'|'ml.g4dn.16xlarge'|'ml.r5.large'|'ml.r5.xlarge'|'ml.r5.2xlarge'|'ml.r5.4xlarge'|'ml.r5.8xlarge'|'ml.r5.12xlarge'|'ml.r5.16xlarge'|'ml.r5.24xlarge'|'ml.g5.xlarge'|'ml.g5.2xlarge'|'ml.g5.4xlarge'|'ml.g5.8xlarge'|'ml.g5.16xlarge'|'ml.g5.12xlarge'|'ml.g5.24xlarge'|'ml.g5.48xlarge',
                    'LifecycleConfigArn': 'string'
                },
                'CustomImages': [
                    {
                        'ImageName': 'string',
                        'ImageVersionNumber': 123,
                        'AppImageConfigName': 'string'
                    },
                ]
            },
            'CanvasAppSettings': {
                'TimeSeriesForecastingSettings': {
                    'Status': 'ENABLED'|'DISABLED',
                    'AmazonForecastRoleArn': 'string'
                }
            }
        }
    }
    
    Login or Signup to reply.
  2. Top right-hand corner, to the right of the notification and profile icons. Whatever is between the profile icon and the / will match up to the user profile you logged in with.
    enter image description here

    And if you want to get more information about that user profile, you can go to File > New > Terminal, and type aws sagemaker describe-user-profile --domain-id <domain-id> --user-profile-name <profile>. The domain id is in your URL, between https:// and .studio.<region>.sagemaker.aws.

    Login or Signup to reply.
  3. You can try to read /opt/ml/metadata/resource-metadata.json.
    {"AppType":"KernelGateway","DomainId":"d-...","UserProfileName":"...","ResourceArn":"...","ResourceName":"...","AppImageVersion":""}

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search