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.
Last updated
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.
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.
Run the p0 file-transfer command with the local file path and the destination instance ID:
p0 file-transfer <source> <destination>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.
Both flags are optional:
--reason
The reason you need access. Approvers see this when they review the request.
--debug
Print debug information.
When you run the command, P0:
Confirms the source path points to a regular file before requesting access.
Requests just-in-time access to the staging bucket and the destination instance.
Uploads the file to a per-request prefix in your S3 bucket, using multipart upload with progress reporting.
Generates a short-lived presigned download URL.
Connects to the instance over SSH and downloads the file with curl.
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.
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.
File Transfer integration — set up and configure the integration.
SSH integration — the access layer File Transfer uses to reach instances.
Last updated