create_datalab¶
- DatalabsApi.create_datalab(role_id, datalab_create_input, content_type=None, _request_timeout=None, _request_auth=None, _content_type=None, _headers=None, _host_index=0)¶
Create a datalab
Creates a notebook or studio datalab. Compute, resource access and additional settings are optional and fall back to defaults. Creation runs in the background - poll the get-by-id operation until the status becomes InService.
- Parameters:
role_id (str) – User role id (required)
datalab_create_input (DatalabCreateInput) – (required)
content_type (str) – Must be application/json.
_request_timeout (int, tuple(int, int), optional) – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
_request_auth (dict, optional) – set to override the auth_settings for an a single request; this effectively ignores the authentication in the spec for a single request.
_content_type (str, Optional) – force content-type for the request.
_headers (dict, optional) – set to override the headers for a single request; this effectively ignores the headers in the spec for a single request.
_host_index (int, optional) – set to override the host_index for a single request; this effectively ignores the host_index in the spec for a single request.
- Return type:
- Returns:
Returns the result object.
Request and Response Examples¶
HTTP: POST /datalabs
Request¶
Notebook datalab with a lifecycle configuration
{
"DatalabName": "ml-exploration",
"DatalabType": "sagemaker-notebook",
"Description": "Notebook workspace for the sales model",
"ComputeMetadata": {
"InstanceList": [
"ml.t3.medium"
],
"VolumeSizeInGB": 20,
"DirectInternetAccess": "Enabled",
"RootAccess": "Enabled"
},
"AdditionalMetadata": {
"Keywords": [
"ml",
"sales"
],
"IsSessionsEnabled": false,
"LifecycleConfiguration": "install-team-packages"
}
}
Studio datalab with RStudio enabled
{
"DatalabName": "studio-analytics",
"DatalabType": "sagemaker-studio",
"Description": "Shared studio domain",
"AdditionalMetadata": {
"Keywords": [
"analytics"
],
"RStudioAccessStatus": "Enabled"
}
}
Success (HTTP 200)¶
200 response
Request / response example
{
"Message": "Successfully created Data Lab.",
"DatalabId": "b1e6c2a0-9f4d-4c7a-8f2e-1a2b3c4d5e6f"
}
Errors¶
Documented error codes: IPV-1008, IPV-1016, AUTH-1012, GE-1020.
HTTP 400
Invalid input datalab body
Required fields omitted
{
"Message": "IPV-1008 - Invalid request body, missing key(s) - {'DatalabName', 'DatalabType'}"
}
DatalabType not recognised
{
"Message": "IPV-1016 - Unsupported Datalab type - sagemaker-lab."
}
Caller has no access to the lifecycle configuration
{
"Message": "AUTH-1012 - User - jdoe does not have access to the specified lifecycle configuration - install-team-packages"
}
HTTP 500
Something went wrong at backend
Request / response example
{
"Message": "GE-1020 - Unable to update DATALABS table, please retry or contact administrator"
}