Created
December 14, 2023 06:52
-
-
Save alvindaiyan/facf2abac5f03b88cf89d5d3af0cd7b6 to your computer and use it in GitHub Desktop.
Scaling a Sagemaker Endpoint to 0 and others
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| import boto3 | |
| os.environ.setdefault('AWS_PROFILE', 'playground') # your aws profile name | |
| endpoint_name = 'YOUR_ENDPOINT_NAME' # your endpoint name | |
| if __name__ == '__main__': | |
| sagemaker_client = boto3.client('sagemaker') | |
| ep = sagemaker_client.describe_endpoint( | |
| EndpointName=endpoint_name | |
| ) | |
| print(ep) | |
| response = sagemaker_client.update_endpoint_weights_and_capacities( | |
| EndpointName=endpoint_name, | |
| DesiredWeightsAndCapacities=[ | |
| { | |
| 'VariantName': 'main', | |
| 'DesiredInstanceCount': 0 | |
| }, | |
| ] | |
| ) | |
| print(response) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.