class CfnDomain (construct)
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.Sagemaker.CfnDomain |
Java | software.amazon.awscdk.services.sagemaker.CfnDomain |
Python | aws_cdk.aws_sagemaker.CfnDomain |
TypeScript | @aws-cdk/aws-sagemaker » CfnDomain |
Implements
IConstruct
, IConstruct
, IDependable
, IInspectable
A CloudFormation AWS::SageMaker::Domain
.
Creates a Domain
used by Amazon SageMaker Studio. A domain consists of an associated Amazon Elastic File System (EFS) 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 uses the AWS Key Management Service ( AWS KMS) to encrypt the EFS volume attached to the domain with an AWS 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 SageMaker Studio traffic between the domain and the EFS volume is through the specified VPC and subnets. For other Studio traffic, you can specify the AppNetworkAccessType
parameter. AppNetworkAccessType
corresponds to the network access type that you choose when you onboard to Studio. The following options are available:
PublicInternetOnly
- Non-EFS traffic goes through a VPC managed by Amazon SageMaker, which allows internet access. This is the default value.VpcOnly
- All Studio 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 Studio notebook or to train or host models unless your VPC has an interface endpoint to the SageMaker 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 SageMaker Studio app successfully.
For more information, see Connect SageMaker Studio Notebooks to Resources in a VPC .
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as sagemaker from '@aws-cdk/aws-sagemaker';
const cfnDomain = new sagemaker.CfnDomain(this, 'MyCfnDomain', {
authMode: 'authMode',
defaultUserSettings: {
executionRole: 'executionRole',
// the properties below are optional
jupyterServerAppSettings: {
defaultResourceSpec: {
instanceType: 'instanceType',
lifecycleConfigArn: 'lifecycleConfigArn',
sageMakerImageArn: 'sageMakerImageArn',
sageMakerImageVersionArn: 'sageMakerImageVersionArn',
},
},
kernelGatewayAppSettings: {
customImages: [{
appImageConfigName: 'appImageConfigName',
imageName: 'imageName',
// the properties below are optional
imageVersionNumber: 123,
}],
defaultResourceSpec: {
instanceType: 'instanceType',
lifecycleConfigArn: 'lifecycleConfigArn',
sageMakerImageArn: 'sageMakerImageArn',
sageMakerImageVersionArn: 'sageMakerImageVersionArn',
},
},
rSessionAppSettings: {
customImages: [{
appImageConfigName: 'appImageConfigName',
imageName: 'imageName',
// the properties below are optional
imageVersionNumber: 123,
}],
defaultResourceSpec: {
instanceType: 'instanceType',
lifecycleConfigArn: 'lifecycleConfigArn',
sageMakerImageArn: 'sageMakerImageArn',
sageMakerImageVersionArn: 'sageMakerImageVersionArn',
},
},
rStudioServerProAppSettings: {
accessStatus: 'accessStatus',
userGroup: 'userGroup',
},
securityGroups: ['securityGroups'],
sharingSettings: {
notebookOutputOption: 'notebookOutputOption',
s3KmsKeyId: 's3KmsKeyId',
s3OutputPath: 's3OutputPath',
},
},
domainName: 'domainName',
subnetIds: ['subnetIds'],
vpcId: 'vpcId',
// the properties below are optional
appNetworkAccessType: 'appNetworkAccessType',
appSecurityGroupManagement: 'appSecurityGroupManagement',
defaultSpaceSettings: {
executionRole: 'executionRole',
// the properties below are optional
jupyterServerAppSettings: {
defaultResourceSpec: {
instanceType: 'instanceType',
lifecycleConfigArn: 'lifecycleConfigArn',
sageMakerImageArn: 'sageMakerImageArn',
sageMakerImageVersionArn: 'sageMakerImageVersionArn',
},
},
kernelGatewayAppSettings: {
customImages: [{
appImageConfigName: 'appImageConfigName',
imageName: 'imageName',
// the properties below are optional
imageVersionNumber: 123,
}],
defaultResourceSpec: {
instanceType: 'instanceType',
lifecycleConfigArn: 'lifecycleConfigArn',
sageMakerImageArn: 'sageMakerImageArn',
sageMakerImageVersionArn: 'sageMakerImageVersionArn',
},
},
securityGroups: ['securityGroups'],
},
domainSettings: {
rStudioServerProDomainSettings: {
domainExecutionRoleArn: 'domainExecutionRoleArn',
// the properties below are optional
defaultResourceSpec: {
instanceType: 'instanceType',
lifecycleConfigArn: 'lifecycleConfigArn',
sageMakerImageArn: 'sageMakerImageArn',
sageMakerImageVersionArn: 'sageMakerImageVersionArn',
},
rStudioConnectUrl: 'rStudioConnectUrl',
rStudioPackageManagerUrl: 'rStudioPackageManagerUrl',
},
securityGroupIds: ['securityGroupIds'],
},
kmsKeyId: 'kmsKeyId',
tags: [{
key: 'key',
value: 'value',
}],
});
Initializer
new CfnDomain(scope: Construct, id: string, props: CfnDomainProps)
Parameters
- scope
Construct
— - scope in which this resource is defined. - id
string
— - scoped id of the resource. - props
Cfn
— - resource properties.Domain Props
Create a new AWS::SageMaker::Domain
.
Construct Props
Name | Type | Description |
---|---|---|
auth | string | The mode of authentication that members use to access the Domain. |
default | IResolvable | User | The default user settings. |
domain | string | The domain name. |
subnet | string[] | The VPC subnets that Studio uses for communication. |
vpc | string | The ID of the Amazon Virtual Private Cloud (Amazon VPC) that Studio uses for communication. |
app | string | Specifies the VPC used for non-EFS traffic. The default value is PublicInternetOnly . |
app | string | The entity that creates and manages the required security groups for inter-app communication in VpcOnly mode. |
default | IResolvable | Default | AWS::SageMaker::Domain.DefaultSpaceSettings . |
domain | IResolvable | Domain | A collection of settings that apply to the SageMaker Domain . |
kms | string | SageMaker uses AWS KMS to encrypt the EFS volume attached to the Domain with an AWS managed customer master key (CMK) by default. |
tags? | Cfn [] | Tags to associated with the Domain. |
authMode
Type:
string
The mode of authentication that members use to access the Domain.
Valid Values : SSO | IAM
defaultUserSettings
Type:
IResolvable
|
User
The default user settings.
domainName
Type:
string
The domain name.
subnetIds
Type:
string[]
The VPC subnets that Studio uses for communication.
Length Constraints : Maximum length of 32.
Array members : Minimum number of 1 item. Maximum number of 16 items.
Pattern : [-0-9a-zA-Z]+
vpcId
Type:
string
The ID of the Amazon Virtual Private Cloud (Amazon VPC) that Studio uses for communication.
Length Constraints : Maximum length of 32.
Pattern : [-0-9a-zA-Z]+
appNetworkAccessType?
Type:
string
(optional)
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 , which allows direct internet accessVpcOnly
- All Studio traffic is through the specified VPC and subnets
Valid Values : PublicInternetOnly | VpcOnly
appSecurityGroupManagement?
Type:
string
(optional)
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
.
Allowed Values : Service
| Customer
defaultSpaceSettings?
Type:
IResolvable
|
Default
(optional)
AWS::SageMaker::Domain.DefaultSpaceSettings
.
domainSettings?
Type:
IResolvable
|
Domain
(optional)
A collection of settings that apply to the SageMaker Domain
.
These settings are specified through the CreateDomain
API call.
kmsKeyId?
Type:
string
(optional)
SageMaker uses AWS KMS to encrypt the EFS volume attached to the Domain with an AWS managed customer master key (CMK) by default.
For more control, specify a customer managed CMK.
Length Constraints : Maximum length of 2048.
Pattern : .*
tags?
Type:
Cfn
[]
(optional)
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 are launched in the Domain.
Array members : Minimum number of 0 items. Maximum number of 50 items.
Properties
Name | Type | Description |
---|---|---|
attr | string | The Amazon Resource Name (ARN) of the Domain, such as arn:aws:sagemaker:us-west-2:account-id:domain/my-domain-name . |
attr | string | The Domain ID. |
attr | string | The ID of the Amazon Elastic File System (EFS) managed by this Domain. |
attr | string | The ID of the security group that authorizes traffic between the RSessionGateway apps and the RStudioServerPro app. |
attr | string | The IAM Identity Center managed application instance ID. |
attr | string | The URL for the Domain. |
auth | string | The mode of authentication that members use to access the Domain. |
cfn | ICfn | Options for this resource, such as condition, update policy etc. |
cfn | { [string]: any } | |
cfn | string | AWS resource type. |
creation | string[] | |
default | IResolvable | User | The default user settings. |
domain | string | The domain name. |
logical | string | The logical ID for this CloudFormation stack element. |
node | Construct | The construct tree node associated with this construct. |
ref | string | Return a string that will be resolved to a CloudFormation { Ref } for this element. |
stack | Stack | The stack in which this element is defined. |
subnet | string[] | The VPC subnets that Studio uses for communication. |
tags | Tag | Tags to associated with the Domain. |
vpc | string | The ID of the Amazon Virtual Private Cloud (Amazon VPC) that Studio uses for communication. |
app | string | Specifies the VPC used for non-EFS traffic. The default value is PublicInternetOnly . |
app | string | The entity that creates and manages the required security groups for inter-app communication in VpcOnly mode. |
default | IResolvable | Default | AWS::SageMaker::Domain.DefaultSpaceSettings . |
domain | IResolvable | Domain | A collection of settings that apply to the SageMaker Domain . |
kms | string | SageMaker uses AWS KMS to encrypt the EFS volume attached to the Domain with an AWS managed customer master key (CMK) by default. |
static CFN_RESOURCE_TYPE_NAME | string | The CloudFormation resource type name for this resource class. |
attrDomainArn
Type:
string
The Amazon Resource Name (ARN) of the Domain, such as arn:aws:sagemaker:us-west-2:account-id:domain/my-domain-name
.
attrDomainId
Type:
string
The Domain ID.
attrHomeEfsFileSystemId
Type:
string
The ID of the Amazon Elastic File System (EFS) managed by this Domain.
attrSecurityGroupIdForDomainBoundary
Type:
string
The ID of the security group that authorizes traffic between the RSessionGateway
apps and the RStudioServerPro
app.
attrSingleSignOnManagedApplicationInstanceId
Type:
string
The IAM Identity Center managed application instance ID.
attrUrl
Type:
string
The URL for the Domain.
authMode
Type:
string
The mode of authentication that members use to access the Domain.
Valid Values : SSO | IAM
cfnOptions
Type:
ICfn
Options for this resource, such as condition, update policy etc.
cfnProperties
Type:
{ [string]: any }
cfnResourceType
Type:
string
AWS resource type.
creationStack
Type:
string[]
defaultUserSettings
Type:
IResolvable
|
User
The default user settings.
domainName
Type:
string
The domain name.
logicalId
Type:
string
The logical ID for this CloudFormation stack element.
The logical ID of the element is calculated from the path of the resource node in the construct tree.
To override this value, use overrideLogicalId(newLogicalId)
.
node
Type:
Construct
The construct tree node associated with this construct.
ref
Type:
string
Return a string that will be resolved to a CloudFormation { Ref }
for this element.
If, by any chance, the intrinsic reference of a resource is not a string, you could
coerce it to an IResolvable through Lazy.any({ produce: resource.ref })
.
stack
Type:
Stack
The stack in which this element is defined.
CfnElements must be defined within a stack scope (directly or indirectly).
subnetIds
Type:
string[]
The VPC subnets that Studio uses for communication.
Length Constraints : Maximum length of 32.
Array members : Minimum number of 1 item. Maximum number of 16 items.
Pattern : [-0-9a-zA-Z]+
tags
Type:
Tag
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 are launched in the Domain.
Array members : Minimum number of 0 items. Maximum number of 50 items.
vpcId
Type:
string
The ID of the Amazon Virtual Private Cloud (Amazon VPC) that Studio uses for communication.
Length Constraints : Maximum length of 32.
Pattern : [-0-9a-zA-Z]+
appNetworkAccessType?
Type:
string
(optional)
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 , which allows direct internet accessVpcOnly
- All Studio traffic is through the specified VPC and subnets
Valid Values : PublicInternetOnly | VpcOnly
appSecurityGroupManagement?
Type:
string
(optional)
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
.
Allowed Values : Service
| Customer
defaultSpaceSettings?
Type:
IResolvable
|
Default
(optional)
AWS::SageMaker::Domain.DefaultSpaceSettings
.
domainSettings?
Type:
IResolvable
|
Domain
(optional)
A collection of settings that apply to the SageMaker Domain
.
These settings are specified through the CreateDomain
API call.
kmsKeyId?
Type:
string
(optional)
SageMaker uses AWS KMS to encrypt the EFS volume attached to the Domain with an AWS managed customer master key (CMK) by default.
For more control, specify a customer managed CMK.
Length Constraints : Maximum length of 2048.
Pattern : .*
static CFN_RESOURCE_TYPE_NAME
Type:
string
The CloudFormation resource type name for this resource class.
Methods
Name | Description |
---|---|
add | Syntactic sugar for addOverride(path, undefined) . |
add | Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned. |
add | Add a value to the CloudFormation Resource Metadata. |
add | Adds an override to the synthesized CloudFormation resource. |
add | Adds an override that deletes the value of a property from the resource definition. |
add | Adds an override to a resource property. |
apply | Sets the deletion policy of the resource based on the removal policy specified. |
get | Returns a token for an runtime attribute of this resource. |
get | Retrieve a value value from the CloudFormation Resource Metadata. |
inspect(inspector) | Examines the CloudFormation resource and discloses attributes. |
override | Overrides the auto-generated logical ID with a specific ID. |
to | Returns a string representation of this construct. |
protected render |
DeletionOverride(path)
addpublic addDeletionOverride(path: string): void
Parameters
- path
string
— The path of the value to delete.
Syntactic sugar for addOverride(path, undefined)
.
DependsOn(target)
addpublic addDependsOn(target: CfnResource): void
Parameters
- target
Cfn
Resource
Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.
This can be used for resources across stacks (or nested stack) boundaries and the dependency will automatically be transferred to the relevant scope.
Metadata(key, value)
addpublic addMetadata(key: string, value: any): void
Parameters
- key
string
- value
any
Add a value to the CloudFormation Resource Metadata.
See also: [https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html
Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html
Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.)
Override(path, value)
addpublic addOverride(path: string, value: any): void
Parameters
- path
string
— - The path of the property, you can use dot notation to override values in complex types. - value
any
— - The value.
Adds an override to the synthesized CloudFormation resource.
To add a
property override, either use addPropertyOverride
or prefix path
with
"Properties." (i.e. Properties.TopicName
).
If the override is nested, separate each nested level using a dot (.) in the path parameter. If there is an array as part of the nesting, specify the index in the path.
To include a literal .
in the property name, prefix with a \
. In most
programming languages you will need to write this as "\\."
because the
\
itself will need to be escaped.
For example,
cfnResource.addOverride('Properties.GlobalSecondaryIndexes.0.Projection.NonKeyAttributes', ['myattribute']);
cfnResource.addOverride('Properties.GlobalSecondaryIndexes.1.ProjectionType', 'INCLUDE');
would add the overrides
"Properties": {
"GlobalSecondaryIndexes": [
{
"Projection": {
"NonKeyAttributes": [ "myattribute" ]
...
}
...
},
{
"ProjectionType": "INCLUDE"
...
},
]
...
}
The value
argument to addOverride
will not be processed or translated
in any way. Pass raw JSON values in here with the correct capitalization
for CloudFormation. If you pass CDK classes or structs, they will be
rendered with lowercased key names, and CloudFormation will reject the
template.
PropertyDeletionOverride(propertyPath)
addpublic addPropertyDeletionOverride(propertyPath: string): void
Parameters
- propertyPath
string
— The path to the property.
Adds an override that deletes the value of a property from the resource definition.
PropertyOverride(propertyPath, value)
addpublic addPropertyOverride(propertyPath: string, value: any): void
Parameters
- propertyPath
string
— The path of the property. - value
any
— The value.
Adds an override to a resource property.
Syntactic sugar for addOverride("Properties.<...>", value)
.
RemovalPolicy(policy?, options?)
applypublic applyRemovalPolicy(policy?: RemovalPolicy, options?: RemovalPolicyOptions): void
Parameters
- policy
Removal
Policy - options
Removal
Policy Options
Sets the deletion policy of the resource based on the removal policy specified.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.
The resource can be deleted (RemovalPolicy.DESTROY
), or left in your AWS
account for data recovery and cleanup later (RemovalPolicy.RETAIN
).
Att(attributeName)
getpublic getAtt(attributeName: string): Reference
Parameters
- attributeName
string
— The name of the attribute.
Returns
Returns a token for an runtime attribute of this resource.
Ideally, use generated attribute accessors (e.g. resource.arn
), but this can be used for future compatibility
in case there is no generated attribute.
Metadata(key)
getpublic getMetadata(key: string): any
Parameters
- key
string
Returns
any
Retrieve a value value from the CloudFormation Resource Metadata.
See also: [https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html
Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html
Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.)
inspect(inspector)
public inspect(inspector: TreeInspector): void
Parameters
- inspector
Tree
— - tree inspector to collect and process attributes.Inspector
Examines the CloudFormation resource and discloses attributes.
LogicalId(newLogicalId)
overridepublic overrideLogicalId(newLogicalId: string): void
Parameters
- newLogicalId
string
— The new logical ID to use for this stack element.
Overrides the auto-generated logical ID with a specific ID.
String()
topublic toString(): string
Returns
string
Returns a string representation of this construct.
Properties(props)
protected renderprotected renderProperties(props: { [string]: any }): { [string]: any }
Parameters
- props
{ [string]: any }
Returns
{ [string]: any }