scp user@i-0123456789abcdef0:/home/user/file.txt ./local-destination/ Use code with caution. Method 2: Using S3 as a "Proxy" Transfer
aws s3 cp s3://your-bucket-name/remote-file.txt ./local-folder/ Use code with caution. aws session manager download file
If you cannot modify your local SSH config, use an Amazon S3 bucket as an intermediary. This is often the most reliable method for very large files. scp user@i-0123456789abcdef0:/home/user/file
: Inside your SSM session, use the AWS CLI to push the file to a bucket: aws s3 cp /path/to/remote-file.txt s3://your-bucket-name/ Use code with caution. pull the file from the bucket:
# SSH over Session Manager host i-* mi-* ProxyCommand sh -c "aws ssm start-session --target %h --document-name AWS-StartSSHSession --parameters 'portNumber=%p'" Use code with caution.
: On your local machine (with appropriate AWS credentials), pull the file from the bucket: