A Telegram bot that controls your AWS EC2 server using plain English commands powered by Claude AI on Amazon Bedrock. No SSH, no terminal, just a message.
Send a natural language message to the bot and it will:
- Forward your message to Claude Haiku 4.5 on Amazon Bedrock
- Claude decides what Linux command to run
- AWS Lambda runs the command on EC2 via AWS Systems Manager without SSH or stored keys
- If the command fails, Claude figures out why and tries a different approach
- The loop continues up to 10 iterations until the task is complete
- Claude summarizes the final result in plain English and the bot replies
Progress updates appear live in the chat so you can see what the bot is doing at each step.
Server health check: User: hows my server doing? Bot: Your server is doing great! Uptime 7 days 19 hours, load average 0.07 (very light), memory at 42%, disk at 51%. Everything looks normal and stable.
Web scraping: User: write a python script that fetches https://news.ycombinator.com using requests and prints the titles of the first 5 stories, then run it and tell me the first 5 stories Bot: The bot wrote the script, ran it, and returned live Hacker News headlines including "Xiaomi: New CPU matches Apple cores single threaded" and "MS Paint and Photos invisibly watermark even locally generated output with GUID".
Multi step installation: User: install python selenium on the server system wide Bot: The bot handled PEP 668 restrictions automatically, installed selenium 4.47.0 system wide, verified the installation, and confirmed it is ready to use with import selenium.
- AWS Lambda
- Amazon Bedrock
- Claude Haiku 4.5
- AWS Systems Manager (SSM)
- AWS EC2
- Telegram Bot API
- Python 3.13
Configure these in your Lambda function under Configuration > Environment variables:
| Variable | Description |
|---|---|
| TELEGRAM_BOT_TOKEN | Your Telegram bot token from BotFather |
| INSTANCE_ID | The EC2 instance ID to control |
See docs/setup.md for full step by step setup instructions.
aws-ai-telegram-bot/
├── README.md
├── lambda/
│ └── handler.py
├── architecture/
│ └── diagram.png
└── docs/
└── setup.md
