Giter VIP home page Giter VIP logo

amazon-sagemaker-auto-stop-instances's Introduction

Auto-Stop InService Sagemaker Notebook Instances in an AWS account.

Important: this application uses various AWS services and there are costs associated with these services after the Free Tier usage - please see the AWS Pricing page for details. You are responsible for any AWS costs incurred. No warranty is implied in this example.

Sagemaker-stop-instances.yaml - Cloudformation template to provision the resources required

In an AWS environment where efficient resource utilization and cost optimization are paramount , automating the management of Amazon SageMaker notebook instances is crucial. To prevent overspending and overutilization of AWS resources, an automated solution is designed using AWS EventBridge , AWS Lambda and Amazon SageMaker Services.

Solution Overview

The solution aims to create an automated process that stops Amazon SageMaker notebook instances during specific scheduled times when they are not actively needed. This is achieved by scheduling an AWS Eventbridge rule to trigger an AWS lambda function. The Lambda function then lists all the SageMaker notebook instances with the "InService" status and stops them ensuring that the resources are efficiently managed and costs are minimized.

Note : Architecture Diagram

Amazon SageMaker notebook Stop

Requirements

You need to deploy the Cloudformation stack Sagmaker-stop-instances.yaml in your AWS account.

Steps

  1. Sign into the AWS Management Console at https://console.aws.amazon.com/

  2. In the upper-right corner of the AWS Management Console, confirm you are in the desired AWS region. For this workshop we will use the US East (N. Virginia) [us-east-1]

  3. Install or update the latest version of the AWS CLI https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html/

  4. Deploy the cloudformation stack in the AWS region of your choice using the following command in the AWS CLI. You need to provide the values for the parameters lambda role name and cron expression for the scheduled eventbridge rule.

Define the parameter values

StackName='Sagemaker-stop-instances' LambdaRoleName='REPLACE ME' (pass the lambda role name) ScheduledTime='REPLACE ME' (pass the cron expression)

Deploy Cloudformation Template

  aws cloudformation deploy \
    --template-file Sagemaker-stop-instances.yaml \
    --stack-name ${StackName} \
    --parameter-overrides \
        "LambdaRoleName=${LambdaRoleName}" \
        "ScheduledTime=${ScheduledTime}" \
    --capabilities CAPABILITY_NAMED_IAM CAPABILITY_AUTO_EXPAND

==============================================

Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.

SPDX-License-Identifier: MIT-0

amazon-sagemaker-auto-stop-instances's People

Contributors

amazon-auto avatar jaradtke-aws avatar saptob avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.