gcloud_beta_compute_scp (1)
NAME
- gcloud beta compute scp - copy files to and from Google Compute Engine virtual machines via scp
SYNOPSIS
-
gcloud beta compute scp [[USER@]INSTANCE:]SRC [[[USER@]INSTANCE:]SRC ...] [[USER@]INSTANCE:]DEST [--compress] [--dry-run] [--force-key-file-overwrite] [--plain] [--port=PORT] [--recurse] [--scp-flag=SCP_FLAG] [--ssh-key-file=SSH_KEY_FILE] [--strict-host-key-checking=STRICT_HOST_KEY_CHECKING] [--zone=ZONE] [--internal-ip | --tunnel-through-iap] [GCLOUD_WIDE_FLAG ...]
DESCRIPTION
(BETA) gcloud beta compute scp securely copies files between a
In order to set up a successful transfer, follow these guidelines:
-
- *
- Prefix remote file names with the virtual machine instance name (e.g., example-instance:~/FILE).
- *
- Local file names can be used as is (e.g., ~/FILE).
- *
- File names containing a colon (``:'') must be invoked by either their absolute path or a path that begins with ``./''.
- *
- When the destination of your transfer is local, all source files must be from the same virtual machine.
- *
- When the destination of your transfer is remote instead, all sources must be local.
Under the covers, scp(1) is used to facilitate the transfer.
POSITIONAL ARGUMENTS
-
- [[USER@]INSTANCE:]SRC [[[USER@]INSTANCE:]SRC ...]
-
Specifies the files to copy.
- [[USER@]INSTANCE:]DEST
-
Specifies a destination for the source files.
FLAGS
-
- --compress
-
Enable compression.
- --dry-run
-
Print the equivalent scp/ssh command that would be run to stdout, instead of
executing it.
- --force-key-file-overwrite
-
If enabled, the gcloud command-line tool will regenerate and overwrite the
files associated with a broken SSH key without asking for confirmation in both
interactive and non-interactive environments.
If disabled, the files associated with a broken SSH key will not be regenerated and will fail in both interactive and non-interactive environments.
- --plain
-
Suppress the automatic addition of ssh(1)/scp(1) flags. This flag is
useful if you want to take care of authentication yourself or use specific
ssh/scp features.
- --port=PORT
-
The port to connect to.
- --recurse
-
Upload directories recursively.
- --scp-flag=SCP_FLAG
-
Extra flag to be sent to scp. This flag may be repeated.
- --ssh-key-file=SSH_KEY_FILE
-
The path to the SSH key file. By default, this is
~/.ssh/google_compute_engine.
- --strict-host-key-checking=STRICT_HOST_KEY_CHECKING
-
Override the default behavior of StrictHostKeyChecking for the connection. By
default, StrictHostKeyChecking is set to 'no' the first time you connect to an
instance, and will be set to 'yes' for all subsequent connections.
STRICT_HOST_KEY_CHECKING must be one of: yes, no, ask.
- --zone=ZONE
-
The zone of the instance to copy files to/from.
If not specified and the compute/zone property isn't set, you may be prompted to select a zone.
To avoid prompting when this flag is omitted, you can set the compute/zone property:
- $ gcloud config set compute/zone ZONE
A list of zones can be fetched by running:
- $ gcloud compute zones list
To unset the property, run:
- $ gcloud config unset compute/zone
Alternatively, the zone can be stored in the environment variable CLOUDSDK_COMPUTE_ZONE.
-
At most one of these may be specified:
-
- --internal-ip
-
Connect to instances using their internal IP addresses rather than their
external IP addresses. Use this to connect from one instance to another on the
same VPC network, over a VPN connection, or between two peered VPC networks.
For this connection to work, you must configure your networks and firewall to allow SSH connections to the internal IP address of the instance to which you want to connect.
To learn how to use this flag, see cloud.google.com/compute/docs/instances/connecting-advanced#sshbetweeninstances
- --tunnel-through-iap
-
Tunnel the ssh connection through the Cloud Identity-Aware Proxy.
-
GCLOUD WIDE FLAGS
These flags are available to all commands: --account, --configuration, --flags-file, --flatten, --format, --help, --log-http, --project, --quiet, --trace-token, --user-output-enabled, --verbosity. Run $ gcloud help for details.
EXAMPLES
To copy a remote directory, ~/narnia, from example-instance to the ~/wardrobe directory of your local host, run:
-
$ gcloud beta compute scp --recurse example-instance:~/narnia \
~/wardrobe
Conversely, files from your local computer can be copied to a virtual machine:
-
$ gcloud beta compute scp ~/localtest.txt ~/localtest2.txt \
example-instance:~/narnia
If the zone cannot be determined, you will be prompted for it. Use the --zone flag to avoid being prompted:
-
$ gcloud beta compute scp --recurse example-instance:~/narnia \
~/wardrobe --zone us-central1-a
To specify the project, zone, and recurse all together, run:
-
$ gcloud beta compute scp --project "my-gcp-project" \
--zone "us-east1-b" --recurse ~/foo-folder/ gcp-instance-name:~/
NOTES
This command is currently in BETA and may change without notice. These variants are also available:
- $ gcloud compute scp $ gcloud alpha compute scp