create_domain(
*,
config_overrides: Optional[AsyncSageMakerClientConfig] = None,
domain_name: Optional[DomainName] = None,
auth_mode: Optional[AuthMode] = None,
default_user_settings: Optional[UserSettings] = None,
domain_settings: Optional[DomainSettings] = None,
subnet_ids: Optional[Subnets] = None,
vpc_id: Optional[VpcId] = None,
tags: Optional[TagList] = None,
app_network_access_type: Optional[AppNetworkAccessType] = None,
home_efs_file_system_kms_key_id: Optional[KmsKeyId] = None,
kms_key_id: Optional[KmsKeyId] = None,
app_security_group_management: Optional[AppSecurityGroupManagement] = None,
home_efs_file_system_creation: Optional[HomeEfsFileSystemCreation] = None,
tag_propagation: Optional[TagPropagation] = None,
default_space_settings: Optional[DefaultSpaceSettings] = None,
) -> CreateDomainResponse
Creates a Domain. A domain consists of an associated Amazon Elastic File System volume, a list of authorized users, and a variety of security, application, policy, and Amazon Virtual Private Cloud (VPC) configurations. Users within a domain can share notebook files and other artifacts with each other.
EFS storage
When a domain is created, an EFS volume is created for use by all of the users within the domain. Each user receives a private home directory within the EFS volume for notebooks, Git repositories, and data files.
SageMaker AI uses the Amazon Web Services Key Management Service (Amazon Web Services KMS) to encrypt the EFS volume attached to the domain with an Amazon Web Services managed key by default. For more control, you can specify a customer managed key. For more information, see Protect Data at Rest Using Encryption.
VPC configuration
All traffic between the domain and the Amazon EFS volume is through the specified VPC and subnets. For other traffic, you can specify the AppNetworkAccessType parameter. AppNetworkAccessType corresponds to the network access type that you choose when you onboard to the domain. The following options are available:
-
PublicInternetOnly - Non-EFS traffic goes through a VPC managed by Amazon SageMaker AI, which allows internet access. This is the default value.
-
VpcOnly - All traffic is through the specified VPC and subnets. Internet access is disabled by default. To allow internet access, you must specify a NAT gateway.
When internet access is disabled, you won't be able to run a Amazon SageMaker AI Studio notebook or to train or host models unless your VPC has an interface endpoint to the SageMaker AI API and runtime or a NAT gateway and your security groups allow outbound connections.
NFS traffic over TCP on port 2049 needs to be allowed in both inbound and outbound rules in order to launch a Amazon SageMaker AI Studio app successfully.
For more information, see Connect Amazon SageMaker AI Studio Notebooks to Resources in a VPC.
Parameters:
-
domain_name
(Optional[DomainName], default:
None
)
–
-
auth_mode
(Optional[AuthMode], default:
None
)
–
The mode of authentication that members use to access the domain.
-
default_user_settings
(Optional[UserSettings], default:
None
)
–
The default settings to use to create a user profile when UserSettings isn't specified in the call to the CreateUserProfile API.
SecurityGroups is aggregated when specified in both calls. For all other settings in UserSettings, the values specified in CreateUserProfile take precedence over those specified in CreateDomain.
-
domain_settings
(Optional[DomainSettings], default:
None
)
–
A collection of Domain settings.
-
subnet_ids
(Optional[Subnets], default:
None
)
–
The VPC subnets that the domain uses for communication.
The field is optional when the AppNetworkAccessType parameter is set to PublicInternetOnly for domains created from Amazon SageMaker Unified Studio.
-
vpc_id
(Optional[VpcId], default:
None
)
–
The ID of the Amazon Virtual Private Cloud (VPC) that the domain uses for communication.
The field is optional when the AppNetworkAccessType parameter is set to PublicInternetOnly for domains created from Amazon SageMaker Unified Studio.
-
tags
(Optional[TagList], default:
None
)
–
Tags to associated with the Domain. Each tag consists of a key and an optional value. Tag keys must be unique per resource. Tags are searchable using the Search API.
Tags that you specify for the Domain are also added to all Apps that the Domain launches.
-
app_network_access_type
(Optional[AppNetworkAccessType], default:
None
)
–
Specifies the VPC used for non-EFS traffic. The default value is PublicInternetOnly.
-
PublicInternetOnly - Non-EFS traffic is through a VPC managed by Amazon SageMaker AI, which allows direct internet access
-
VpcOnly - All traffic is through the specified VPC and subnets
-
home_efs_file_system_kms_key_id
(Optional[KmsKeyId], default:
None
)
–
-
kms_key_id
(Optional[KmsKeyId], default:
None
)
–
SageMaker AI uses Amazon Web Services KMS to encrypt EFS and EBS volumes attached to the domain with an Amazon Web Services managed key by default. For more control, specify a customer managed key.
-
app_security_group_management
(Optional[AppSecurityGroupManagement], default:
None
)
–
The entity that creates and manages the required security groups for inter-app communication in VPCOnly mode. Required when CreateDomain.AppNetworkAccessType is VPCOnly and DomainSettings.RStudioServerProDomainSettings.DomainExecutionRoleArn is provided. If setting up the domain for use with RStudio, this value must be set to Service.
-
home_efs_file_system_creation
(Optional[HomeEfsFileSystemCreation], default:
None
)
–
Indicates whether to create a home EFS file system for the domain. Defaults to Enabled. Set to Disabled to skip EFS creation and reduce domain creation time. You can enable EFS later by calling UpdateDomain.
-
tag_propagation
(Optional[TagPropagation], default:
None
)
–
Indicates whether custom tag propagation is supported for the domain. Defaults to DISABLED.
-
default_space_settings
(Optional[DefaultSpaceSettings], default:
None
)
–
The default settings for shared spaces that users create in the domain.
Raises:
-
ResourceInUse
–
Resource being accessed is in use.
-
ResourceLimitExceeded
–
You have exceeded an SageMaker resource limit. For example, you might have too many training jobs created.
-
UnknownServiceError
–
The service returned an error code this client does not model.
Source code in docs_src/capo_sagemaker/_services/async_sage_maker.py
| async def create_domain(
self,
*,
config_overrides: Optional[AsyncSageMakerClientConfig] = None,
domain_name: Optional["capo_sagemaker.types.domain_name.DomainName"] = None,
auth_mode: Optional["capo_sagemaker.types.auth_mode.AuthMode"] = None,
default_user_settings: Optional[
"capo_sagemaker.types.user_settings.UserSettings"
] = None,
domain_settings: Optional[
"capo_sagemaker.types.domain_settings.DomainSettings"
] = None,
subnet_ids: Optional["capo_sagemaker.types.subnets.Subnets"] = None,
vpc_id: Optional["capo_sagemaker.types.vpc_id.VpcId"] = None,
tags: Optional["capo_sagemaker.types.tag_list.TagList"] = None,
app_network_access_type: Optional[
"capo_sagemaker.types.app_network_access_type.AppNetworkAccessType"
] = None,
home_efs_file_system_kms_key_id: Optional[
"capo_sagemaker.types.kms_key_id.KmsKeyId"
] = None,
kms_key_id: Optional["capo_sagemaker.types.kms_key_id.KmsKeyId"] = None,
app_security_group_management: Optional[
"capo_sagemaker.types.app_security_group_management.AppSecurityGroupManagement"
] = None,
home_efs_file_system_creation: Optional[
"capo_sagemaker.types.home_efs_file_system_creation.HomeEfsFileSystemCreation"
] = None,
tag_propagation: Optional[
"capo_sagemaker.types.tag_propagation.TagPropagation"
] = None,
default_space_settings: Optional[
"capo_sagemaker.types.default_space_settings.DefaultSpaceSettings"
] = None,
) -> "capo_sagemaker.types.create_domain_response.CreateDomainResponse":
"""<p>Creates a <code>Domain</code>. A domain consists of an associated Amazon Elastic File System volume, a list of authorized users, and a variety of security, application, policy, and Amazon Virtual Private Cloud (VPC) configurations. Users within a domain can share notebook files and other artifacts with each other.</p> <p> <b>EFS storage</b> </p> <p>When a domain is created, an EFS volume is created for use by all of the users within the domain. Each user receives a private home directory within the EFS volume for notebooks, Git repositories, and data files.</p> <p>SageMaker AI uses the Amazon Web Services Key Management Service (Amazon Web Services KMS) to encrypt the EFS volume attached to the domain with an Amazon Web Services managed key by default. For more control, you can specify a customer managed key. For more information, see <a href="https://docs.aws.amazon.com/sagemaker/latest/dg/encryption-at-rest.html">Protect Data at Rest Using Encryption</a>.</p> <p> <b>VPC configuration</b> </p> <p>All traffic between the domain and the Amazon EFS volume is through the specified VPC and subnets. For other traffic, you can specify the <code>AppNetworkAccessType</code> parameter. <code>AppNetworkAccessType</code> corresponds to the network access type that you choose when you onboard to the domain. The following options are available:</p> <ul> <li> <p> <code>PublicInternetOnly</code> - Non-EFS traffic goes through a VPC managed by Amazon SageMaker AI, which allows internet access. This is the default value.</p> </li> <li> <p> <code>VpcOnly</code> - All traffic is through the specified VPC and subnets. Internet access is disabled by default. To allow internet access, you must specify a NAT gateway.</p> <p>When internet access is disabled, you won't be able to run a Amazon SageMaker AI Studio notebook or to train or host models unless your VPC has an interface endpoint to the SageMaker AI API and runtime or a NAT gateway and your security groups allow outbound connections.</p> </li> </ul> <important> <p>NFS traffic over TCP on port 2049 needs to be allowed in both inbound and outbound rules in order to launch a Amazon SageMaker AI Studio app successfully.</p> </important> <p>For more information, see <a href="https://docs.aws.amazon.com/sagemaker/latest/dg/studio-notebooks-and-internet-access.html">Connect Amazon SageMaker AI Studio Notebooks to Resources in a VPC</a>.</p>
Args:
domain_name: <p>A name for the domain.</p>
auth_mode: <p>The mode of authentication that members use to access the domain.</p>
default_user_settings: <p>The default settings to use to create a user profile when <code>UserSettings</code> isn't specified in the call to the <code>CreateUserProfile</code> API.</p> <p> <code>SecurityGroups</code> is aggregated when specified in both calls. For all other settings in <code>UserSettings</code>, the values specified in <code>CreateUserProfile</code> take precedence over those specified in <code>CreateDomain</code>.</p>
domain_settings: <p>A collection of <code>Domain</code> settings.</p>
subnet_ids: <p>The VPC subnets that the domain uses for communication.</p> <p>The field is optional when the <code>AppNetworkAccessType</code> parameter is set to <code>PublicInternetOnly</code> for domains created from Amazon SageMaker Unified Studio.</p>
vpc_id: <p>The ID of the Amazon Virtual Private Cloud (VPC) that the domain uses for communication.</p> <p>The field is optional when the <code>AppNetworkAccessType</code> parameter is set to <code>PublicInternetOnly</code> for domains created from Amazon SageMaker Unified Studio.</p>
tags: <p>Tags to associated with the Domain. Each tag consists of a key and an optional value. Tag keys must be unique per resource. Tags are searchable using the <code>Search</code> API.</p> <p>Tags that you specify for the Domain are also added to all Apps that the Domain launches.</p>
app_network_access_type: <p>Specifies the VPC used for non-EFS traffic. The default value is <code>PublicInternetOnly</code>.</p> <ul> <li> <p> <code>PublicInternetOnly</code> - Non-EFS traffic is through a VPC managed by Amazon SageMaker AI, which allows direct internet access</p> </li> <li> <p> <code>VpcOnly</code> - All traffic is through the specified VPC and subnets</p> </li> </ul>
home_efs_file_system_kms_key_id: <p>Use <code>KmsKeyId</code>.</p>
kms_key_id: <p>SageMaker AI uses Amazon Web Services KMS to encrypt EFS and EBS volumes attached to the domain with an Amazon Web Services managed key by default. For more control, specify a customer managed key.</p>
app_security_group_management: <p>The entity that creates and manages the required security groups for inter-app communication in <code>VPCOnly</code> mode. Required when <code>CreateDomain.AppNetworkAccessType</code> is <code>VPCOnly</code> and <code>DomainSettings.RStudioServerProDomainSettings.DomainExecutionRoleArn</code> is provided. If setting up the domain for use with RStudio, this value must be set to <code>Service</code>.</p>
home_efs_file_system_creation: <p>Indicates whether to create a home EFS file system for the domain. Defaults to <code>Enabled</code>. Set to <code>Disabled</code> to skip EFS creation and reduce domain creation time. You can enable EFS later by calling <code>UpdateDomain</code>.</p>
tag_propagation: <p>Indicates whether custom tag propagation is supported for the domain. Defaults to <code>DISABLED</code>.</p>
default_space_settings: <p>The default settings for shared spaces that users create in the domain.</p>
Raises:
capo_sagemaker.errors.resource_in_use.ResourceInUse: <p>Resource being accessed is in use.</p>
capo_sagemaker.errors.resource_limit_exceeded.ResourceLimitExceeded: <p> You have exceeded an SageMaker resource limit. For example, you might have too many training jobs created. </p>
capo_sagemaker.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
async def _handler(
req: "AsyncOperationRequest[capo_sagemaker.types.create_domain_request.CreateDomainRequest]",
) -> AsyncOperationResponse[
"capo_sagemaker.types.create_domain_response.CreateDomainResponse"
]:
import capo_sagemaker._operations.sage_maker.create_domain
(
output,
http_response,
) = await capo_sagemaker._operations.sage_maker.create_domain.async_create_domain(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("CreateDomain")
)
input_: capo_sagemaker.types.create_domain_request.CreateDomainRequest = {}
if domain_name is not None:
input_["domain_name"] = domain_name
if auth_mode is not None:
input_["auth_mode"] = auth_mode
if default_user_settings is not None:
input_["default_user_settings"] = default_user_settings
if domain_settings is not None:
input_["domain_settings"] = domain_settings
if subnet_ids is not None:
input_["subnet_ids"] = subnet_ids
if vpc_id is not None:
input_["vpc_id"] = vpc_id
if tags is not None:
input_["tags"] = tags
if app_network_access_type is not None:
input_["app_network_access_type"] = app_network_access_type
if home_efs_file_system_kms_key_id is not None:
input_["home_efs_file_system_kms_key_id"] = home_efs_file_system_kms_key_id
if kms_key_id is not None:
input_["kms_key_id"] = kms_key_id
if app_security_group_management is not None:
input_["app_security_group_management"] = app_security_group_management
if home_efs_file_system_creation is not None:
input_["home_efs_file_system_creation"] = home_efs_file_system_creation
if tag_propagation is not None:
input_["tag_propagation"] = tag_propagation
if default_space_settings is not None:
input_["default_space_settings"] = default_space_settings
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|