Uly.me

cloud engineer

  • Home
  • About
  • Archives
Home/Archives for move

December 13, 2019

GCP Move Instance to Another Zone

Moving a GCP instance to another zone is actually much simpler than initially thought. It’s just a single gcloud command.

gcloud compute instances move instance-name \
--zone us-central1-a \
--destination-zone us-central1-b

gcloud compute instances move instance-name \ --zone us-central1-a \ --destination-zone us-central1-b

A few details about moving to another zone.

  • VM has to be running.
  • You may get a new internal or external IP address
  • Local SSDs are ephemeral, so you can’t move them.
  • When moving between regions, you may have to select a subnetwork.
  • You may have to change GPUs available in the destination if you use them.

December 11, 2019

GCP Move Instance to Another Project

Here’s how to copy a disk from one project to another.

gcloud compute disks create lamp-server \
--source-snapshot https://www.googleapis.com/compute/v1/projects/project-id/global/snapshots/lamp-server \
--project next-project-id \
--zone us-central1-a

gcloud compute disks create lamp-server \ --source-snapshot https://www.googleapis.com/compute/v1/projects/project-id/global/snapshots/lamp-server \ --project next-project-id \ --zone us-central1-a

Once all the disks are copied. You can create a snapshot of the boot.

gcloud compute disks snapshot lamp-server

gcloud compute disks snapshot lamp-server

Create an instance from snapshot.

gcloud compute disks create "hostname-boot" \
--project "project-id" \
--zone "us-central1-a" \
--source-snapshot "snapshot-name" \
--type "pd-standard" \
--size "100"

gcloud compute disks create "hostname-boot" \ --project "project-id" \ --zone "us-central1-a" \ --source-snapshot "snapshot-name" \ --type "pd-standard" \ --size "100"

September 10, 2019

Migrate GCP VM to another network

Here are the steps how to migrate a GCP VM from one network to another. It involves recreating the instance in that network.

  1. Find the VM. Click the ‘Create Similar’ button.
  2. Select the new network. Save Network. Everything else should stay the same.
  3. Don’t click Create, but get the ‘Create Similar’ command line script only. Click Cancel after.
  4. Make sure to edit the hostname. GCP appends a ‘-1’ at the end of hostname.
  5. Edit VM to keep all disks. Delete VM. Make sure to preserve boot drive.
  6. Run the ‘Create Similar’ command line script you capture to create new VM in the new network.
  7. The new VM will be based on golden image.
  8. Stop VM. Swap new disks with old disks.
  9. Start VM.
  10. Done.

July 21, 2019

Migrate EFS to another VPC

Migrating a EFS from one VPC to another is quite simple. There’s no need to delete it. Just click on “manage file systems access” and remove all mount targets and Save. Once the targets are removed, you can choose another VPC from the dropdown. Once a VPC is selected. Add the subnets and security groups. Save and you are done!

November 6, 2012

Subversion Move

Subversion Move is a command that renames a file in either in the local working directory or directly in the repository. You can invoke the move command from Terminal like this example below.

svn move foo.c bar.c
svn move http://repository/project/trunk/foo.c \ 
    http://repository/project/trunk/bar.c 
    -m "Place comment here."

svn move foo.c bar.c svn move http://repository/project/trunk/foo.c \ http://repository/project/trunk/bar.c -m "Place comment here."

  • Cloud
  • Linux
  • Git

Copyright © 2012–2021