Best Way to Download File From Ec2 Aws

Uploading and downloading files in AWS instance can be done using Filezilla client or Linux scp control. If you are a windows user, you lot tin can use WinSCP for transferring files to your EC2 case.

In this tutorial, I will explain how you can transfer files to AWS ec2 instances using the following methods.

  1. Copy Files Using Filezilla Client (GUI Based).
  2. Copy files using SCP (Works but on Linux/MAC systems)

Upload Files To EC2 using FileZilla

To transfer files to ec2 Linux instance, nosotros volition employ FileZilla

Yous can download the FileZilla client from here Download FileZilla.

Step1: Install and open FileZilla

Step2: Go To Edit–>Settings–>SFTP

Notation: Past default, AWS ec2 instances come with a private key for login. We will apply that private fundamental with Filezilla. If you desire to setup a password-based access, check out the ec2 password setup blog.

Click add fundamental file and add your .ppk key of your AWS instance and so click ok. You lot can convert the AWS pem file to ppk using puttygen. Refer to this tutorial –> How To Create .ppk File Using PuttyGen

ec2-upload-download filezilla SFTP

Step3: In the FileZilla homepage enter the host details (public IP, elastic IP or the public DNS) and enter the username in the relevant field. ( username varies for dissimilar images.

For ubuntu Case, the username will be ubuntu, for Linux machines, the username will exist ec2-user) .

Leave the password field empty, since we are using the private key for hallmark.

Port number is 22 for SFTP. Once you enter all the necessary details click connect.

Filezilla will be connected to your server instance and y'all can view your server files and folders.

sftp-link

Step4: File Upload And Download:- Once FileZilla is connected to your server instance, you can upload files to your instance, and as well you can download files from your server instance.

The local site is your local system files. The remote site is your server instance.

To upload files cull the directory on your server where you desire your files to be uploaded.

Now select the file to exist uploaded and right-click on it. Click the upload file option. Your file starts uploading to the directory yous selected. Similarly, you can download files from your server instance past right-clicking the file.

Few important things to understand,

  1. Since you are logging in equally a user, you lot cannot upload the files to the root directory due to permissions issues. Alternatively, upload the files to the user home directory and re-create information technology to the desired location using any ssh client similar putty.
  2. Y'all volition be uploading and downloading files every bit a normal user and non a root user. So the files which are owned past root cannot exist uploaded and downloaded. You lot volition get permission denied fault when y'all attempt to download a file endemic by root.

And so, if you desire to download those files, ssh into the car and change the possessor of that file to the normal user using the following command.

sudo chown user:user /folder/file

In the above command, the user is your instance's default username. For example, for ubuntu instances, information technology's ubuntu and for RHEL instances its ec2-user. Requite the username accordingly. If y'all want to change the owner of a recursive folder, add a -R switch to the command, as shown beneath.

sudo chown -R user:user /folder/file

Upload File Using SCP Control Line Utility

If y'all are using a Linux or Mac system, you can use the scp utility to upload or transfer files to ec2 instance.

Annotation: Ensure that your pem file has simply read permission to it. Or else the connectedness might fail.

Let's have a look at the syntax.

scp -i /path/to/key.pem file-name [email protected]:/path/to/user/home

For example,

scp -i /keys/mykey.pem file.txt [electronic mail protected]:/home/ubuntu        

If y'all want to copy a whole folder, then y'all should utilize a recursive flag -r with the command every bit shown beneath.

scp -i /keys/mykey.pem -r binder-name [email protected]:/home/ubuntu        

I hope this article helps. Let me know in the comments section if y'all face up any errors.

If you want to copy files from Windows to Linux, bank check out my windows to Linux file copy guide.

Conclusion

Transferring files to ec2 servers is very essential when you host applications like wordpress in ec2.

Always make sure you lot follow good security practices and provide only required permission to the files in the server.

Besides, always enable correct security group rules to enable an extra layer of the firewall to reduce the attack surface of your websites.

DOWNLOAD HERE

Posted by: peeplesawaseen.blogspot.com

0 Komentar

Post a Comment




banner