How to Transfer Files Between a Mac and AWS EC2 Using SCP
The SCP command-line tool allows Mac users to transfer files to and from AWS EC2 Linux instances by reusing the same SSH key pair and connection path. To use SCP, you need the instance's public DNS or IP address, the correct Linux username, a private key stored locally on your Mac, and TCP port 22 access permitted in the EC2 security group. The private key must never be uploaded to the EC2 instance, and its file permissions should be restricted using chmod 400 to prevent other local users from reading it. Files and directories can be transferred in both directions — Mac to EC2 or EC2 to Mac — with the -r flag enabling recursive folder copies. Common errors such as 'Permission denied' or 'Connection timed out' typically point to a wrong username, mismatched key, or a security group rule blocking SSH access from your current IP address.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in