From 51844e380fe1079008aeb73297e9a60ed955c7be Mon Sep 17 00:00:00 2001 From: David Timber Date: Tue, 9 Jan 2024 22:36:50 +0900 Subject: Patch toss-aws-eip --- toss-aws-eip/README.md | 24 +++++++++++++++++++----- toss-aws-eip/toss-aws-eip.py | 2 +- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/toss-aws-eip/README.md b/toss-aws-eip/README.md index caa0355..1c81eb1 100644 --- a/toss-aws-eip/README.md +++ b/toss-aws-eip/README.md @@ -43,12 +43,13 @@ specified and the script will exit if an address from any of the ranges is allocated. ```bash +# In us-west-1 region, get an EIP with the name "tosser" from the ranges ./toss-aws-eip.py \ - -r us-west-1 \ # not required if the default region is set in the profile - -l "tosser" \ # resource name for identification purposes - 52.94.249.80/28 \ # range - 52.95.255.96/28 \ # range - 52.94.248.128/28 # range + -r us-west-1 \ + -l "tosser" \ + 52.94.249.80/28 \ + 52.95.255.96/28 \ + 52.94.248.128/28 ``` In the example, the script will allocate and release EIP addresses until one @@ -62,6 +63,19 @@ processes that returned 0. Run with `-h` option for more. + +To run it concurrently, use [multitoss.sh](multitoss.sh). Check the quota on +your account to determine the `-p` value. It's usually not that high. + +```sh +multitoss.sh -p3 './toss-aws-eip.py + -r us-west-1 + -l tosser + 52.94.249.80/28 + 52.95.255.96/28 + 52.94.248.128/28' +``` + ## Why? I was having issues with the reputations of IP addresses allocated for EC2. It is a known fact that many EC2 instances are hacked and used as bots for diff --git a/toss-aws-eip/toss-aws-eip.py b/toss-aws-eip/toss-aws-eip.py index 2029ae0..0b2e9cd 100755 --- a/toss-aws-eip/toss-aws-eip.py +++ b/toss-aws-eip/toss-aws-eip.py @@ -258,7 +258,7 @@ def OptInSignalHandler (sname: str, handler: Callable): '''Install the signal handler if the signal with the name exists on the platform.''' if hasattr(signal, sname): - return signal.signal(signal.Signals(sname), handler) + return signal.signal(signal.Signals[sname], handler) def HandleSignal (sn, sf): '''Exit signal handler''' -- cgit