Starting my first experience with Oracle Cloud Infrastructure, I played with my lab and wanted to change my VCN name. I thought it might be more than easily with the Web Console, but could realise this was not possible. I find out that the only way to do it was through the command line. So great opportunity to start learning first OCI commands.
List compartment to get needed IDs
Of course the first challenge was to get the compartment appropriate ID. And as I followed oracle training recommendations to separate resource family into compartment, I had more than one existing.
To do so I ran following command from the Cloud Shell console:
[email protected]:~ (eu-zurich-1)$ oci iam compartment list --compartment-id-in-subtree 1
List VCN
Having the appropriate compartment Id I could list the existing VCN:
[email protected]:~ (eu-zurich-1)$ oci network vcn list -c "ocid1.compartment.oc1..aaaaaaaasbt3rfrxmgjb2qoe2g3rmjihiulkm4owxqlp7t2fpcs7eiaxwxkq" { "data": [ { "byoipv6-cidr-blocks": null, "cidr-block": "10.0.0.0/16", "cidr-blocks": [ "10.0.0.0/16" ], "compartment-id": "ocid1.compartment.oc1..aaaaaaaasbt3rfrxmgjb2qoe2g3rmjihiulkm4owxqlp7t2fpcs7eiaxwxkq", "default-dhcp-options-id": "ocid1.dhcpoptions.oc1.eu-zurich-1.aaaaaaaabytg3uxkb3am347vccifaxbj3ds6chasyxb2vzw5aj5275vtlvoq", "default-route-table-id": "ocid1.routetable.oc1.eu-zurich-1.aaaaaaaaj7a77k4iufdstacgcbuf3ih3ykjbfevdaz4ns6e5jjgdivgqaxeq", "default-security-list-id": "ocid1.securitylist.oc1.eu-zurich-1.aaaaaaaav4sroetsvyclgp5vdiynbq4wxsvp52akhflkcyoe4ab6cz4rozjq", "defined-tags": { "Oracle-Tags": { "CreatedBy": "[email protected]", "CreatedOn": "2023-01-24T12:59:27.772Z" } }, "display-name": "VNC_xChange", "dns-label": "vncxchange", "freeform-tags": { "VCN": "VCN-2023-01-24T12:58:34" }, "id": "ocid1.vcn.oc1.eu-zurich-1.amaaaaaavo3cm5ya7mpwerd6dbqexwpandduwk2cciifpmeorinuix4cdyxq", "ipv6-cidr-blocks": null, "ipv6-private-cidr-blocks": null, "lifecycle-state": "AVAILABLE", "time-created": "2023-01-24T12:59:27.883000+00:00", "vcn-domain-name": "vncxchange.oraclevcn.com" } ] }
Rename VCN
To finally rename it:
[email protected]:~ (eu-zurich-1)$ oci network vcn update --vcn-id "ocid1.vcn.oc1.eu-zurich-1.amaaaaaavo3cm5ya7mpwerd6dbqexwpandduwk2cciifpmeorinuix4cdyxq" --display-name VCN_xChange { "data": { "byoipv6-cidr-blocks": null, "cidr-block": "10.0.0.0/16", "cidr-blocks": [ "10.0.0.0/16" ], "compartment-id": "ocid1.compartment.oc1..aaaaaaaasbt3rfrxmgjb2qoe2g3rmjihiulkm4owxqlp7t2fpcs7eiaxwxkq", "default-dhcp-options-id": "ocid1.dhcpoptions.oc1.eu-zurich-1.aaaaaaaabytg3uxkb3am347vccifaxbj3ds6chasyxb2vzw5aj5275vtlvoq", "default-route-table-id": "ocid1.routetable.oc1.eu-zurich-1.aaaaaaaaj7a77k4iufdstacgcbuf3ih3ykjbfevdaz4ns6e5jjgdivgqaxeq", "default-security-list-id": "ocid1.securitylist.oc1.eu-zurich-1.aaaaaaaav4sroetsvyclgp5vdiynbq4wxsvp52akhflkcyoe4ab6cz4rozjq", "defined-tags": { "Oracle-Tags": { "CreatedBy": "[email protected]", "CreatedOn": "2023-01-24T12:59:27.772Z" } }, "display-name": "VCN_xChange", "dns-label": "vncxchange", "freeform-tags": { "VCN": "VCN-2023-01-24T12:58:34" }, "id": "ocid1.vcn.oc1.eu-zurich-1.amaaaaaavo3cm5ya7mpwerd6dbqexwpandduwk2cciifpmeorinuix4cdyxq", "ipv6-cidr-blocks": null, "ipv6-private-cidr-blocks": null, "lifecycle-state": "AVAILABLE", "time-created": "2023-01-24T12:59:27.883000+00:00", "vcn-domain-name": "vncxchange.oraclevcn.com" }, "etag": "1dc33ee3" }
Checking the result:
[email protected]:~ (eu-zurich-1)$ oci network vcn list -c "ocid1.compartment.oc1..aaaaaaaasbt3rfrxmgjb2qoe2g3rmjihiulkm4owxqlp7t2fpcs7eiaxwxkq" | grep display-name "display-name": "VCN_xChange",
Conclusion
This is really my first experience with OCI and I might update this blog with a better way to do so in the future for sure. But just wanted to share my findings here.
I could find the same guidance in oracle Doc ID 2918071.1.
Moreover this is only a solution to change the display name of a VCN, knowing that all component created initially with the VCN and attached to it as Domain Name, Route Table, Security List, DNS Resolver will still reflect the old name used during the creation.