createEndpoint method

Future<CreateEndpointOutput> createEndpoint({
  1. required String endpointConfigName,
  2. required String endpointName,
  3. List<Tag>? tags,
})

Creates an endpoint using the endpoint configuration specified in the request. Amazon 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 Amazon SageMaker hosting services.

For an example that calls this method when deploying a model to Amazon SageMaker hosting services, see Deploy the Model to Amazon SageMaker Hosting Services (AWS SDK for Python (Boto 3)). The endpoint name must be unique within an AWS Region in your AWS account.

When it receives the request, Amazon SageMaker creates the endpoint, launches the resources (ML compute instances), and deploys the model(s) on them. When Amazon SageMaker receives the request, it sets the endpoint status to Creating. After it creates the endpoint, it sets the status to InService. Amazon 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, Amazon SageMaker uses AWS Security Token Service to download model artifacts from the S3 path you provided. AWS STS is activated in your IAM user account by default. If you previously deactivated AWS STS for a region, you need to reactivate AWS STS for that region. For more information, see Activating and Deactivating AWS STS in an AWS Region in the AWS Identity and Access Management User Guide.

  • Option 1: For a full Amazon SageMaker access, search and attach the AmazonSageMakerFullAccess policy.
  • 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 Amazon 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 AWS Region in your AWS account. The name is case-insensitive in CreateEndpoint, but the case is preserved and must be matched in .

Parameter tags : An array of key-value pairs. You can use tags to categorize your AWS resources in different ways, for example, by purpose, owner, or environment. For more information, see Tagging AWS Resources.

Implementation

Future<CreateEndpointOutput> createEndpoint({
  required String endpointConfigName,
  required String endpointName,
  List<Tag>? tags,
}) async {
  ArgumentError.checkNotNull(endpointConfigName, 'endpointConfigName');
  _s.validateStringLength(
    'endpointConfigName',
    endpointConfigName,
    0,
    63,
    isRequired: true,
  );
  ArgumentError.checkNotNull(endpointName, 'endpointName');
  _s.validateStringLength(
    'endpointName',
    endpointName,
    0,
    63,
    isRequired: true,
  );
  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 (tags != null) 'Tags': tags,
    },
  );

  return CreateEndpointOutput.fromJson(jsonResponse.body);
}