Skip to content

create_global_inference_gateway

create_global_inference_gateway(
    *,
    config_overrides: Optional[SageMakerClientConfig] = None,
    name: Optional[GlobalInferenceGatewayName] = None,
    routing: Optional[GlobalInferenceGatewayRouting] = None,
    execution_role_arn: Optional[GlobalInferenceGatewayExecutionRoleArn] = None,
    gateways: Optional[GlobalInferenceGatewayMembers] = None,
    client_token: Optional[GlobalInferenceGatewayClientToken] = None,
    tags: Optional[TagList] = None,
) -> CreateGlobalInferenceGatewayResponse

Creates a global inference gateway. This operation is asynchronous: the global inference gateway starts in the CREATING status. To check its status, call DescribeGlobalInferenceGateway until the status is ACTIVE or FAILED. The operation fails with ResourceInUse if the name is already in use, or if one of the in-cluster inference gateways in Gateways already belongs to another global inference gateway.

Parameters:

  • name (Optional[GlobalInferenceGatewayName], default: None ) –

    The name of the global inference gateway. The name must be unique in your account in the current Region, and is case-sensitive. The name can't be exactly 12 lowercase letters or digits, because the global inference gateway ID uses that format.

  • routing (Optional[GlobalInferenceGatewayRouting], default: None ) –

    The routing configuration of the global inference gateway. If you omit it, the global inference gateway uses default routing weights.

  • execution_role_arn (Optional[GlobalInferenceGatewayExecutionRoleArn], default: None ) –

    The Amazon Resource Name (ARN) of the IAM role that the global inference gateway assumes to access your SageMaker HyperPod clusters. The role must be in your account and partition, and you must have iam:PassRole permission for it. You can't change the role after you create the global inference gateway.

  • gateways (Optional[GlobalInferenceGatewayMembers], default: None ) –

    The 1 to 10 in-cluster inference gateways to add to the global inference gateway. A global inference gateway must always have at least one in-cluster inference gateway, so RemoveInferenceGateway can't remove the last one.

  • client_token (Optional[GlobalInferenceGatewayClientToken], default: None ) –

    A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. An idempotent operation completes no more than one time. If you don't specify a client token, the Amazon Web Services SDKs and the Amazon Web Services CLI generate one for you.

  • tags (Optional[TagList], default: None ) –

    Custom tags for managing the global inference gateway as an Amazon Web Services resource. You can add tags to your global inference gateway in the same way you add them in other Amazon Web Services services that support tagging. For more information about tagging Amazon Web Services resources, see Tagging your Amazon Web Services resources in the Tagging Amazon Web Services Resources User Guide.

    The global inference gateway doesn't return tags in its responses. To read the tags, use ListTags.

Raises:

  • ResourceInUse –

    Resource being accessed is in use.

  • ResourceLimitExceeded –

    You have exceeded an SageMaker resource limit. For example, you might have too many training jobs created.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_sagemaker/_services/sage_maker.py
def create_global_inference_gateway(
    self,
    *,
    config_overrides: Optional[SageMakerClientConfig] = None,
    name: Optional[
        "capo_sagemaker.types.global_inference_gateway_name.GlobalInferenceGatewayName"
    ] = None,
    routing: Optional[
        "capo_sagemaker.types.global_inference_gateway_routing.GlobalInferenceGatewayRouting"
    ] = None,
    execution_role_arn: Optional[
        "capo_sagemaker.types.global_inference_gateway_execution_role_arn.GlobalInferenceGatewayExecutionRoleArn"
    ] = None,
    gateways: Optional[
        "capo_sagemaker.types.global_inference_gateway_members.GlobalInferenceGatewayMembers"
    ] = None,
    client_token: Optional[
        "capo_sagemaker.types.global_inference_gateway_client_token.GlobalInferenceGatewayClientToken"
    ] = None,
    tags: Optional["capo_sagemaker.types.tag_list.TagList"] = None,
) -> "capo_sagemaker.types.create_global_inference_gateway_response.CreateGlobalInferenceGatewayResponse":
    """Creates a global inference gateway. This operation is asynchronous: the global inference gateway starts in the `CREATING` status. To check its status, call `DescribeGlobalInferenceGateway` until the status is `ACTIVE` or `FAILED`. The operation fails with `ResourceInUse` if the name is already in use, or if one of the in-cluster inference gateways in `Gateways` already belongs to another global inference gateway.

    Args:
        name: <p>The name of the global inference gateway. The name must be unique in your account in the current Region, and is case-sensitive. The name can't be exactly 12 lowercase letters or digits, because the global inference gateway ID uses that format.</p>
        routing: The routing configuration of the global inference gateway. If you omit it, the global inference gateway uses default routing weights.
        execution_role_arn: <p>The Amazon Resource Name (ARN) of the IAM role that the global inference gateway assumes to access your SageMaker HyperPod clusters. The role must be in your account and partition, and you must have <code>iam:PassRole</code> permission for it. You can't change the role after you create the global inference gateway.</p>
        gateways: The 1 to 10 in-cluster inference gateways to add to the global inference gateway. A global inference gateway must always have at least one in-cluster inference gateway, so `RemoveInferenceGateway` can't remove the last one.
        client_token: <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. An idempotent operation completes no more than one time. If you don't specify a client token, the Amazon Web Services SDKs and the Amazon Web Services CLI generate one for you.</p>
        tags: <p>Custom tags for managing the global inference gateway as an Amazon Web Services resource. You can add tags to your global inference gateway in the same way you add them in other Amazon Web Services services that support tagging. For more information about tagging Amazon Web Services resources, see <a href="https://docs.aws.amazon.com/tag-editor/latest/userguide/tagging.html">Tagging your Amazon Web Services resources</a> in the <i>Tagging Amazon Web Services Resources User Guide</i>.</p> <p>The global inference gateway doesn't return tags in its responses. To read the tags, use <code>ListTags</code>.</p>

    Raises:
        capo_sagemaker.errors.resource_in_use.ResourceInUse: <p>Resource being accessed is in use.</p>
        capo_sagemaker.errors.resource_limit_exceeded.ResourceLimitExceeded: <p> You have exceeded an SageMaker resource limit. For example, you might have too many training jobs created. </p>
        capo_sagemaker.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_sagemaker.types.create_global_inference_gateway_request.CreateGlobalInferenceGatewayRequest]",
    ) -> OperationResponse[
        "capo_sagemaker.types.create_global_inference_gateway_response.CreateGlobalInferenceGatewayResponse"
    ]:
        import capo_sagemaker._operations.sage_maker.create_global_inference_gateway

        output, http_response = (
            capo_sagemaker._operations.sage_maker.create_global_inference_gateway.create_global_inference_gateway(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateGlobalInferenceGateway")
    )
    input_: capo_sagemaker.types.create_global_inference_gateway_request.CreateGlobalInferenceGatewayRequest = {}
    if name is not None:
        input_["name"] = name
    if routing is not None:
        input_["routing"] = routing
    if execution_role_arn is not None:
        input_["execution_role_arn"] = execution_role_arn
    if gateways is not None:
        input_["gateways"] = gateways
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if tags is not None:
        input_["tags"] = tags

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output