Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

example code to do manual dns failover #112

Open
puppet-py opened this issue Mar 5, 2023 · 2 comments
Open

example code to do manual dns failover #112

puppet-py opened this issue Mar 5, 2023 · 2 comments

Comments

@puppet-py
Copy link

puppet-py commented Mar 5, 2023

can someone please point me to any reference/example code as I want to programaticaly(using NS1 python SDK) want to achieve manual dns failover

I am referring to this section in this this article: https://help.ns1.com/hc/en-us/articles/360020471254
It is also possible to enact failover and failback through the NS1 API if you want to make your own tool (like a command-line script) to quickly trigger failover or failback. One of the easiest ways to do this is to configure an NS1 API data feed for your primary IP, and publish up/down status to the feed with your tools.

@puppet-py
Copy link
Author

puppet-py commented Mar 5, 2023

In this case, two A-records are mapped to one CNAME.

However, I have tried with CNAME > A-record (1:1 mapping)

arecord = api.loadRecord('mydns-region1-.com', 'A')
arecord.update(meta={'up': False})
<Record domain=mydns-region1-.com' type=A>

arecord.data
{'domain': 'mydns-region1-.com', 'meta': {'up': False}, 'filters': [], 'ttl': 20, 'zone_name': 'mydns.com', 'networks': [0], 'zone': 'mydns.com', 'blocked_tags': [], 'id': '63fe678cfe4eaff09c08a876', 'regions': {}, 'type': 'A', 'use_client_subnet': True, 'tags': {}, 'answers': [{'answer': ['149.60.191.73'], 'id': '44066ce0be892f0084b2f9a5'}], 'link': None, 'tier': 1}

But when I am fetching the record(Api / UI), it does not reflect the above change of status
'meta': {}

@puppet-py
Copy link
Author

puppet-py commented Mar 9, 2023

Any help, much appreciated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant