Getting started with Cloud DNS
Create DNS zones, add A
records for your test VMs to them, and test the availability of domain names.
Getting started
-
Log in or sign up to the management console
. If not signed up yet, navigate to the management console and follow the instructions. -
On the Billing
page, make sure you have a billing account linked and it has theACTIVE
orTRIAL_ACTIVE
status. If you do not have a billing account yet, create one. -
If you do not have a folder yet, create one. While creating a folder, you can also create a default virtual network with subnets in all availability zones.
-
Create a network and subnets to connect your test VMs.
-
Create VMs named
test-vm-1
andtest-vm-2
in theru-central1-a
availability zone. Make sure thattest-vm-1
has a public IP address. Connect them to subnets of the same network.
Create a private DNS zone
Domain zones store resource records.
Create a new domain zone:
- Open the Cloud DNS section of the folder where you need to create a DNS zone.
- Click Create zone.
- Specify the zone settings:
- Zone:
testing
. - Type:
Internal
. - Name:
test-zone
. - Networks: Network where your VMs reside.
- Zone:
- Click Create.
Run this command:
yc dns zone create --name test-zone \
--zone testing. \
--private-visibility network-ids=<network_ID>
Where --private-visibility
is the ID of the network with your test VMs.
Add resource records to the internal zone
- Open the list of zones and select the zone named
test-zone
. - Select Records in the menu on the left.
- Click Create record. Set the record parameters:
- Name:
test-vm-1
- Type:
A
- TTL (in seconds):
600
- Data: Internal IP address of
test-vm1
- Name:
- Click Create.
- Click Create record once again. Set the parameters for another record:
- Name:
test-vm-2
- Type:
A
- TTL (in seconds):
600
- Data: Internal IP address of
test-vm2
- Click Create.
- Name:
Run the following commands:
yc dns zone add-records --name test-zone \
--record "test-vm-1 600 A <VM_internal_IP_address>"
Where --record
is the record containing the internal IP address of test-vm-1
.
yc dns zone add-records --name test-zone \
--record "test-vm-2 600 A <VM_internal_IP_address>"
Where --record
is the record containing the internal IP address of test-vm-2
.
Test the availability of domain names in the internal zone
Connect to test-vm-1
over SSH:
ssh <VM_public_IP_address>
On your VM, try accessing test-vm-2
by its domain name:
host test-vm-2.testing.
Make sure that the IP address of the appropriate VM is returned in response:
host test-vm-2.testing.
test-vm-2.testing has address 10.0.0.9
Create a public DNS zone
If you have a registered domain name, you can create a public domain zone and add a record to it. In this case, we will use example.com
as the domain name.
Create a new public domain zone:
- Open the Cloud DNS section of the folder where you need to create a DNS zone.
- Click Create zone.
- Specify the zone settings:
- Zone:
example.com.
- Type:
Public
- Name:
test-public-zone
- Zone:
- Click Create.
Run this command:
yc dns zone create --name test-public-zone \
--zone example.com. \
--public-visibility
Add resource records to the public zone
- Open the list of zones and select the
test-public-zone
zone. - Select Records in the menu on the left.
- Click Create record. Set the record parameters:
- Name:
www
- Type:
A
- TTL (in seconds):
600
- Data: Public IP address of
test-vm-1
- Name:
- Click Create.
Run this command:
yc dns zone add-records --name test-public-zone \
--record "www 600 A <VM_public_IP_address>"
Where --record
is the record containing the public IP address of test-vm-1
.
Delegate your domain name by specifying the addresses of ns1.yandexcloud.net.
and ns2.yandexcloud.net.
Yandex Cloud name servers at your registrar.
Test the availability of domain names in the public zone
Make sure that the created record points to the VM's public IP address. Run the following command on your computer:
host www.example.com ns1.yandexcloud.net.
Result:
Using domain server:
Name: ns1.yandexcloud.net.
Address: 84.201.185.208#53
Aliases:
www.example.com has address <public_IP_address_of_test-vm-1>