How to dynamically update management IP on DigitalOcean

How to dynamically update management IP on DigitalOcean

Mar 24, 2022 Cloud, Design, Cloud-dev-machine, Digital-Ocean, python


  1. Generate a token for API access: Navigate through API -> Tokens/Keys, click the button Generate New Token

    Give it a name and write permission.

    The key will only show once after confirming the key details, so make a good copy for it

  2. Find firewall for management, or create one if there isn’t one Use the API to list all policies and look for a policy named mgmt in the response that should be similar to the following:

  3. If there’s one, update the policy Use update_firewall to update the policy we found, in which the new policy should be closed to this:

  4. If there isn’t one, create a new policy with create_policy. Its parameters should be the same as in step 3.

  5. Retrive the firewall policy again to confirm the detail.

No notes link to this note

comments powered by Disqus