C3_W2 - Unable to get the 'endpoint_config_name'

for the code cell
endpoint_config_name = ‘{}-{}’.format(‘ab’, timestamp)

if not check_endpoint_config_existence(endpoint_config_name):
endpoint_config = sm.create_endpoint_config(
EndpointConfigName=endpoint_config_name,
ProductionVariants=[variantA, variantB]
)
pprint(endpoint_config)
else:
print(“Endpoint configuration {} already exists”.format(endpoint_config_name))

Getting below error-


ParamValidationError Traceback (most recent call last)
in
4 endpoint_config = sm.create_endpoint_config(
5 EndpointConfigName=endpoint_config_name,
----> 6 ProductionVariants=[variantA, variantB]
7 )
8 pprint(endpoint_config)

/opt/conda/lib/python3.7/site-packages/botocore/client.py in _api_call(self, *args, **kwargs)
386 "s() only accepts keyword arguments." py_operation_name)
387 # The “self” in this scope is referring to the BaseClient.
→ 388 return self._make_api_call(operation_name, kwargs)
389
390 _api_call.name = str(py_operation_name)

/opt/conda/lib/python3.7/site-packages/botocore/client.py in _make_api_call(self, operation_name, api_params)
679 }
680 request_dict = self._convert_to_request_dict(
→ 681 api_params, operation_model, context=request_context)
682
683 service_id = self._service_model.service_id.hyphenize()

/opt/conda/lib/python3.7/site-packages/botocore/client.py in _convert_to_request_dict(self, api_params, operation_model, context)
727 api_params, operation_model, context)
728 request_dict = self._serializer.serialize_to_request(
→ 729 api_params, operation_model)
730 if not self._client_config.inject_host_prefix:
731 request_dict.pop(‘host_prefix’, None)

/opt/conda/lib/python3.7/site-packages/botocore/validate.py in serialize_to_request(self, parameters, operation_model)
358 operation_model.input_shape)
359 if report.has_errors():
→ 360 raise ParamValidationError(report=report.generate_report())
361 return self._serializer.serialize_to_request(parameters,
362 operation_model)

ParamValidationError: Parameter validation failed:
Invalid type for parameter ProductionVariants[0].InstanceType, value: {‘ModelArn’: ‘arn:aws:sagemaker:us-east-1:185909194725:model/a-1636893561’, ‘ResponseMetadata’: {‘RequestId’: ‘3376e49f-1b8a-4193-bc0f-54da8881c2d6’, ‘HTTPStatusCode’: 200, ‘HTTPHeaders’: {‘x-amzn-requestid’: ‘3376e49f-1b8a-4193-bc0f-54da8881c2d6’, ‘content-type’: ‘application/x-amz-json-1.1’, ‘content-length’: ‘74’, ‘date’: ‘Sun, 14 Nov 2021 12:40:24 GMT’}, ‘RetryAttempts’: 0}}, type: <class ‘dict’>, valid types: <class ‘str’>
Invalid type for parameter ProductionVariants[1].InstanceType, value: {‘ModelArn’: ‘arn:aws:sagemaker:us-east-1:185909194725:model/b-1636893561’, ‘ResponseMetadata’: {‘RequestId’: ‘cd6312a6-8167-452e-9c4e-0dd2f9fc5b9d’, ‘HTTPStatusCode’: 200, ‘HTTPHeaders’: {‘x-amzn-requestid’: ‘cd6312a6-8167-452e-9c4e-0dd2f9fc5b9d’, ‘content-type’: ‘application/x-amz-json-1.1’, ‘content-length’: ‘74’, ‘date’: ‘Sun, 14 Nov 2021 12:41:34 GMT’}, ‘RetryAttempts’: 0}}, type: <class ‘dict’>, valid types: <class ‘str’>

In Excercise 4 VariantA was successfully created, printing it below -

{‘ModelName’: ‘a-1636893561’, ‘InstanceType’: {‘ModelArn’: ‘arn:aws:sagemaker:us-east-1:185909194725:model/a-1636893561’, ‘ResponseMetadata’: {‘RequestId’: ‘3376e49f-1b8a-4193-bc0f-54da8881c2d6’, ‘HTTPStatusCode’: 200, ‘HTTPHeaders’: {‘x-amzn-requestid’: ‘3376e49f-1b8a-4193-bc0f-54da8881c2d6’, ‘content-type’: ‘application/x-amz-json-1.1’, ‘content-length’: ‘74’, ‘date’: ‘Sun, 14 Nov 2021 12:40:24 GMT’}, ‘RetryAttempts’: 0}}, ‘InitialInstanceCount’: 1, ‘VariantName’: ‘VariantA’, ‘InitialVariantWeight’: 50}

In Excercise 5 VariantB was successfully created, printing it below -

{‘ModelName’: ‘b-1636893561’, ‘InstanceType’: {‘ModelArn’: ‘arn:aws:sagemaker:us-east-1:185909194725:model/b-1636893561’, ‘ResponseMetadata’: {‘RequestId’: ‘cd6312a6-8167-452e-9c4e-0dd2f9fc5b9d’, ‘HTTPStatusCode’: 200, ‘HTTPHeaders’: {‘x-amzn-requestid’: ‘cd6312a6-8167-452e-9c4e-0dd2f9fc5b9d’, ‘content-type’: ‘application/x-amz-json-1.1’, ‘content-length’: ‘74’, ‘date’: ‘Sun, 14 Nov 2021 12:41:34 GMT’}, ‘RetryAttempts’: 0}}, ‘InitialInstanceCount’: 1, ‘VariantName’: ‘VariantB’, ‘InitialVariantWeight’: 50}

I am stuck as I am unable to create endpoint_config_name, would be grateful for any help.

1 Like

@Abhijit_Kumar_Rai , did you fix this problem? I got the same. Thanks!

we should be using right model name for A and B.

Take a look at this instruction :slight_smile:
Create an Amazon SageMaker production variant for the SageMaker Model with the model_name_b

make the same changes for model_name_a as well

This will resolve your issue