Looking for safe AWS Elastic IP? This may help…

Roskomnadzor are relentless in their pursuit of Telegram. It appears they’ve caused a number of collateral damage as a consequence.

Bleepingcomputer.com has a list of hilarious Tweets 😉

Anyway, we are here to figure out which addresses are, at least for the moment, safe to use.

For this, we will need our usual tools – an IAM user with programmatic access and PowerShell console. Linux or Windows.

First, let’s figure out blocked ranges. Quite a few of them, actually, but according to the latest information we have these:

This translates to the following:

Now let’s try to grab an address for our region:

And see if is included in any of the blocked ranges we are aware of:

If it is blocked, let’s set the $Blocked flag and break out of the cycle.

We need a new address now. But first, let’s remove the old one so we don’t hit the limit of allowed Elastic IP addresses. Or get hit by a larger bill at the end of the month if our limit is high and we start hoarding IPv4 addresses 🙂

OK. That takes care of the removal. Now we need a new one. So what do we do?

Start with a false $Success flag and set it to true when we finally find a safe EIP. Keep looping until it’s true.

Something like this:

If blocked, release and retry. If safe, confirm success and exit.

Pretty simple, huh? Hope you liked it! 🙂

Get the code (and any future updates) from GitHub: https://github.com/PowerSix/MyPowerShellSpace

Keep in mind that blog posts are NOT getting updated! Look for script updates on GitHub!

Full code:

Leave a Comment