InfoMinfo. Idea of this small project come from daily get electricity price from "https://www.ote-cr.cz/". To realise this idea i used AWS, TF, Ansible, Python.
Plan of action:
- Write python program for scraping daily prices for electricity. Used libraries exported to requirements.txt.
- Telegram bot for sending results of scraped info to InfoMinfo channel.
- TF: create AWS(ec2_ins, sg, CloudWatch, IAM_role+policy, Lamda_python_func)
- Ansible: configure ec2_ins after deploying
How it works. By default CloudWatch runs 2 scheduler at 08:00 UTC (start) and 09:00 UTC (stop). Invokes lambda-function which depending on "Event pattern" starts or stops instances with filtered tags. Onces instance starts cronjob executes python script which sends info to telegram channel.
How to use. First clone the repo. There are "aws_tf/" & "ansible/" folders.
-
"aws_tf/" for deploying all required resources on AWS:
- terrafomr init
- terraform plan
- terraform apply
-
"ansible/" for configuring after deployment:
- ansible-playbook host-conf.yml -i hosts --private-key $(PRIVATE_KEY)