Acquia Copilot is a conversational AI connected into our product documentation and knowledge base. Ask Copilot about product features, technical details, troubleshooting and how to get started with Acquia products.
To copy a large number of files from one place to another, one of the better options is to use rsync, which provides either an interactive or non-interactive way to copy files from one location to another on a single infrastructure, or from one infrastructure to another.
Note
Acquia recommends testing your rsync commands by adding the -n option with each rsync command, which gives you an output of the changes without committing them. You must add the -n option to the commands in the following steps.
To use rsync in Cloud Next environments, you must leverage SSH agent forwarding.
To rsync files on Cloud Platform:
Ensure that the user, group, and mode of the files and folders you intend to rsync are set to allow the infrastructure to have read-only access, and to explicitly block any other user from reading your content. This prevents file locks or changes while you copy data.
Use an existing SSH key or see Enabling SSH Access for connecting through ssh.
Place your private SSH key somewhere on the production infrastructure. For this example, suppose that you placed the key in the /mnt/files/[site]/files-private/private_key directory, where [site] is the website’s name on Cloud Platform. For more information about placement, see Storing private information in the file system.
To allow access to the key, give it the proper permissions by using a command similar to the following:
In this example, [stage_name] is the name of the staging website’s name on Cloud Platform, and the [stage_infrastructure] is the name of the staging infrastructure on Cloud Platform.
The rsync flags ensure all the files copy recursively, and preserve both modification times and symlinks. For more information on the rsync options used here, see the rsync man page.
Additional examples
The following examples give information on how you can extend or update rsync commands to meet your needs.
Transferring files between environments
To transfer the files folder from your production environment to your staging environment, execute a command similar to the following:
You can also use SCP over rsync from a local machine to transfer files between two remote . You may need to set up SSH keys between the two infrastructures:
In this example, [user] is your username, and [svr] is the name of the particular infrastructure you’re moving data to or from.
rsyncing files on Cloud Platform
To copy a large number of files from one place to another, one of the better options is to use rsync, which provides either an interactive or non-interactive way to copy files from one location to another on a single infrastructure, or from one infrastructure to another.
Note
Acquia recommends testing your rsync commands by adding the -n option with each rsync command, which gives you an output of the changes without committing them. You must add the -n option to the commands in the following steps.
To use rsync in Cloud Next environments, you must leverage SSH agent forwarding.
To rsync files on Cloud Platform:
Ensure that the user, group, and mode of the files and folders you intend to rsync are set to allow the infrastructure to have read-only access, and to explicitly block any other user from reading your content. This prevents file locks or changes while you copy data.
Use an existing SSH key or see Enabling SSH Access for connecting through ssh.
Place your private SSH key somewhere on the production infrastructure. For this example, suppose that you placed the key in the /mnt/files/[site]/files-private/private_key directory, where [site] is the website’s name on Cloud Platform. For more information about placement, see Storing private information in the file system.
To allow access to the key, give it the proper permissions by using a command similar to the following:
In this example, [stage_name] is the name of the staging website’s name on Cloud Platform, and the [stage_infrastructure] is the name of the staging infrastructure on Cloud Platform.
The rsync flags ensure all the files copy recursively, and preserve both modification times and symlinks. For more information on the rsync options used here, see the rsync man page.
Additional examples
The following examples give information on how you can extend or update rsync commands to meet your needs.
Transferring files between environments
To transfer the files folder from your production environment to your staging environment, execute a command similar to the following:
You can also use SCP over rsync from a local machine to transfer files between two remote . You may need to set up SSH keys between the two infrastructures: