Amazon Web Services (AWS) delivers a bunch of cloud computing services, including Elastic Compute Cloud (EC2), Elastic File System (EFS), Simple Storage Service (S3), and Amazon Aurora. EC2 allows users to create and launch virtual machines in the cloud, while EFS provides a fully managed, scalable file system for EC2 instances. Moreover, Amazon S3 is a highly durable and scalable object storage infrastructure that stores and retrieves high-dimensional data from anywhere on the web.
One of the key benefits of using EFS is the ability to share files across multiple EC2 instances. It is helpful in different use cases, such as running a web application with various server instances or processing data on numerous compute instances. This guide will discuss how to use WinSCP or FileZilla with Amazon Elastic File System (EFS) for shared file storage across multiple EC2 instances.
What should you have?
Before we begin and elaborate on using file transfer clients like WinSCP or FileZilla, you should have the following:
- ✅ An AWS account (Probably Verified)
- ✅ Access to AWS Management Console
- ✅ At least one EC2 instance running
- ✅ An EFS file system created
Once you have all the above-mentioned requirements ready, it’s time to connect FTP clients i.e. WinSCP or FileZilla
Using WinSCP with Amazon EFS
WinSCP is a an open-source SFTP (SSH File Transfer Protocol) client for Windows. It provides users with a secure means to transfer files between a local host machine and a remote server using SSH. Here are the steps to use WinSCP with Amazon EFS:
- Download and install WinSCP on your local machine.
- Open WinSCP and select “New Site” from the main screen.
- In the “New Site” dialog box, fill in the following fields:
- File protocol: “SFTP”
- Hostname: The DNS name of your EC2 instance (you can find this in the EC2 console)
- Port number: “22“
- User name: Username to login into EC2 instance.
- Password: Unique key aka password that user will use with username to login into EC2 instance (or leave blank if you’re using a key pair)
- Private key file: If you’re using a key pair, select the key pair file you downloaded when you created the EC2 instance.
- Click “Save” to save the new site.
- Open the new site and navigate to the “Advanced” tab.
- In the “Advanced” tab, select the “SFTP” protocol and fill in the following fields:
- SFTP server: The DNS name of your EFS file system (you can find this in the EFS console)
- Port number: “22”
- User name: “root”
- Password: Leave blank if you’re using a key pair
- Private key file: If you’re using a key pair, select the key pair file you downloaded when you created the EFS file system.
- Click “OK” to save the settings.
- You should now be able to connect to your EFS file system through WinSCP.
Using FileZilla with Amazon EFS
FileZilla is a freeware and open-source FTP client for Windows, Linux & macOS. It permits users to securely transfer files between a local host and a remote server over FTP, FTPS, and SFTP. Here are the steps to use FileZilla with Amazon EFS:
- Download and install FileZilla on your local machine.
- Open FileZilla and select “File” then “Site Manager” from the main screen.
- In the “Site Manager” dialog box, click “New Site” and fill in the following fields:
- Protocol: “SFTP – SSH File Transfer Protocol”
- Host: The DNS name of your EC2 instance (you can find this in the EC2 console)
- Port: “22”
- Logon Type: “Normal”
- User: The user name that you will use to login into EC2 instance
- Password: The password associated with the username to login EC2 instance (or leave blank if you’re using a key pair)
- Key file: If you’re using a key pair, select the key pair file you downloaded when you created the EC2 instance.
- Click “Connect” to connect to your EC2 instance.
- Once you are connected to your EC2 instance, navigate to the “File” > “Site Manager” menu again and select your newly created site from the list.
- In the “Site Manager” dialog box, navigate to the “Advanced” tab and fill in the following fields:
- Default remote directory: The mount point of your EFS file system (usually “/mnt/efs/”)
- Use custom settings: Check this box to enable custom settings.
- SFTP: Check this box to enable SFTP.
- Logon type: “Normal”
- User: “root”
- Password: Leave blank if you’re using a key pair
- Key file: If you’re using a key pair, select the key pair file you downloaded when you created the EFS file system.
- Click “OK” to save the settings.
- Now, a secure connection will be established with EFS file system via FileZilla.
Transferring Files Between Local Machine & EFS File System
Once you are connected to your EFS file system by using either WinSCP or FileZilla, you will be able to transfer files between local host and remote EFS file system. Here’s how:
- In WinSCP, navigate to the directory where you want to transfer files from/to your EFS file system in the “Local” pane.
- In FileZilla, navigate to the directory where you want to transfer files from/to your EFS file system in the “Local site” pane.
- In the “Remote” pane (WinSCP) or “Remote site” pane (FileZilla), navigate to the directory where you want to transfer files to/from your local machine.
- To transfer files from local host system to the EFS file system, simply drag and drop the files from the “Local” pane (WinSCP) or “Local site” pane (FileZilla) to the “Remote” pane (WinSCP) or “Remote site” pane (FileZilla).
- To transfer files from the EFS file system to your local machine, simply drag and drop the files from the “Remote” pane (WinSCP) or “Remote site” pane (FileZilla) to the “Local” pane (WinSCP) or “Local site” pane (FileZilla).
- You can also use the WinSCP/FileZilla menu options to create new directories, rename files and directories, delete files and directories, and change file and directory permissions.
Ending Lines: Here’s an Overview
Using WinSCP or FileZilla with Amazon Elastic File System (EFS) for shared file storage beyond multiple EC2 instances is a simple and effective way. It allows you to achieve shared file storage across multiple EC2 instances.
This blog provides a step-by-step approach that enables you to effortlessly manage files within your EFS file system and seamlessly share them across multiple EC2 instances.
When using EFS with multiple EC2 instances, make sure that your EC2 instances are in the same security group as your EFS file system, so that they have the necessary permissions to access it. This can be done easily through the AWS Management Console.
In addition to WinSCP and FileZilla, there are many other SFTP clients available that can be used to connect to an EFS file system, including Cyberduck, Bitvise SSH Client & PuTTY. The steps outlined in this blog can also be adapted to work with other clients as well.
It’s important to note that EFS has some limitations and considerations regarding performance and cost. While EFS is a scalable and highly available file system, it may not be suitable for all workloads. For example, Highly I/O-intensive workloads like large databases or content management systems may not find EFS to be the most suitable option.