Reputation: 107
I have to update the content in resolv.conf based upon the region selection through cloudformation template.
Example nameserver 0.0.0.0
the above content need to add in resolv.conf based upon region If I will select US then the nameserver will be different and if it is EU then it will be different
I need how to write this condition in cloudformation template.
Please help me in this.
Thanks
Upvotes: 0
Views: 123
Reputation: 58
My suggestion would be to put it in the userdata and put a mapping to map the appropriate region to nameserver. Something like
UserData:
Fn::Base64: !Sub
- |
#!/bin/bash
nameserver=${nameserver}
echo "nameserver $nameserver" >> /etc/resolvconf/resolv.conf.d/base
- nameserver: !FindInMap
- RegionMap
- !Ref "AWS::Region"
- nameserver
You will need to declare a RegionMap in mappings to map each region with the appropriate nameserver.
Upvotes: 1