Powerful AWS Bot for automation using Telegram Bot API written in PowerShell

Sometimes back I was working on a free notification system using Telegram Bot (https://telegram.org/blog/bot-revolution), and I wrote a simple function in PowerShell, which could be use in various ways for sending instant notification to any smartphone for free (http://bit.ly/2ys1gF5).

I thought what else we could do with it, and I have got an idea to use it as AWS Automation Bot to perform simple tasks. I have created a set of instructions for a Bot using PowerShell script which we could use to perform the following tasks instantly instead of doing it from AWS console.

  1. Getting instance details using instance name.
  2. Getting attached volume details using instance name.
  3. Getting list of the available snapshots for a instances using instance name.
  4. Getting the console screenshot for troubleshooting using instance name.
  5. Getting the console log for troubleshooting using instance name.
  6. Start an instance using instance name.
  7. Stop an instance using instance name.
  8. Restart an instance using instance name.

:DEMO:

Note: Start/Stop/Restart option will not be available for all, this Bot will be part of a Telegram Group, and only existing user who already have the permission for this can grant these permission to someone else. This is additional layer security control I have created to avoid unauthorized system state modification.

If you really interested to give it a try, please follow the steps bellow.

  1. Download Telegram on your mobile from marketplace (available on all the platform)
  2. Visit the following link to join the Demo Group.

https://t.me/joinchat/EgSJ8A5EaLx4Yt3IBHESKw
or,

  1. As soon as you are in the group, use /help to get what are the instruction you can give to the bot.
  2. Please provide feedback here.

Tips: Since I am using free AWS environment, I am limited to use 30 GB of volume, so, I have created three AWS Linux instances in three different regions (Sydney/Virginia/Oregon), name of them are TELTSTSYD for Sydney, TELTSTVIR for Virginia and TELTSTORE for Oregon. All the instructions are applicable against instance name, not the instance ID, e.g. /info=TELTSTSYD to know the instance details. Currently there is no snapshot available for any of the instances as it will be beyond my free limit. Always make sure your executing the commands on correct region. Additionally, this demo environment currently available during 8:00 AM AEST to 10:00 PM AEST to avoid unnecessary changes on my Azure Subscription.

Note: This bot is running from my own server hosted on my personal Azure Subscription, also the AWS environment where the demo configured is my personal AWS Account. Only purpose I have created this environment is to demonstrate this feature and usability of this bot and the automation process.

If you are interested further, then please do let me know here in the comments, I will share my code and configuration details if I see the demand.

UPDATE 1: Added a new video demo.
UPDATE 2: This project now open source, and available under GitHub : https://github.com/iAmSaugata/TelegramBotForAWS

Sorry, there are no polls available at the moment.

Disclaimer: All posts and opinions on this site are provided AS IS with no warranties. These are our own personal opinions and do not represent our employer’s view in any way.

This article currently have 11,244 views

Saugata
Follow me

CC BY-ND 4.0 This work is licensed under a Creative Commons Attribution-NoDerivatives 4.0 International License.

3 comments

  1. Looks really cool man, why don’t you make it open source,
    I thinks I’d use it right away but also maybe contribute if realize something to make it better

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.