Updating a resource record
You can update the value of a resource record. To update a record:
- In the management console, select a folder to modify the DNS zone record in.
- Select Cloud DNS.
- Select the zone from the list.
- Click
- Change the record's TTL or value.
- Click Save.
If you don't have the Yandex Cloud command line interface yet, install and initialize it.
The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name
or --folder-id
parameter.
To update a DNS zone:
-
View a description of the CLI update record command:
yc dns zone replace-records --help
-
Change the record value:
yc dns zone replace-records --name <zone name> \ --record "<record domain name> 600 <record type> <new record value>"
For more information about the Terraform, see the documentation.
To update a DNS record created using Terraform:
-
Open the Terraform configuration file and edit the fragment with the DNS record description.
Example DNS record description in the Terraform configuration... 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 the command:
terraform validate
If the configuration is correct, the following message is returned:
Success! The configuration is valid.
-
Run the command:
terraform plan
The terminal will display a list of resources with parameters. No changes are made at this step. If the configuration contains errors, Terraform will point them out.
-
Apply the configuration changes:
terraform apply
-
Confirm the changes: type
yes
into the terminal and press Enter.You can verify that the DNS record has been updated in the management console or using the CLI command below:
yc dns zone list-records <DNS zone name>
The value of resource TXT records cannot contain more than 255 characters per line and 1024 characters total. If the new value contains more characters, split it into multiple values.