https://github.com/bigmlcom/area53
Python Interface for AWS Route53
https://github.com/bigmlcom/area53
Last synced: 9 months ago
JSON representation
Python Interface for AWS Route53
- Host: GitHub
- URL: https://github.com/bigmlcom/area53
- Owner: bigmlcom
- License: mit
- Created: 2011-10-29T05:42:21.000Z (about 14 years ago)
- Default Branch: master
- Last Pushed: 2011-10-13T11:53:31.000Z (about 14 years ago)
- Last Synced: 2024-04-16T10:58:59.472Z (over 1 year ago)
- Language: Python
- Homepage: http://www.mariusv.com/python-interface-for-aws-route53/
- Size: 75.2 KB
- Stars: 6
- Watchers: 29
- Forks: 7
- Open Issues: 2
-
Metadata Files:
- Readme: README.markdown
Awesome Lists containing this project
README
# Area53
A python interface for AWS Route53.
* Original Author: Marius Voila
* Website: [http://www.mariusv.com](http://www.mariusv.com)
* Blog Release: [An introduction to Are53](http://www.mariusv.com/python-interface-for-aws-route53/)
## Installation
Run these commands to install:
```bash
git clone git://github.com/mariusv/Area53.git
cd Area53
sudo python setup.py install
```
You also need to set the following environment variables:
```bash
export AWS_ACCESS_KEY_ID=""
export AWS_SECRET_ACCESS_KEY=""
```
## Usage
I wrote this library to make dealing with Amazon's Route53 DNS service a lot easier.
Now you can write code like the following:
```python
>>> from area53 import route53
>>> zone = route53.create_zone('example.com') # Creates the zone, example.com.
>>> zone.add_a('example.com', '182.12.142.12') # Adds A record to the zone.
>>> zone.add_cname('www.example.com', 'example.com') # Adds CNAME record to the zone.
>>> zone.add_mx(['10 mx1.example.com', '20 mx2.example.com']) # Adds MX records to the zone.
```
Now what just happended. On line two we create the zone. Then we create
an A record for the naked domain, followed by a cname for the ‘www’ subdomain
which points back to the naked domain. Then we also added two MX records
for our mail exchangers. Also, you don’t need to worry about trailing dots
and fully qualified domain names, because that is handled automatically.
Now, we can grab a list of all zones like this:
```python
>>> route53.get_zones() # Get all hosted zones.
[, ]
```
Or we can grab our individual zone by name:
```python
>>> zone = route53.get_zone('example.com')
```
You can also look at what records you have in your zone:
```python
>>> for record in zone.get_records():
... print record
...
```
And here is how you grab just the nameservers for your zone:
```python
>>> zone.get_nameservers() # Get nameservers for the zone.
[u'ns-1249.awsdns-28.org.', u'ns-902.awsdns-48.net.']
```
You add the nameservers to your domain
registrar to actually switch to Amazon’s DNS service. I would recommend
migrating a non-critical domain to start to make sure that you understand
the process before moving your big domain with hundreds of records over to Route53.
Now we can remove all these records and the zone itself like so:
```python
>>> zone = route53.get_zone('example.com') # Get the zone.
>>> zone.delete_a('example.com') # Delete A record from the zone.
>>> zone.delete_cname('www.example.com') # Delete CNAME record from the zone.
>>> zone.delete_mx() # Delete MX records from the zone.
>>> zone.delete() # Delete the zone itself.
```
If anyone has any questions, bugs or issues then feel free to ask.
Hopefully, this will make your life with Route53 significantly easier.
## Dependencies
boto - must have at least version 2.0