Automatically Start and Stop EC2 Instances with AWS Instance Scheduler

Ғылым және технология

Have you been bitten by the dreaded EC2 instance that you accidentally left running? Or is your company trying to optimize costs by shutting down instances on nights and weekends? Well, you’re in luck! AWS Instance Scheduler makes it easy to start and stop instances on a schedule.
In this hands-on demo, I’ll give you a brief overview of how Instance Scheduler works, then we’ll deploy the solution using CloudFormation. From there, we’ll configure periods and schedules in a DynamoDB table. Finally, we’ll tag the instance that we want to shut down, and test that it gets shut down at the time we specify.
AWS Instance Scheduler Implementation Guide: docs.aws.amazon.com/solutions...
If you want to learn more about how to view your bill and the details of costs incurred, then check out this video: • Basics of Your AWS Bil...
🌟🌟If you’re interested in getting AWS certifications, check out these full courses. They include lots of hands-on demos, quizzes and full practice exams. Use FRIENDS10 for a 10% discount!
- AWS Certified Cloud Practitioner: academy.zerotomastery.io/a/af...
- AWS Certified Solutions Architect Associate: academy.zerotomastery.io/a/af...
00:00 - Overviewing what we’ll be doing in this video
00:26 - A word about costs for AWS Instance Scheduler
01:18 - High-level review of the technical details and architecture
02:36 - Deploying the solution through CloudFormation in the AWS Console
04:10 - Reviewing the deployment steps in the Implementation Guide
04:46 - Reviewing the requirements for periods and schedules
06:15 - Updating periods and schedules in the DynamoDB console
08:47 - Creating an EC2 instance
09:47 - Adding a tag for the Schedule
10:52 - Testing that the scheduler automatically stops the instance
11:55 - IMPORTANT! Deleting the CloudFormation stack

Пікірлер: 93

  • @TinyTechnicalTutorials
    @TinyTechnicalTutorials Жыл бұрын

    What else do you want to learn in AWS? Let me know below in the comments! ☺

  • @Chemical_Logic

    @Chemical_Logic

    Жыл бұрын

    Your video is fantastic and helpful . Do you have video to delete snapshot automatically based on tagging information example "Delete" - "2023-05-01" the snapshot should delete on the date I set l.

  • @TinyTechnicalTutorials

    @TinyTechnicalTutorials

    Жыл бұрын

    Thanks for watching, Perfect_Circle! 😊 I don't have a video about this, but you probably want to check out Data Lifecycle Manager: docs.aws.amazon.com/AWSEC2/latest/UserGuide/snapshot-ami-policy.html. That will let you set up retention policies based on age or count. Hope that helps!

  • @TinyTechnicalTutorials

    @TinyTechnicalTutorials

    Жыл бұрын

    Ha! I'll add it! 😁

  • @TinyTechnicalTutorials

    @TinyTechnicalTutorials

    Жыл бұрын

    Oh, that's so awesome!!! Good luck on the exam! 😎🙌💪

  • @akashshirsekar2357

    @akashshirsekar2357

    8 ай бұрын

    deep dive on cloud formation, i have watched your cloud formation for beginner video. wanted to explore more

  • @lotto0901
    @lotto09016 ай бұрын

    Thank you very much for the tutorial! your instructions are straight forward and easy to follow along!

  • @TinyTechnicalTutorials

    @TinyTechnicalTutorials

    6 ай бұрын

    Yay! I'm so glad it helped. Thanks for watching! 🤓🌟🙏

  • @joedolister601
    @joedolister601 Жыл бұрын

    Awesome - Super Clear and simple explanation! Great Job - you are are saving me hours ;)

  • @TinyTechnicalTutorials

    @TinyTechnicalTutorials

    Жыл бұрын

    Oh, that's awesome!! So glad it helped. Thanks for watching! 😊

  • @mikedqin
    @mikedqin4 ай бұрын

    Very clear instructions on how-to. Thank you so much.

  • @TinyTechnicalTutorials

    @TinyTechnicalTutorials

    4 ай бұрын

    Yay! I'm so glad it helped. Thanks for watching! 🙏🤓🌟

  • @mikedqin

    @mikedqin

    4 ай бұрын

    @@TinyTechnicalTutorials Thank you for your quick response. Do you have a preferred social media platform to connect? I have some ideas about technical content creation, and would like to share. Thanks again.

  • @TinyTechnicalTutorials

    @TinyTechnicalTutorials

    4 ай бұрын

    Hey Mike! 👋 Feel free to drop me an email at info@tinytechnicaltutorials.com. 😊

  • @akashshirsekar2357
    @akashshirsekar23578 ай бұрын

    simple and clean

  • @TinyTechnicalTutorials

    @TinyTechnicalTutorials

    8 ай бұрын

    Yay! Glad it helped! 🌟🎉😎

  • @shawnlamey6643
    @shawnlamey66439 ай бұрын

    Great tutorial! I had a couple questions if you don't mind :) 1) How to schedule a RDS instance? You mention that you can use this solution. What would be different here? Is it just a matter of placing a tag of the schedule on the RDS instance? 2) How does this solution compare to creating a Maintenance Window in AWS Systems Manager on the EC2 instances(s)? Thank you for your time!

  • @TinyTechnicalTutorials

    @TinyTechnicalTutorials

    9 ай бұрын

    Hi Shawn! 👋 1) I haven't tried this with an RDS instance yet, but as far as I know, yes, you'd just need to tag the instance, just like you would a "regular" EC2 instance. I don't see anything in the documentation about needing to do anything special for RDS. 2) Instance Scheduler will work with SSM Maintenance windows (but only for EC2 instances, not RDS), to start and stop instances for the window. There's a field for that in the schedule: docs.aws.amazon.com/solutions/latest/instance-scheduler-on-aws/schedules.html#ssm-maintenance-window-field Hope that helps! Thanks for watching! 🌟😊🙏

  • @jimmyli4503
    @jimmyli45033 ай бұрын

    wonderful tutorial thank you! amazon documentation can be very dense and hard to understand what the important bits are

  • @TinyTechnicalTutorials

    @TinyTechnicalTutorials

    3 ай бұрын

    Glad it was helpful! Thanks for watching!! 🙏🤓🌟

  • @2u841r
    @2u841rАй бұрын

    thank you

  • @TinyTechnicalTutorials

    @TinyTechnicalTutorials

    Ай бұрын

    Yay! Thanks for watching! 🙏🌟🤓

  • @QuicheAim
    @QuicheAim Жыл бұрын

    Great tutorial! If I wanted to just set a time to shut of an instance and not have it automatically start, then would that simply be done by excluding a "begintime" keypair in the schedule item?

  • @TinyTechnicalTutorials

    @TinyTechnicalTutorials

    Жыл бұрын

    Thanks, @QuicheAim! 😊 I haven't tried that scenario myself, but it seems like excluding "begintime" would do the trick. Let me know if it works!

  • @sankettilekar8650

    @sankettilekar8650

    Жыл бұрын

    I think you can use alarm facility with ec2 to automatically shut down instance.

  • @stayhappy1167
    @stayhappy116711 ай бұрын

    GOOD VIDEO

  • @TinyTechnicalTutorials

    @TinyTechnicalTutorials

    11 ай бұрын

    Thanks for watching! 😊🌟🙏

  • @muhammadumar-lw9fg
    @muhammadumar-lw9fg2 ай бұрын

    If I attach same schedule and period to 4-EC2 instances and 2RDS instance, how will AWS charge for instance schedule service ?

  • @joyebot7371
    @joyebot7371 Жыл бұрын

    Thank you!!!!!!!!!!

  • @TinyTechnicalTutorials

    @TinyTechnicalTutorials

    Жыл бұрын

    For sure! Thanks for watching! 😊

  • @rashanjones6192
    @rashanjones61929 ай бұрын

    Great video! Can there be a second tag added for a patching schedule? For example, I want all of my machines to shutdown at 5pm Monday-Friday, but on the last Saturday of the month, I want them all on for patching. How would something like that work? Thank you.

  • @TinyTechnicalTutorials

    @TinyTechnicalTutorials

    9 ай бұрын

    Hi Rashan! 👋 Sorry for the slow response! I haven't tried that scenario myself, but it *should* be possible. You can have multiple periods in a schedule, and there are also fields for "days of the week" and "days of the month" that seem suited to a "last Saturday of the month" situation. You'll probably have to experiment a bit to get it just right, but here's the documentation if you need it: docs.aws.amazon.com/solutions/latest/instance-scheduler-on-aws/period-rules.html

  • @rashanjones6192

    @rashanjones6192

    9 ай бұрын

    @@TinyTechnicalTutorials Thank you for your response. I will go through the documentation and give it a try. I'm currently using System Manager Maintenance Windows with run commands/automation documents to handle the start/stop, but I'm curious to give this alternative a try. Thank you again.

  • @TinyTechnicalTutorials

    @TinyTechnicalTutorials

    9 ай бұрын

    You bet! Feel free to report back here with a solution...it might help someone else! 🤓

  • @qx4df
    @qx4df Жыл бұрын

    can you please make a video on AWS Pilot Light and like disaster recovery and things related to it

  • @TinyTechnicalTutorials

    @TinyTechnicalTutorials

    Жыл бұрын

    Hi @qx4df! 😊 I'll add this to my list for future videos. Thanks for the suggestion!

  • @saijeswanth6673
    @saijeswanth66738 ай бұрын

    @TinyTechnicalTutorials Is there Textbook Link for the AWS. Please share the link if possible.

  • @TinyTechnicalTutorials

    @TinyTechnicalTutorials

    8 ай бұрын

    Hi Sai! 👋 I haven't used books for AWS in a long time, as I find they get out of date quickly. But you can find all sorts of them on Amazon, from general overviews to specific services: www.amazon.com/s?k=amazon+web+services&crid=3PD1FWTAW2WW6&sprefix=amazon+web+service%2Caps%2C152&ref=nb_sb_noss_1.

  • @AngeloCarlotto
    @AngeloCarlotto Жыл бұрын

    🎉🎉 awesome

  • @TinyTechnicalTutorials

    @TinyTechnicalTutorials

    Жыл бұрын

    Thank you, Angelo! 😊

  • @bobhassanster
    @bobhassanster Жыл бұрын

    Could you do oracle services too they really interesting.

  • @TinyTechnicalTutorials

    @TinyTechnicalTutorials

    Жыл бұрын

    Hi bobhassanster! 😊 My Oracle skills are fairly limited, but I'll add this to my list of ideas for future videos. Thanks for watching! 🙏

  • @Vinod_Kumar827
    @Vinod_Kumar82711 ай бұрын

    Nice tutorial.....just one query here Lambda is stopping and starting the tagged instance based on Cron given in the DynamoDB table but how frequently or what makes Lambda to poll this cron data from database everytime to ensure that the timing is correct to take an action on tagged instance?

  • @TinyTechnicalTutorials

    @TinyTechnicalTutorials

    11 ай бұрын

    Hi Vinod! It's actually a CloudWatch event that invokes the Lambda function at the defined interval. You can check out more on "Step 1" here under the "Technical details" section: aws.amazon.com/solutions/implementations/instance-scheduler-on-aws/ Hope that helps! Thanks for watching! 😊🙏

  • @Vinod_Kumar827

    @Vinod_Kumar827

    11 ай бұрын

    @@TinyTechnicalTutorials Thanks, that makes sense..... can I also put it this way that without this Instance Schedular, a lot of things like setting up Lambda, and CloudWatch Event we were supposed to do it manually and now with Instance Schedular and with its CloudFormation script, it is all automated. Now DynamoDB is storing the cron data whereas in the traditional way, we had to manually configure the cron at the CloudWatch/EventBridge level?

  • @TinyTechnicalTutorials

    @TinyTechnicalTutorials

    11 ай бұрын

    I think that's a fair summary. It was possible to do all of this manually before, but with this solution, things are automated/magically set up for you. 🤓

  • @Vinod_Kumar827

    @Vinod_Kumar827

    11 ай бұрын

    @@TinyTechnicalTutorials I was architecting a similar solution using the old traditional approach for one of my use cases for my company and suddenly yours video tutorial on KZread popped up for me which really gave me some great idea. Thank you, I really appreciate your efforts. Keep up with good work.

  • @TinyTechnicalTutorials

    @TinyTechnicalTutorials

    11 ай бұрын

    Awesome! Thanks for the support! 🙏😊

  • @Ahshawky01
    @Ahshawky012 ай бұрын

    which is the better Instance Scheduler on AWS or EventBridge and lambda function ?

  • @TinyTechnicalTutorials

    @TinyTechnicalTutorials

    2 ай бұрын

    Hi Ahmed! 👋 I'd say the answer is "it depends." 😊 AWS Instance scheduler is the simpler way to go (it's easy to set up, you don't have to write code...), but if you need more control and have complex scheduling logic, etc., then EventBridge/Lambda would be the way to go.

  • @DavidFerenc-ul2gj
    @DavidFerenc-ul2gj3 ай бұрын

    Hi, unfortunatelly when i create Stack just like you showed in the video, it does not create any tables in DynamoDB. It hase been more than an hour since creating the stack and it says ConfigTable CREATE_COMPLETE. Would you have any advice on how to continue? Thank you. I am reffering to 6:50

  • @TinyTechnicalTutorials

    @TinyTechnicalTutorials

    3 ай бұрын

    Hey David! 👋 Sorry for the slow reply. Were you able to sort this out? Wondering if it was a permissions problem?

  • @naren06938
    @naren06938 Жыл бұрын

    I want to practice this, but u haven't created table items from scratch and not given its csv file in description also....

  • @TinyTechnicalTutorials

    @TinyTechnicalTutorials

    Жыл бұрын

    Hi Narendra! 😊 The table items get created by deploying the CloudFormation template.

  • @felipecardoso229
    @felipecardoso22911 ай бұрын

    Where can I found another timezones rather than the US/Pacif? in my case if someone know, it from Brasil Sao Paulo or Brasilia..

  • @TinyTechnicalTutorials

    @TinyTechnicalTutorials

    11 ай бұрын

    Hi Felipe! 😊 I can't find an official list of zones for AWS Instance Scheduler, but found a good list for Athena. Perhaps these are universally used in all AWS services? docs.aws.amazon.com/athena/latest/ug/athena-supported-time-zones.html

  • @sushantsanu
    @sushantsanu5 ай бұрын

    Can I use it for shutdown purpose only? If yes then how please suugest.

  • @TinyTechnicalTutorials

    @TinyTechnicalTutorials

    5 ай бұрын

    Hi Sushant! 👋 Yes, you can use this for shutdown only (you don't have to use it for starting too). This tutorial is probably a little bit out of date, but it should have the right values you need in the database and such: www.pluralsight.com/cloud-guru/labs/aws/use-aws-instance-scheduler-to-shut-down-an-ec2-instance. Hope that helps! 🌟😊

  • @allenthemartian
    @allenthemartian8 ай бұрын

    @TinyTechnicalTutorials I have launched an EC2 insatnce from Mumbai Region set the timezones at every step to 'Asia/Kolkata' but the instance is not shutting down as expected. Instance is not encrypted.

  • @TinyTechnicalTutorials

    @TinyTechnicalTutorials

    8 ай бұрын

    Hey Allen! 👋 Were you able to sort this out?

  • @allenthemartian

    @allenthemartian

    8 ай бұрын

    ​@@TinyTechnicalTutorials Yes I was. If I wanted the instance to shut down at a particular time. The 'Begin Time' should be before my current time. Same with starting up, the 'Begin Time' should be before my current time. It'll still work even if you don't do this, but it will execute the schedule on the following day. (P.S. This is purely for testing purposes.) Thank you for the wonderful and clear tutorial.

  • @TinyTechnicalTutorials

    @TinyTechnicalTutorials

    8 ай бұрын

    Awwww...gotcha!! Thanks so much for the update. Good to know, and I'm sure it'll help someone else too! 👍🤓

  • @kotreshbm3563
    @kotreshbm356310 ай бұрын

    Hi, i want to automate my instance to schedule on and off on weekends. But the challenge is if the instance is using on Friday and Saturday it will automatically on. Can you please help me on this?

  • @TinyTechnicalTutorials

    @TinyTechnicalTutorials

    10 ай бұрын

    Hi Kotresh! 👋 Can you clarify the "on and off on weekends"? When did you want to turn the instances off and then back on?

  • @kotreshbm3563

    @kotreshbm3563

    10 ай бұрын

    @@TinyTechnicalTutorials I want to off unused instance on weekends like Saturday and Sunday. Again if any instance is used on weekends the instance should be on automatically

  • @pritishparihar6752

    @pritishparihar6752

    Ай бұрын

    ​@@kotreshbm3563Your issue seems interesting, any update on it?

  • @caiyu538
    @caiyu538 Жыл бұрын

    Great

  • @TinyTechnicalTutorials

    @TinyTechnicalTutorials

    Жыл бұрын

    Thanks for watching! 😊

  • @AroundDubai
    @AroundDubai10 ай бұрын

    You are a life server. Still there are some confusion in the time zone but it's manageable.

  • @TinyTechnicalTutorials

    @TinyTechnicalTutorials

    10 ай бұрын

    Great! I'm glad it helped! 😎🙏🌟

  • @AroundDubai

    @AroundDubai

    10 ай бұрын

    @@TinyTechnicalTutorials Can you please do detailed guide on setting up VPN client to access AWS resources ?

  • @TinyTechnicalTutorials

    @TinyTechnicalTutorials

    10 ай бұрын

    Ooh, great suggestion! I'll add this to my list for future videos. Thanks for this! 🤓🙏

  • @soportetecnologiaocsystem1933
    @soportetecnologiaocsystem1933 Жыл бұрын

    thanyouuuuuuuuuuu!!!!! 🤩

  • @TinyTechnicalTutorials

    @TinyTechnicalTutorials

    Жыл бұрын

    Thank YOUUUUUUU! 😂

  • @soportetecnologiaocsystem1933

    @soportetecnologiaocsystem1933

    Жыл бұрын

    @@TinyTechnicalTutorials Asi es!! Gracias me sirvio mucho tu video!!

  • @TinyTechnicalTutorials

    @TinyTechnicalTutorials

    Жыл бұрын

    De nada!

  • @dheerajtyagi9472
    @dheerajtyagi94725 ай бұрын

    any free solution like have in azure ?

  • @TinyTechnicalTutorials

    @TinyTechnicalTutorials

    5 ай бұрын

    AWS has a Free Tier that covers a lot of the core services for the 12 months of your account. You can find more details here: aws.amazon.com/free/. Hope that helps. Thanks for watching! 🤓🙏🌟

  • @enochasante2284
    @enochasante2284 Жыл бұрын

    I followed it but its not working

  • @enochasante2284

    @enochasante2284

    Жыл бұрын

    what time zone should I be using. UTC, world clock or normal time???

  • @TinyTechnicalTutorials

    @TinyTechnicalTutorials

    Жыл бұрын

    Sorry to hear that! Which part isn't working?

  • @enochasante2284

    @enochasante2284

    Жыл бұрын

    @@TinyTechnicalTutorials found out why the instance is encrypted

  • @TinyTechnicalTutorials

    @TinyTechnicalTutorials

    Жыл бұрын

    Oooooh, interesting!!! I haven't tried it on an encrypted instance before. Thanks for posting this...hopefully it helps someone else! 😊

  • @9841554468
    @98415544685 ай бұрын

    Upon revisiting to provide further feedback, I encountered significant confusion while following your video instructions, particularly on two aspects: Time Zone configuration. Settings within the Config Table on DynamoDB. I found myself needing to watch another KZreadr's highly detailed video to resolve the time zone setup issue, as the scheduler wasn't functioning properly. Nevertheless, I eventually managed to address it. Regarding the Config Table modifications in DynamoDB, a crucial point to note is the hierarchy of parameters. There are three types: config, schedule, and period. When schedule applies to the instances, the scheduler first seeks the schedule tag on the Config Table. Initially, it looks for the schedule; hence, it's imperative to have the same parameters in the periods section of the schedule to identify the period type, as the scheduler targets it next. Within the period type, you establish the start and end times before configuring the time zone. It's crucial to ensure that the time zone configuration matches across both the config and schedule. Additionally, it's essential to note that the Scheduler and Instances must be in the same region-whether it's N. Virginia, Ohio, N. California, etc.-to ensure proper functionality; otherwise, it won't work as intended. Appreciate for the contents, it was huge help to configure my server's schedule.

  • @TinyTechnicalTutorials

    @TinyTechnicalTutorials

    4 ай бұрын

    Thanks for taking the time to post this, @b4anjan! Much appreciated, and I'm sure it'll help someone else too! 🙏🤓🌟

  • @Guitar-Geek
    @Guitar-Geek10 ай бұрын

    why?? in the name of the all gods which humanity created, why the hacking god damn name of satan it is soooooo difficult in comparison of Azure???

  • @TinyTechnicalTutorials

    @TinyTechnicalTutorials

    10 ай бұрын

    LOL! Tell me how you really feel! 😂

  • @saychaan7438
    @saychaan74386 ай бұрын

    may i know ur insta id mam

  • @TinyTechnicalTutorials

    @TinyTechnicalTutorials

    6 ай бұрын

    I'm only here on KZread. 😊

  • @9841554468
    @98415544685 ай бұрын

    Apart from education, your voice is very sexy, it gives the vibe to stay connected, kind of sound makes your stay.

  • @TinyTechnicalTutorials

    @TinyTechnicalTutorials

    5 ай бұрын

    Ha! 😂 I'm so glad!! Thanks for watching! 🙏🤓🌟

Келесі