Close Menu
Technoracle
    Facebook X (Twitter) Instagram
    Facebook X (Twitter) Instagram
    TechnoracleTechnoracle
    • Home
    • AWS
      • EC2
      • Lightsail
      • RDS
      • S3
    • Ubuntu
      • Ubuntu 20.04
      • Ubuntu 22.04
    • AI Tools
    • Web Hosting
    • WordPress
    • Tech News
    Technoracle
    Home - AWS - Copy Files between EC2 Instances Easily
    AWS

    Copy Files between EC2 Instances Easily

    Rajesh ShivamBy Rajesh ShivamMay 20, 2022Updated:June 10, 2023No Comments2 Mins Read
    Copy Files between EC2 Instances

    Sometimes, we need to copy, migrate or transfer files between instances for multiple reasons. In this tutorial, I am going to share a very simple method to copy files between EC2 Instances in AWS(Amazon Web Services). So, let’s get started.

    Page Contents

    Toggle
    • Copy Files from one EC2 to another EC2 instance
      • Pre-requisites
        • Step 1: Upload the SSH key of the EC2 instance
        • Step 2: SSH into the EC2 instance A to Copy Files between EC2 Instances
        • Step 3: SSH into the EC2 instance B to check the file
      • Conclusion

    Copy Files from one EC2 to another EC2 instance

    Suppose, you have to copy files from EC2 instance A to EC2 instance B. To copy files between the servers, you need to use SCP(Secure Copy Files) to copy the files. Let me explain how. I am taking to two instance to demonstrate the steps.

    Pre-requisites

    • IP address of the both EC2 instance.
    • SSH keys for the EC2 instance.

    Step 1: Upload the SSH key of the EC2 instance

    I am assuming that you are copying files from EC2 instance A to EC2 instance B. To transfer files between two instances, you have to upload the ssh key of instance B to instance A or instance A to instance B vice-versa. To upload ssh keys use the SCP command as below.

    $ scp -i "instance_A_sshkey" "instance_B_sshkey" "ec2_instance_username"@"instance_A_I
    
    Example:
    $ scp -i ec2_instance_A.pem ec2_instance_B.pem [email protected]:~
    Copy Files between EC2 Instances

    When you run this command, it will upload the SSH key of the EC2 instance B to the EC2 instance A

    Step 2: SSH into the EC2 instance A to Copy Files between EC2 Instances

    Now, ssh into the EC2 instance A, to copy your files to EC2 instance B.

    ssh -i ec2_instance_A.pem [email protected]

    After login to EC2 instance A, run following command to list the files.

    ls
    Output
    ec2_instance_B.pem  file.zip

    Let’s transfer the file zip to the instance B from instance A by following command.

    scp -i ec2_instance_B.pem file.zip [email protected]:~

    You transfer is complete now.

    Step 3: SSH into the EC2 instance B to check the file

    Login to the EC2 instance B to check the transferred file. It should be on the home directory.

    Read More: How to Install WordPress on AWS EC2 in 10min

    Conclusion

    In this short tutorial, you have learned to copy files between EC2 Instances. If you have any doubts feel free to contact me, I will definitely try to help you. Also, you can join our elite Facebook group to get direct help from me. If you like this tutorial, please share this article on your social media handle.

    aws tutorial Copy Files between EC2 Instances ec2 instance file copy
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email Reddit
    Previous Article5 Less Popular Ubuntu 22.04 Features that Make it Epic Release
    Next Article Learn AWS with AWS Skill Builder in 2022 for Free
    Rajesh Shivam
    • LinkedIn

    Rajesh Shivam is a seasoned professional with expertise in AWS and Linux System Administration. With over 10 years of freelancing experience, he brings a wealth of knowledge to the table. Rajesh has a strong passion for technology and stays connected with the latest happenings in the field. His dedication and expertise make him a trusted resource for all things tech-related.

    Related Posts

    Convert PEM to PPK file
    AWS

    Convert PEM to PPK File on Windows & Linux [2025 Guide]

    Read More
    What is Elastic IP and Its Pricing
    AWS

    What is Elastic IP and Its Pricing in AWS

    Read More
    Install Git on Amazon Linux 2
    AWS

    How to Install Git on Amazon Linux 2 Easily

    Read More
    Add A Comment
    Leave A Reply Cancel Reply

    linux commands every user should know in 2025

    25 Must-Know Linux Commands Every User Should Master in 2025

    April 10, 2025
    TeamViewer and Ubuntu logos on gradient background – banner for how to install TeamViewer on Ubuntu 24.04 tutorial

    How to Install TeamViewer on Ubuntu 24.04 [Fast & Easy Steps]

    April 10, 2025
    Troubleshooting ‘Permission Denied (publickey)’ SSH error on a Linux server using secure terminal access

    Fix ‘Permission Denied (publickey)’ SSH Error on Linux [Step-by-Step Guide]

    April 8, 2025
    Blog banner showing Ubuntu logo, coding laptop, and icons for VS Code, Docker, and Git with the title 'Perfect Dev Setup in Ubuntu 24.04 – Step-by-step guide for developers' on a dark tech-themed background.

    How to Set Up the Perfect Development Environment on Ubuntu 24.04

    April 8, 2025

    Subscribe to Blog

    Enter your email address to subscribe to
    this blog and receive notifications of new posts by email.

    Facebook X (Twitter) Instagram Pinterest
    • Sitemap
    • Privacy Policy
    • Disclaimer
    • Term of Services
    © 2025 Technoracle

    Type above and press Enter to search. Press Esc to cancel.

    Click to Copy