createEndpoint method
Creates an endpoint using the endpoint configuration specified in the request. SageMaker uses the endpoint to provision resources and deploy models. You create the endpoint configuration with the CreateEndpointConfig API.
Use this API to deploy models using SageMaker hosting services. The endpoint name must be unique within an Amazon Web Services Region in your Amazon Web Services account.
When it receives the request, SageMaker creates the endpoint, launches the
resources (ML compute instances), and deploys the model(s) on them.
When SageMaker receives the request, it sets the endpoint status to
Creating. After it creates the endpoint, it sets the status
to InService. SageMaker can then process incoming requests
for inferences. To check the status of an endpoint, use the DescribeEndpoint
API.
If any of the models hosted at this endpoint get model data from an Amazon S3 location, SageMaker uses Amazon Web Services Security Token Service to download model artifacts from the S3 path you provided. Amazon Web Services STS is activated in your Amazon Web Services account by default. If you previously deactivated Amazon Web Services STS for a region, you need to reactivate Amazon Web Services STS for that region. For more information, see Activating and Deactivating Amazon Web Services STS in an Amazon Web Services Region in the Amazon Web Services Identity and Access Management User Guide.
-
Option 1: For a full SageMaker access, search and attach the
AmazonSageMakerFullAccesspolicy. -
Option 2: For granting a limited access to an IAM role, paste the
following Action elements manually into the JSON file of the IAM role:
"Action": ["sagemaker:CreateEndpoint", "sagemaker:CreateEndpointConfig"]"Resource": ["arn:aws:sagemaker:region:account-id:endpoint/endpointName""arn:aws:sagemaker:region:account-id:endpoint-config/endpointConfigName"]For more information, see SageMaker API Permissions: Actions, Permissions, and Resources Reference.
May throw ResourceLimitExceeded.
Parameter endpointConfigName :
The name of an endpoint configuration. For more information, see CreateEndpointConfig.
Parameter endpointName :
The name of the endpoint.The name must be unique within an Amazon Web
Services Region in your Amazon Web Services account. The name is
case-insensitive in CreateEndpoint, but the case is preserved
and must be matched in InvokeEndpoint.
Parameter tags :
An array of key-value pairs. You can use tags to categorize your Amazon
Web Services resources in different ways, for example, by purpose, owner,
or environment. For more information, see Tagging
Amazon Web Services Resources.
Implementation
Future<CreateEndpointOutput> createEndpoint({
required String endpointConfigName,
required String endpointName,
DeploymentConfig? deploymentConfig,
List<Tag>? tags,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'SageMaker.CreateEndpoint'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'EndpointConfigName': endpointConfigName,
'EndpointName': endpointName,
if (deploymentConfig != null) 'DeploymentConfig': deploymentConfig,
if (tags != null) 'Tags': tags,
},
);
return CreateEndpointOutput.fromJson(jsonResponse.body);
}