how to create a security group with dynamic IP address on amazon web service

Question:

i need to run an instance and access with my ip address..but the problem is that myISP changes my IP adress every day.plz help me how do i create a security group so that my instance remains accessible even if my ip changes….

thanks in advance..

Answer:

Here’s a way to restrict AWS security group to your dynamic IP address for SSH.

You can write a cronjob to regularly repeat the steps below:

  1. Fetch external IP address (e.g. http://checkip.amazonaws.com/)
  2. Fetch security group details using AWS SDK
  3. Loop through all security rules, check for port 22
  4. If IP address mismatches that from step 1, update it.

Leave a Reply