Moving a NAT gateway to a different folder
Note
This feature is in the Preview stage.
You can move cloud resources between folders within a single cloud.
To move a NAT gateway to a different folder:
- In the management console
, go to the folder where the NAT gateway is located. - In the list of services, select Virtual Private Cloud.
- In the left-hand panel, select
Gateways. - Click
in the row of the NAT gateway to move and select Move. - Select the destination folder from the drop-down list.
- Click Move.
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 move a NAT gateway to a different folder:
-
View a description of the CLI move NAT gateway command:
yc vpc gateway move --help
-
Get the name or ID of the NAT gateway to move:
yc vpc gateway list
Result:
+----------------------+----------+-------------+ | ID | NAME | DESCRIPTION | +----------------------+----------+-------------+ | enckq19qqsr5******** | router-1 | | +----------------------+----------+-------------+
-
Get a list of available folders:
yc resource-manager folder list
Result:
+----------------------+------------------------+--------+--------+ | ID | NAME | LABELS | STATUS | +----------------------+------------------------+--------+--------+ | b1cs8ie21pk1******** | default | | ACTIVE | | b1chgf288nvg******** | my-folder-1 | | ACTIVE | | b1cu6g9ielh6******** | my-folder-2 | | ACTIVE | +----------------------+------------------------+--------+--------+
-
Move the NAT gateway by specifying the name or ID of the NAT gateway and destination folder:
yc vpc gateway move <gateway_name_or_ID> \ --destination-folder-name <destination_folder_name> \ --destination-folder-id <destination_folder_ID>
Use either the
--destination-folder-name
or--destination-folder-id
parameter.If the gateway is not in the current folder (default folder), specify the source folder using the
--folder-name
or--folder-id
option.Result:
id: enckq19qqsr5******** folder_id: b1chgf288nvg******** created_at: "2022-10-06T10:14:04Z" name: router-1 shared_egress_gateway: {}
For more information about the
yc vpc address move
command, see the CLI reference.
To move a NAT gateway to a different folder, use the move REST API method for the Gateway resource or the GatewayService/Move gRPC API call, and provide the following in the request:
-
ID of the NAT gateway to move, in the
gatewayId
parameter.To get the NAT gateway ID, use the list REST API method for the Gateway resource or the GatewayService/List gRPC API call. In your request, provide the folder ID in the
folderId
parameter. -
ID of the folder you want to move the NAT gateway to, in the
destinationFolderId
parameter.To learn how to find out the folder ID, see Getting the folder ID.
Examples
NAT gateway in a different folder
Move a NAT gateway from a different folder. Specify the NAT gateway ID and the source and destination folder IDs:
yc vpc gateway move enckq19qqsr5******** \
--folder-id b1chgf288nvg******** \
--destination-folder-id b1cs8ie21pk1********