Solved

how to set dns to allow the settings of TTL

Posted on 2011-09-27
19
490 Views
Last Modified: 2012-05-12
Hi,
I have a small issue regarding dns, I would like a attributes to set TTL's of record.
Thanks.
0
Comment
Question by:lionel3030
  • 10
  • 9
19 Comments
 
LVL 21

Expert Comment

by:Papertrip
ID: 36714618
Setting TTL's for records should be very straight forward.

Which DNS server are you running?
0
 

Author Comment

by:lionel3030
ID: 36714658
Hi Papertrip,
I used Bind
0
 
LVL 21

Expert Comment

by:Papertrip
ID: 36714668
OK cool, I know BIND very well so this should be quick and easy.

Your original question is a bit unclear, what exactly are you trying to do?  Do you need to change the TTL of an existing record?  Do you have questions about TTL in general?  Also, are you using dynamic zones?
0
 

Author Comment

by:lionel3030
ID: 36714686
Ok what i am trying to do is to learn how to set attribute to set the TTLs of records, its on chef for cloud recipes
0
 
LVL 21

Expert Comment

by:Papertrip
ID: 36714697
I'm not familiar with Chef -- do you use that to administer your DNS zones, or do you update them manually?
0
 

Author Comment

by:lionel3030
ID: 36714701
I am trying to get chef to take all credentials for route53 (DNS) attributes from encrypted data bags thus updating the record from there.
0
 
LVL 21

Expert Comment

by:Papertrip
ID: 36714712
Unfortunately I have no experience with Chef.  I did some research on it and I know what it is now, so maybe I can still help you since the underlying server is running BIND.

How are you adding records to DNS via Chef now?  Any information about how you are using Chef + DNS will help a lot.
0
 

Author Comment

by:lionel3030
ID: 36714731
Using the following:
default[:route53][:zone_id] = "ZONE_ID"
default[:route53][:aws_access_key_id] = "KEY"
default[:route53][:aws_secret_access_key] = "SECRET"
So from here I am trying to get all this info in one place and give a attribute to set the TTL's, I have searched around to get this working but for some reason it's beyond me.
Thanks.
0
 

Author Comment

by:lionel3030
ID: 36714736
might be able to use something like # route53 add_record ZONEID db01.mycompanycloud.com CNAME ec2-51-10-11-89.compute-1.amazonaws.com 3600 but not sure it is going to give me exactly what i want.
0
Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

 
LVL 21

Expert Comment

by:Papertrip
ID: 36714753
OK I did some research on route53, and it looks like you are correct in your guess.

route53 add_record ZONEID db01.mycompanycloud.com CNAME ec2-51-10-11-89.compute-1.amazonaws.com 3600

Open in new window

After you run that, you can test at http://tools.whois.net/dig/  -- The 2nd field you see in the ANSWER SECTION is the TTL value of the record.

If this is a new record, you should see the results almost immediately.  If you are updating an existing record, and the DNS server you are querying still has a cached version of the old record, then your TTL changes will not be visible until the old TTL has expired.

Make sense?
0
 

Author Comment

by:lionel3030
ID: 36714770
Yep it does but 1 thing i dont have anything to do to set attributes?
0
 

Author Comment

by:lionel3030
ID: 36714777
maybe this might work as well?
aws_creds = Chef::EncryptedDataBagItem.load("aws", "#{node[:mycompany_vars][:customer_name]}_keys")
0
 
LVL 21

Expert Comment

by:Papertrip
ID: 36714786
Do you mean setting the TTL in these attributes?

default[:route53][:zone_id] = "ZONE_ID"
default[:route53][:aws_access_key_id] = "KEY"
default[:route53][:aws_secret_access_key] = "SECRET"
0
 
LVL 21

Expert Comment

by:Papertrip
ID: 36714796
So that part is getting into how Chef works, which I'm not familiar with.

However, I did find this:

Here's how you add a CNAME record with a TTL of 60 seconds to an existing zone (assuming the 'zone' variable contains the zone you're looking for). You need to operate on the zone ID, which is the identifier following the text '/hostedzone/' in the 'Id' field of the variable 'zone'.

from boto.route53.record import ResourceRecordSets
zone_id = zone['Id'].replace('/hostedzone/', '')
changes = ResourceRecordSets(conn, zone_id)
change = changes.add_change("CREATE", 'test2.%s' % ROUTE53_ZONE_NAME, "CNAME", 60)
change.add_value("some_other_name")
changes.commit()

Does that help with your attribute question?

http://agiletesting.blogspot.com/2011/06/managing-amazon-route-53-dns-with-boto.html
0
 

Author Comment

by:lionel3030
ID: 36714805
I meant to give attribute to set TTL in dns directly, i need to search a bit on your last message, I will update soon.
thanks for your help
0
 
LVL 21

Expert Comment

by:Papertrip
ID: 36714842
0
 
LVL 21

Accepted Solution

by:
Papertrip earned 500 total points
ID: 36714843
Attribute Parameters:

    zone - DNS zone
    name - fully qualified domain name of entry in zone
    type - DNS record type (CNAME, A, etc)
    values - Record values.
    default_ttl - default time to live in seconds
    access_key - dyn username
    secret_key - dyn password

None of the parameters have default values.

Example:

route53_rr "webprod" do
  name       "webprod.#{node.route53.zone}"
  type "A"   values([ "10.1.1.10"])
  ttl        node[:route53][:default_ttl]
  access_key node[:route53][:access_key]
  secret_key node[:route53][:secret_key]
  zone       node[:route53][:zone]
end
0
 

Author Comment

by:lionel3030
ID: 36714880
thanks for all your help i will try to set theses lines into one if possible i will let you know the result.
0
 
LVL 21

Expert Comment

by:Papertrip
ID: 36714886
Awesome good luck!  I think that last link might be exactly what you need.
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
AWS RDS 3 65
Linux tcp ports listening for testing 4 44
High Available Storage based on linux 6 67
Powershell knowledge 2 24
Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

930 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now