Updating a resource record
To update a resource record, do the following:
- In the management console
, select the folder containing your DNS zone. - Select Cloud DNS.
- Select the zone from the list.
- Click
next to the resource record you want to update and select Edit. - Change the record TTL or value.
- Click Save.
If you do not have the Yandex Cloud CLI installed yet, install and initialize it.
By default, the CLI uses the folder specified when creating the profile. To change the default folder, use the yc config set folder-id <folder_ID>
command. You can also set a different folder for any specific command using the --folder-name
or --folder-id
parameter.
To update a DNS zone:
-
See the description of the CLI command for updating a resource record:
yc dns zone replace-records --help
-
Change the record value:
yc dns zone replace-records --name <zone_name> \ --record "<domain_name> 600 <record_type> <new_value>"
If you do not have Terraform yet, install it and configure its Yandex Cloud provider.
To update a DNS record created with Terraform:
-
Open the Terraform configuration file and edit the fragment describing your DNS record.
Terraform DNS record description example
... resource "yandex_dns_recordset" "rs1" { zone_id = yandex_dns_zone.zone1.id name = "srv.example.com." type = "A" ttl = 200 data = ["10.1.0.1"] } ...
-
Check the configuration using this command:
-
Apply the changes:
-
In the terminal, go to the directory where you edited the configuration file.
-
Make sure the configuration file is correct using this command:
terraform validate
If the configuration is correct, you will get this message:
Success! The configuration is valid.
-
Run this command:
terraform plan
You will see a detailed list of resources. No changes will be made at this step. Terraform will show any errors found in your configuration.
-
Apply the changes:
terraform apply
-
Type
yes
and press Enter to confirm the changes.
You can verify DNS record changes in the management console
or using this CLI command:yc dns zone list-records <zone_name>
-
To update a DNS resource record, use the updateRecordSets REST API method for the DnsZone resource or the DnsZoneService/UpdateRecordSets gRPC API call.
A TXT record value must be split into 255-character segments (strings) and cannot exceed 1024 characters total.
Note
You cannot modify service resource records.