https://andrewbaker.ninja/wp-content/themes/twentysixteen/fonts/merriweather-plus-montserrat-plus-inconsolata.css

👁1views
Macbook/Linux: Secure Copy from your local machine to an EC2 instance

CloudScale SEO — AI Article Summary
What it isProvides the SCP command syntax and examples for securely transferring files between a local machine and an AWS EC2 instance in both directions.
Why it mattersSCP syntax is easy to forget and getting it wrong can waste time troubleshooting file transfers, especially when working with cloud instances that require specific authentication and paths.
Key takeawayUse 'scp -i identity_file.pem' followed by source and destination paths to securely copy files to/from EC2 instances.

I always forget the syntax of SCP and so this is a short article with a simple example of how to SCP a file from your laptop to your EC2 instance and how to copy it back from EC2 to your laptop:

Copying from Laptop to EC2

scp -i "mylocalpemfile.pem" mylocalfile.zip ec2-user@myEc2DnsOrIpAdress:/home/mydestinationfolder

scp -i identity_file.pem source_file.extention username@public_ipv4_dns:/remote_path

scp: Secure copy protocol
-i: Identity file
source_file.extension: The file that you want to copy
username: Username of the remote system (ubuntu for Ubuntu, ec2-user for Linux AMI or bitnami for wordpress)
public_ipv4_dns: DNS/IPv4 address of an instance
remote_path: Destination path

Copying from EC2 to your Laptop

scp -i "mylocalpemfile.pem" ec2-user@myEc2DnsOrIpAdress:/home/myEc2Folder/myfile.zip /Users/accountNmae/Dow
nloads
  • scp -i identity_file.pem username@public_ipv4_dns:/remote_path/source_file.extension ~/destination_local_path
Ex: scp -i access.pem [email protected]:/home/bitnami/temp.txt ~/Documents/destination_dir

Leave a Reply

Your email address will not be published. Required fields are marked *