GCLOUD_COMPUTE_SCP(1)

NAME

gcloud compute scp - copy files to and from Google Compute Engine virtual machines via scp

SYNOPSIS

gcloud 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] [GCLOUD_WIDE_FLAG ...]

DESCRIPTION
gcloud compute scp copies files between a virtual machine instance and your local machine using the scp command. To denote a remote file, prefix the file name with the virtual machine instance name (e.g., example-instance:~/FILE). To denote a local file, do not add a prefix to the file name (e.g., ~/FILE). For example, to copy a remote directory to your local host, run:
    $ gcloud compute scp example-instance:~/REMOTE-DIR ~/LOCAL-DIR \
        --zone us-central1-a
In the above example, ~/REMOTE-DIR from example-instance is copied into the ~/LOCAL-DIR directory. Conversely, files from your local computer can be copied to a virtual machine:
    $ gcloud compute scp ~/LOCAL-FILE-1 ~/LOCAL-FILE-2 \
        example-instance:~/REMOTE-DIR --zone us-central1-a
If a file contains a colon (``:''), you must specify it by either using an absolute path or a path that begins with ``./''. Under the covers, scp(1) or pscp (on Windows) is used to facilitate the transfer. When the destination is local, all sources must be the same virtual machine instance. When the destination is remote, all sources must be local.

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
        If provided, prints the command that would be run to standard out instead of executing it.

    --force-key-file-overwrite
        If enabled gcloud will regenerate and overwrite the files associated with a broken SSH key without asking for confirmation in both interactive and non-interactive environment. If disabled gcloud will not attempt to regenerate the files associated with a broken SSH key and fail in both interactive and non-interactive environment.

    --plain
        Suppresses 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. 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. Use this flag to specify a value for the connection. 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, 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.

GCLOUD WIDE FLAGS
These flags are available to all commands: --account, --configuration, --flatten, --format, --help, --log-http, --project, --quiet, --trace-token, --user-output-enabled, --verbosity. Run $ gcloud help for details.