This script detects changes in your external IP and uses AWS boto library to update the ports in a specific security group for your AWS controller.
The script will remove ALL entries in a single security group and update them with your external IP and port mappings.
Make sure that you have a single security group that contains all the port mappings needed. I.e.
{ 'protocol': 'udp', 'port': 10001 },
{ 'protocol': 'udp', 'port': 3478 },
{ 'protocol': 'tcp', 'port': 8080 },
{ 'protocol': 'tcp', 'port': 8443 },
{ 'protocol': 'tcp', 'port': 6789 },
{ 'protocol': 'tcp', 'port': 8880 }
The script relies on a single security group.
You should generally setup a venv for this script but you can run it however you like.
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
Once the requirements are installed you'll need to configure the boto3 library. https://boto3.amazonaws.com/v1/documentation/api/latest/guide/quickstart.html
Basically you need to set up your programmatic access to your AWS account via an access/secret key combo.
Follow AWS's advice.
Copy the settings.json.template to settings.json and update the security group ID and file path accordingly.
You can now run python aws.py
and you should see it update your security group accordingly.