How to Upload Files to Aws Ec2 Instance

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

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

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

Upload Files To EC2 using FileZilla

To transfer files to ec2 Linux example, we will apply FileZilla

You tin can download the FileZilla client from here Download FileZilla.

Step1: Install and open FileZilla

Step2: Go To Edit–>Settings–>SFTP

Notation: By default, AWS ec2 instances come with a individual cardinal for login. We will use that private central with Filezilla. If you want to setup a password-based admission, check out the ec2 countersign setup blog.

Click add together primal file and add your .ppk key of your AWS instance and then click ok. You tin 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 volition be ec2-user) .

Go out 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 exist continued to your server case and you tin can view your server files and folders.

sftp-link

Step4: File Upload And Download:- Once FileZilla is continued to your server instance, y'all can upload files to your example, 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 correct-click on it. Click the upload file pick. Your file starts uploading to the directory you 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 as a user, you lot cannot upload the files to the root directory due to permissions issues. Alternatively, upload the files to the user abode directory and copy it to the desired location using any ssh client like putty.
  2. You will be uploading and downloading files as a normal user and not a root user. So the files which are endemic by root cannot exist uploaded and downloaded. Y'all volition become permission denied error when you lot effort to download a file owned past root.

So, if you desire to download those files, ssh into the automobile and change the owner of that file to the normal user using the post-obit command.

sudo chown user:user /folder/file

In the above control, the user is your instance's default username. For case, for ubuntu instances, it'due south ubuntu and for RHEL instances its ec2-user. Give the username accordingly. If you lot want to change the possessor of a recursive binder, add a -R switch to the command, equally shown beneath.

sudo chown -R user:user /folder/file

Upload File Using SCP Command Line Utility

If yous are using a Linux or Mac arrangement, yous can utilize the scp utility to upload or transfer files to ec2 case.

Note: Ensure that your pem file has only read permission to it. Or else the connection might fail.

Let'southward have a expect at the syntax.

scp -i /path/to/primal.pem file-proper noun [email protected]:/path/to/user/habitation

For example,

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

If you lot want to copy a whole folder, and then y'all should employ a recursive flag -r with the command as shown beneath.

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

I hope this article helps. Let me know in the comments department if yous face whatever errors.

If you want to copy files from Windows to Linux, 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.

E'er brand certain you 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.

bullardsymaine1985.blogspot.com

Source: https://comtechies.com/how-to-upload-and-download-files-in-amazon-aws-ec2-instance.html

0 Response to "How to Upload Files to Aws Ec2 Instance"

แสดงความคิดเห็น

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel