createEndpointConfig method

Future<CreateEndpointConfigOutput> createEndpointConfig({
  1. required String endpointConfigName,
  2. required List<ProductionVariant> productionVariants,
  3. DataCaptureConfig? dataCaptureConfig,
  4. String? kmsKeyId,
  5. List<Tag>? tags,
})

Creates an endpoint configuration that Amazon SageMaker hosting services uses to deploy models. In the configuration, you identify one or more models, created using the CreateModel API, to deploy and the resources that you want Amazon SageMaker to provision. Then you call the CreateEndpoint API. In the request, you define a ProductionVariant, for each model that you want to deploy. Each ProductionVariant parameter also describes the resources that you want Amazon SageMaker to provision. This includes the number and type of ML compute instances to deploy.

If you are hosting multiple models, you also assign a VariantWeight to specify how much traffic you want to allocate to each model. For example, suppose that you want to host two models, A and B, and you assign traffic weight 2 for model A and 1 for model B. Amazon SageMaker distributes two-thirds of the traffic to Model A, and one-third to model B.

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)).

May throw ResourceLimitExceeded.

Parameter endpointConfigName : The name of the endpoint configuration. You specify this name in a CreateEndpoint request.

Parameter productionVariants : An list of ProductionVariant objects, one for each model that you want to host at this endpoint.

Parameter kmsKeyId : The Amazon Resource Name (ARN) of a AWS Key Management Service key that Amazon SageMaker uses to encrypt data on the storage volume attached to the ML compute instance that hosts the endpoint.

The KmsKeyId can be any of the following formats:

  • Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab
  • Key ARN: arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
  • Alias name: alias/ExampleAlias
  • Alias name ARN: arn:aws:kms:us-west-2:111122223333:alias/ExampleAlias
The KMS key policy must grant permission to the IAM role that you specify in your CreateEndpoint, UpdateEndpoint requests. For more information, refer to the AWS Key Management Service section Using Key Policies in AWS KMS

Implementation

Future<CreateEndpointConfigOutput> createEndpointConfig({
  required String endpointConfigName,
  required List<ProductionVariant> productionVariants,
  DataCaptureConfig? dataCaptureConfig,
  String? kmsKeyId,
  List<Tag>? tags,
}) async {
  ArgumentError.checkNotNull(endpointConfigName, 'endpointConfigName');
  _s.validateStringLength(
    'endpointConfigName',
    endpointConfigName,
    0,
    63,
    isRequired: true,
  );
  ArgumentError.checkNotNull(productionVariants, 'productionVariants');
  _s.validateStringLength(
    'kmsKeyId',
    kmsKeyId,
    0,
    2048,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'SageMaker.CreateEndpointConfig'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'EndpointConfigName': endpointConfigName,
      'ProductionVariants': productionVariants,
      if (dataCaptureConfig != null) 'DataCaptureConfig': dataCaptureConfig,
      if (kmsKeyId != null) 'KmsKeyId': kmsKeyId,
      if (tags != null) 'Tags': tags,
    },
  );

  return CreateEndpointConfigOutput.fromJson(jsonResponse.body);
}