- AWS CLI is installed
- AWS CLI profile is configured and the profile you are using is named
blitz
as it will be referenced throughout with--profile
- Valid AWS key pair
- Valid AWS ID and access key
aws ec2 create-security-group --group-name DnsServer --description "Simple DNS Server" --profile blitz
aws ec2 authorize-security-group-ingress --group-name DnsServer --protocol udp --port 53 --cidr 0.0.0.0/0 --profile blitz
aws ec2 authorize-security-group-ingress --group-name DnsServer --protocol tcp --port 22 --cidr 0.0.0.0/0 --profile blitz
DnsServer
is arbitrary but will be referenced moving foward.
aws ec2 run-instances --image-id ami-a49665cc --security-groups DnsServer --instance-type t1.micro --region us-east-1 --key blitz --profile blitz
ami-a49665cc
is an Ubuntu AMI available only in theus-east-1
region. Another image and region can be used.--key
references the EC2 key pair.DnsServer
is the previously created security group
aws ec2 describe-instances --profile blitz
- Search for
DnsServer
or the name of your security group and copy the corresponding hostname. It should look likeec2-x-x-x-x.compute-x.amazonaws.com
.
ssh -i ~/.ssh/blitz.pem [email protected]
- Replace
ec2-x-x-x-x.compute-x.amazonaws.com
with hostname from above.
sudo su -
apt-get update
tasksel install dns-server
vi /etc/bind/named.conf.local
Append the following content...
zone "foobar.com" {
type master;
file "/etc/bind/db.foobar.com";
};
cp /etc/bind/db.local /etc/bind/db.foobar.com
vi /etc/bind/db.foobar.com
Example ...
$TTL 604800
@ IN SOA ec2-x-x-x-x.compute-x.amazonaws.com. root.foobar.com. (
3 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS ec2-x-x-x-x.compute-x.amazonaws.com.
@ IN A 1.2.3.4
@ IN AAAA ::1
www IN A 1.2.3.4
store IN A 1.2.3.4
1.2.3.4
should be the IP of your soon to be production serverec2-x-x-x-x.compute-x.amazonaws.com
should be the hostname from above
service bind9 restart