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 TTL or value.
- Click Save.
If you do not 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 "<domain_name> 600 <record_type> <new_value>"
If you don't have Terraform, install it and configure the Yandex Cloud provider.
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 this command:
terraform validate
If the configuration is correct, you will get this message:
Success! The configuration is valid.
-
Run this command:
terraform plan
The terminal will display a list of resources with parameters. No changes will be made at this step. If the configuration contains any 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 <zone_name>
To update a resource record, use the updateRecordSets REST API method for the DnsZone resource or the DnsZoneService/UpdateRecordSets gRPC API call.
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.
Note
You cannot modify a service resource record.