How To Upload And Download Files In Amazon AWS EC2 Instance

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

In this tutorial, I will explain how you can transfer files to AWS instances using Filezilla.

You can download FileZilla client from here Download FileZilla.

Step1: Install and open FileZilla

Step2: Go To Edit–>Settings–>SFTP

Click add key file and add your .ppk key of your AWS instance and then click ok. You can convert the aws pem file to ppk using puttygen. Refer the following tutorial How To Create .ppk File Using PuttyGen

ec2-upload-download

Step3: In 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 different images. for ubuntu Instance, the username will be ubuntu, for Linux machines, the username will be ec2-user) .

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

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

Filezilla will be connected to your server instance and you 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 also 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 choose the directory on your server where you want your files to be uploaded.

Now select the file to be uploaded and right click on it. Click the upload file option. Your file will be uploaded to the directory you selected. Similarly, you can download files from your server instance by right clicking the file.

Since you are logging in as a user, you cannot upload the files to the root directory. Permission will be denied in that case. So upload the files to the home directory and copy it to the desired location using any ssh client like putty.

You will be uploading and downloading files as a normal user and not a root user. So the files which are owned by root cannot be uploaded and downloaded. You will get permission denied error when you try to download a file owned by root.

So, if you want to download those files, ssh into the machine and change the owner 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 it’s ubuntu and for RHEL instances its ec2-user.Give the username accordingly. If you want to change the owner of a recursive folder , add a -R switch to the command as shown below.

sudo chown -R user:user /folder/file

POST REPLY

Pin It on Pinterest

Shares
Share This