SageMaker / Client / update_inference_router
update_inference_router¶
- SageMaker.Client.update_inference_router(**kwargs)¶
Updates the routing targets of an inference router. The routing targets that you specify replace all of the router’s existing routing targets. To change one routing target, call DescribeInferenceRouter, edit the routing targets, and send all of them.
The update is applied in full or not at all, and each request uses either the previous configuration or the new one. Updates typically take effect within about 2 minutes.
If the router is being created, updated, or deleted, or another request changes it at the same time, you get a
ConflictException. Describe the router, and then send your update again.See also: AWS API Documentation
Request Syntax
response = client.update_inference_router( InferenceRouterName='string', RoutingTargets=[ { 'Name': 'string', 'Destinations': [ { 'ResourceArn': 'string', 'RoutingStatus': 'Routable'|'Unroutable'|'Unknown' }, ], 'AsyncInferenceConfig': { 'OutputConfig': { 'S3OutputPath': 'string', 'S3FailurePath': 'string', 'KmsKeyId': 'string', 'NotificationConfig': { 'SuccessTopic': 'string', 'ErrorTopic': 'string' } }, 'ClientConfig': { 'MaxTimeInBacklogSeconds': 123 } }, 'RoutingPreference': 'LocalRegionFirst'|'InstancePoolOrder' }, ] )
- Parameters:
InferenceRouterName (string) –
[REQUIRED]
The name of the inference router to update.
RoutingTargets (list) –
[REQUIRED]
The complete list of routing targets for the inference router. To remove the last routing target, delete the router.
(dict) –
A model that an inference router serves, and the destinations that can serve it. When you invoke the router, you name the routing target, and the router sends the request to one of its destinations.
Every destination in a routing target must serve the same model, with the same request and response format.
Name (string) – [REQUIRED]
The name of the routing target. Callers specify this name in the
RoutingTargetNameparameter when they invoke the inference router. The name must be unique within the router.Destinations (list) – [REQUIRED]
The endpoints and inference components that serve the routing target. Each destination can appear only once in a routing target.
In an asynchronous routing target, every destination must be an asynchronous inference endpoint. In a real-time routing target, no destination can be one. SageMaker AI checks an endpoint in another account with your credentials, so both your IAM policy and the endpoint policy must allow
sagemaker:DescribeEndpoint. If an endpoint can’t be checked, for example because it isn’t found or can’t be read in time, it’s accepted, and requests to it fail if it’s the wrong mode.(dict) –
An endpoint or inference component that serves a routing target.
ResourceArn (string) – [REQUIRED]
The Amazon Resource Name (ARN) of the endpoint or inference component. The destination can be in any account, and in any Amazon Web Services Region in the same partition as the inference router. To use a destination in another account, its owner must allow your account to invoke it through your router, in an endpoint policy.
RoutingStatus (string) –
Whether the inference router can send requests to the destination, as checked when you called
DescribeInferenceRouter. This value isn’t the destination’s own status. SageMaker AI ignores this field inCreateInferenceRouterandUpdateInferenceRouterrequests.Routable
The destination is serving and the router can send it requests. A routable destination can still be overloaded.
Unroutable
The destination can’t serve requests. For example, it’s being created or has failed, or it has no capacity and no way to get any. A destination in your account that doesn’t exist is also
Unroutable.Unknown
SageMaker AI couldn’t check the destination, for example because you aren’t allowed to describe it or the check timed out. The destination might still be serving.
AsyncInferenceConfig (dict) –
The asynchronous inference settings of the routing target. Specify this setting to make the routing target asynchronous. If you omit it, the routing target serves real-time requests.
Asynchronous routing targets aren’t available in all Amazon Web Services Regions. For information about asynchronous routing targets and Region availability, see Send asynchronous requests through an inference router.
Because
UpdateInferenceRouterreplaces all routing targets, include this setting in every update of an asynchronous routing target.For information about asynchronous routing targets, see Send asynchronous requests through an inference router.
OutputConfig (dict) – [REQUIRED]
The Amazon S3 locations for the results of asynchronous requests, and the notification settings.
S3OutputPath (string) – [REQUIRED]
The Amazon S3 location for the results of successful requests. The bucket must be in the inference router’s Amazon Web Services Region and owned by the router’s account.
S3FailurePath (string) – [REQUIRED]
The Amazon S3 location for the failure details of failed requests. The bucket must be in the inference router’s Amazon Web Services Region and owned by the router’s account.
KmsKeyId (string) –
The KMS key that encrypts the results in Amazon S3. You can specify a key ID, key ARN, alias name, or alias ARN. If any destination is in a different account or Amazon Web Services Region from the inference router, specify a key ARN or an alias ARN.
NotificationConfig (dict) –
The Amazon SNS topics that the inference router publishes to when a request completes or fails.
SuccessTopic (string) –
The ARN of the Amazon SNS topic to publish to when a request completes. The topic must be a standard topic, and can be in any Amazon Web Services Region.
ErrorTopic (string) –
The ARN of the Amazon SNS topic to publish to when a request fails, or when the router can’t place it on any destination. The topic must be a standard topic, and can be in any Amazon Web Services Region.
ClientConfig (dict) –
How the inference router submits requests to destinations.
MaxTimeInBacklogSeconds (integer) –
The maximum time, in seconds, that a request can wait at a destination before the inference router moves it to another destination. The default is 900 seconds.
RoutingPreference (string) –
How the inference router chooses among the routing target’s destinations. The default is
LocalRegionFirst.LocalRegionFirst
The router uses destinations in its own Region first. When the request leaves the Region, the router spreads it across healthy destinations in other Regions.
InstancePoolOrder
The router prefers destinations by instance type first and by Region second. Every destination must be an endpoint that lists the same two or more instance types, each with a different priority, in the same priority order. This value is supported only for asynchronous routing targets.
With either value, the router uses destinations whose health or capacity is reduced after the others, but doesn’t exclude them.
- Return type:
dict
- Returns:
Response Syntax
{ 'InferenceRouterArn': 'string' }
Response Structure
(dict) –
InferenceRouterArn (string) –
The Amazon Resource Name (ARN) of the inference router.
Exceptions
SageMaker.Client.exceptions.ConflictExceptionSageMaker.Client.exceptions.ResourceNotFoundSageMaker.Client.exceptions.ResourceLimitExceeded