For the complete documentation index, see llms.txt. This page is also available as Markdown.

Transfer a file to an instance

Use the p0 file-transfer command to copy a local file to an AWS EC2 instance through P0's just-in-time File Transfer integration.

Use the p0 file-transfer command to copy a local file to an AWS EC2 instance. P0 requests just-in-time access, uploads the file to your staging bucket, and downloads it to the instance — all in a single command.

Before you begin

Ensure you have the following:

  • The File Transfer integration installed for the target AWS account.

  • The P0 CLI installed, and an active login. Run p0 login <your-p0-organization-name> if you aren't logged in.

  • The instance ID or name of your target EC2 instance. This is the same identifier you use for p0 ssh. To list available destinations, run p0 ls ssh session destination.

Transfer a file

Run the p0 file-transfer command with the local file path and the destination instance ID:

p0 file-transfer <source> <destination>
Argument
Description

source

Path to the local file to transfer. The path must point to a regular file.

destination

Instance ID or name of the target EC2 instance — the same identifier you use for p0 ssh.

For example, to transfer a local config.yaml to instance i-1234567890abcdef0:

p0 file-transfer ./config.yaml i-1234567890abcdef0 --reason "Deploy updated config"

P0 prompts you through approval, uploads the file, and downloads it to your home directory on the instance, at /home/<your-username>/config.yaml.

Options

Both flags are optional:

Option
Description

--reason

The reason you need access. Approvers see this when they review the request.

--debug

Print debug information.

What happens during a transfer

When you run the command, P0:

  1. Confirms the source path points to a regular file before requesting access.

  2. Requests just-in-time access to the staging bucket and the destination instance.

  3. Uploads the file to a per-request prefix in your S3 bucket, using multipart upload with progress reporting.

  4. Generates a short-lived presigned download URL.

  5. Connects to the instance over SSH and downloads the file with curl.

  6. Deletes the uploaded object from the bucket once the download succeeds.

Newly granted AWS permissions take a few seconds to propagate. P0 automatically retries the upload while the permission becomes active, so the first transfer to a bucket may take slightly longer.

Troubleshooting

Problem
Cause and resolution

Source file not found

The source path doesn't exist. Check the path and re-run the command.

Source path is not a regular file

The source points to a directory or special file. File Transfer moves a single regular file at a time.

curl not found on <instance>

The destination instance doesn't have curl installed. Your file is already in the bucket — install curl on the instance, then re-run the command.

The upload retries repeatedly

This behavior is expected while a new AWS permission propagates. If retries continue to fail, run the command again with --debug to see the underlying AWS error.

Last updated