How to Upload Files to Aws Instance
Uploading and downloading files in AWS instance can be washed using Filezilla client or Linux scp
control. If you are a windows user, you tin utilise WinSCP for transferring files to your EC2 instance.
In this tutorial, I will explain how you can transfer files to AWS ec2 instances using the following methods.
- Copy Files Using Filezilla Customer (GUI Based).
- Copy files using SCP (Works only on Linux/MAC systems)
Upload Files To EC2 using FileZilla
To transfer files to ec2 Linux instance, we will utilize FileZilla
You can download the FileZilla customer from hither Download FileZilla.
Step1: Install and open FileZilla
Step2: Get To Edit
–>Settings
–>SFTP
Note: Past default, AWS ec2 instances come with a private key for login. We will use that private key with Filezilla. If you want to setup a countersign-based admission, cheque out the ec2 password setup blog.
Click add key file and add your .ppk
central of your AWS case and then click ok. You tin catechumen the AWS pem file to ppk
using puttygen. Refer to this tutorial –> How To Create .ppk File Using PuttyGen
Step3: In the FileZilla homepage enter the host details (public IP, rubberband IP or the public DNS)
and enter the username in the relevant field. ( username varies for different images.
For ubuntu Instance, the username volition exist ubuntu
, for Linux machines, the username volition exist ec2-user
) .
Exit the password field empty, since we are using the individual key for hallmark.
Port number is 22
for SFTP
. Once you lot enter all the necessary details click connect.
Filezilla will exist connected to your server instance and you lot can view your server files and folders.
Step4: File Upload And Download:- Once FileZilla is continued to your server case, you can upload files to your instance, and too y'all can download files from your server case.
The local site is your local organisation files. The remote site is your server instance.
To upload files choose the directory on your server where you want your files to exist uploaded.
At present select the file to exist uploaded and correct-click on it. Click the upload file choice. Your file starts uploading to the directory you lot selected. Similarly, you tin download files from your server instance by right-clicking the file.
Few of import things to understand,
- Since you are logging in equally a user, y'all cannot upload the files to the root directory due to permissions problems. Alternatively, upload the files to the user home directory and copy it to the desired location using whatsoever ssh client like putty.
- You will be uploading and downloading files every bit a normal user and not a root user. So the files which are owned by root cannot be uploaded and downloaded. You will become permission denied error when you lot try to download a file endemic by root.
So, if y'all want to download those files, ssh into the machine and change the possessor of that file to the normal user using the following control.
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
. Requite the username accordingly. If y'all want to change the owner of a recursive binder, add a -R
switch to the command, as shown beneath.
sudo chown -R user:user /folder/file
Upload File Using SCP Command Line Utility
If you are using a Linux or Mac system, you tin can use the scp
utility to upload or transfer files to ec2 case.
Note: Ensure that your pem file has simply read permission to information technology. Or else the connectedness might fail.
Let's accept a look at the syntax.
scp -i /path/to/key.pem file-proper noun [email protected]:/path/to/user/home
For example,
scp -i /keys/mykey.pem file.txt [email protected]:/home/ubuntu
If yous want to copy a whole binder, then you should utilize a recursive flag -r with the command as shown below.
scp -i /keys/mykey.pem -r binder-name [email protected]:/domicile/ubuntu
I hope this article helps. Let me know in the comments section if you face whatever errors.
If you lot desire 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 similar wordpress in ec2.
Ever make sure 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 actress layer of the firewall to reduce the attack surface of your websites.
Source: https://comtechies.com/how-to-upload-and-download-files-in-amazon-aws-ec2-instance.html
Belum ada Komentar untuk "How to Upload Files to Aws Instance"
Posting Komentar