https://github.com/nopp/telegram-bot-ec2
Telegram Bot for EC2
https://github.com/nopp/telegram-bot-ec2
aws ec2 telegram telegram-bot
Last synced: about 1 month ago
JSON representation
Telegram Bot for EC2
- Host: GitHub
- URL: https://github.com/nopp/telegram-bot-ec2
- Owner: nopp
- Created: 2018-01-27T16:48:13.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2020-06-09T18:40:23.000Z (about 6 years ago)
- Last Synced: 2025-10-06T00:31:48.439Z (9 months ago)
- Topics: aws, ec2, telegram, telegram-bot
- Language: Python
- Homepage:
- Size: 14.6 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Telegram Bot for EC2

This bot have two actions: start/stop EC2 instance, basically the script will check on mysql database if user have permission to stop/start a specific instance.
* Import schema.sql on MySQL.
* Create a bot token on Telegram.
## INSTALL
* git clone https://github.com/nopp/telegram-bot-ec2.git
* cd telegram-bot-ec2
* pip install -r requirements.txt
Example: We'll allow email user@teste.com with 123456 password to start/stop an instance i-1212121212121.
Create an user on user table
============================
* INSERT INTO user VALUES ('user@teste.com',MD5('123456'))
Create "link" between idUser and idInstance
===========================================
* SELECT id FROM user WHERE email = 'user@test.com'
* 1
* INSERT INTO resource VALUES ('1','i-1212121212121')
RUNNING BOT
===========
# python ec2bot.py telegramToken ec2Region accessKey secretKey mysqlHost mysqlUser mysqlPassword mysqlDB
RUNNING ON DOCKER
=================
# docker container run -d -e token='xxx' -e region='xxx' -e akey='accessKey' -e skey='secretKey' -e mysqlHost='xxx' -e mysqlUser='xxx' -e mysqlPassword='xxx' -e mysqlDB='xxx' nopp/telegram-bot-ec2:latest
SCREENSHOT
==========
