SageMaker / Client / put_endpoint_policy

put_endpoint_policy

SageMaker.Client.put_endpoint_policy(**kwargs)

Attaches a resource-based policy to an endpoint. With an endpoint policy, you can allow other Amazon Web Services accounts to send requests to your endpoint, or to inference components on it, through an inference router. The policy that you specify replaces the endpoint’s existing policy, if it has one.

You can’t attach a policy to an endpoint whose status is Deleting or Failed. SageMaker AI rejects a policy that doesn’t follow the endpoint policy rules. For information about the policy rules, see Use destinations in other accounts.

Policy changes typically take effect within 30 seconds, and can take up to 5 minutes. If you delete the endpoint, its policy is also deleted, and a new endpoint with the same name has no policy.

See also: AWS API Documentation

Request Syntax

response = client.put_endpoint_policy(
    EndpointName='string',
    ResourcePolicy='string'
)
Parameters:
  • EndpointName (string) –

    [REQUIRED]

    The name of the endpoint. The endpoint must be in your account and in the current Amazon Web Services Region.

  • ResourcePolicy (string) –

    [REQUIRED]

    The endpoint policy, as a JSON policy document. The policy can contain only ASCII characters. For information about the policy rules, see Use destinations in other accounts.

Return type:

dict

Returns:

Response Syntax

{
    'EndpointArn': 'string'
}

Response Structure

  • (dict) –

    • EndpointArn (string) –

      The Amazon Resource Name (ARN) of the endpoint.

Exceptions

  • SageMaker.Client.exceptions.ResourceNotFound