Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
coolbeevip committed Nov 9, 2023
1 parent a695476 commit 3ef160e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# AWS Lightsail instance public network IP inspection
# Amazon Lightsail instance public network IP inspection

Detect and automatically switch static IPs for instances.
* 🚀 Initialize an Amazon Lightsail instance.
* 😎 Procure a static IP and link it with the corresponding instance.
* 🎯 Register a distinct domain name and delegate subdomains to direct traffic towards your Lightsail assets.
* 🎉 You are now able to access your assets via the registered domain name.

🔍 This application consistently conducts active surveillance on the specified port of the instance. 🚫If access is obstructed, it will renew the static IP of the instance ⚡ and update the domain name record 🔄.

## Environment

Expand All @@ -11,6 +16,8 @@ AWS_ACCESS_KEY_ID=<your aws access key id>
AWS_SECRET_ACCESS_KEY=<your aws secret access key>
REGION_NAME=<region of instance>
LIGHTSAIL_INSTANCE_NAME=<instance name>
LIGHTSAIL_INSTANCE_PORT=<port for inspection>
DOMAIN_ENTRY_NAME=<your domain>
```

## Usage
Expand Down
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def job_wrapper():


if __name__ == '__main__':
schedule.every(5).minutes.do(job_wrapper)
schedule.every(1).minutes.do(job_wrapper)

while True:
schedule.run_pending()
Expand Down
2 changes: 1 addition & 1 deletion src/aws_lightsail_guard/guard.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Guard:
def lightsail_instance_public_ip_keepalive(self, name):
instance = lightsail.get_instance(instanceName=name)['instance']
# TODO 此处应该检查域名
if check_address(instance['publicIpAddress'], 443):
if check_address(instance['publicIpAddress'], int(os.environ['LIGHTSAIL_INSTANCE_PORT'])):
logging.info(
f"Instance {instance['name']} public static ip {instance['publicIpAddress']} OK")
else:
Expand Down

0 comments on commit 3ef160e

Please sign in to comment.