Technoracle
    Facebook Twitter Instagram
    • Sitemap
    • Privacy Policy
    • Disclaimer
    • Term of Services
    Facebook Twitter Instagram Pinterest Vimeo
    TechnoracleTechnoracle
    • Tutorials
      • Amazon Cloud
      • Google Cloud
    • How To
    • Blog
    • About
    Subscribe
    Technoracle
    Home»Tutorials»AWS»Copy Files between EC2 Instances Easily
    AWS

    Copy Files between EC2 Instances Easily

    Rajesh ShivamBy Rajesh ShivamMay 20, 2022Updated:May 20, 2022No Comments2 Mins Read
    Share Facebook Twitter Pinterest LinkedIn Tumblr Reddit Telegram Email
    Copy Files between EC2 Instances
    Share
    Facebook Twitter LinkedIn Pinterest Email
    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

    • 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
    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

    Hello, everyone, I am Rajesh Shivam, I am a full-time freelancer with more than seven years plus experience in different freelancing platforms, in this blog, I am going to provide complete freelancing tips and tricks.

    Related Posts

    How To

    How to Install Microsoft Teams on Ubuntu 22.04 Easily

    February 22, 2023
    Read More
    How To

    What is Elastic IP and Its Pricing in AWS

    February 22, 2023
    Read More
    How To

    How to Convert PEM to PPK file [Step by Step Guide]

    February 22, 2023
    Read More
    Add A Comment

    Leave A Reply Cancel Reply

    Facebook Twitter Instagram Pinterest
    © 2023 Technoracle

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

    Go to mobile version