Skip to content

aws-samples/sagemaker-canvas-auto-shutdown-on-idle

Saving on Costs by Shutting Down Idle SageMaker Canvas Apps Automatically

This repository contains three CloudFormation templates, which can be deployed to an AWS account to enable automatic shutdown on idle for SageMaker Canvas applications. There are three options available:

  1. Shutdown all SageMaker Canvas apps, on all user profiles, on all SageMaker domains - download the file all-domain-all-users
  2. Shutdown all SageMaker Canvas apps on all user profiles OF THE SAME SAGEMAKER DOMAIN - download the file one-domain-all-users
  3. Shutdown all SageMaker Canvas apps on A SINGLE USER PROFILE IN A SINGLE SAGEMAKER DOMAIN - download the file one-domain-one-user

Architecture description

Solution Architecture

To enable auto-shutdown, we will build an AWS CloudFormation stack consisting of an AWS Lambda function triggered by a CloudWatch alarm on the TimeSinceLastActive metric. The Lambda function will stop the SageMaker Canvas app when invoked by the Amazon CloudWatch alarm after a configurable idle timeout threshold is exceeded. This will allow us to automatically shut down idle Canvas apps to avoid incurring unnecessary charges.

Steps to install

To deploy the auto-shutdown stack:

  1. Download the CloudFormation template - choose one from the list above
  2. Go to AWS CloudFormation and create a new Stack - Quick link
  3. Select "Upload a template file" as templace source, and upload the template downloaded in step 1
  4. Provide template parameters like idle timeout, alarm period, (optionally) domain ID and user profile name
  5. Deploy the AWS CloudFormation stack to create the resources

Once deployed, the Lambda function and CloudWatch alarm are configured to automatically shut down the Sagemaker Canvas app when idle.

About

No description, website, or topics provided.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published