Connect to AWS EC2 with SFTP on macOS - Devstorm Apps (2024)

Connect to AWS EC2 with SFTP on macOS - Devstorm Apps (1)

Find out how to connect to your Linux instance of EC2 with SFTP with your Mac. Browse, upload and download files easily after following this guide.

Amazon offers virtual server capabilities with their Elastic Compute Cloud (EC2), part of the Amazon Web Services (AWS) infrastructure. It allows you to easily increase or decrease capacity while still maintaining control over your compute instances.

But you probably already know all this and you just want to connect to your EC2 with SFTP to download or upload files.

Setup SSH Keys

First you’ll need to setup the SSH keys. Open AWS Console EC2 page and in the sidebar choose Network & Security > Key Pairs.

Connect to AWS EC2 with SFTP on macOS - Devstorm Apps (2)

Here choose Create Key Pair in the top-right corner.

Connect to AWS EC2 with SFTP on macOS - Devstorm Apps (3)

Type a name for your key pair and make sure .pem is selected. Click Create Key

Connect to AWS EC2 with SFTP on macOS - Devstorm Apps (4)

Allow the file download and save it on your Mac.

Connect to AWS EC2 with SFTP on macOS - Devstorm Apps (5)

Create EC2 instance

Skip to the next section if you already have a Linux EC2 instance running.

If you haven’t created at least one EC2 instance, you’ll need to set one up at this point. Follow the official guide from Amazon and setup a Linux instance. The exact distribution is up to your preference. For beginners we recommend using Ubuntu.

Connection Details

On the EC2 page, choose Instances, then click on the instance you want to connect to.

Connect to AWS EC2 with SFTP on macOS - Devstorm Apps (6)

In the Details panel you’ll see the Public IPv4 address. Copy this address.

Next make sure you have the SSH port accessible. Click on the Security tab for the instance and look at inbound rules. By default, the SSH port is 22. If you’ve configured sshd to use a different port, make sure it’s open and in the inbound ruleset.

Connect to AWS EC2 with SFTP on macOS - Devstorm Apps (7)

Connecting to Amazon EC2 with SFTP using DCommander

Now that you’ve setup your cloud compute instance to accept SSH connections, you’re very close to downloading and uploading files to it.

To make file management an easy task we use DCommander. With it’s dual-panel interface you always have a clear image of what files are local and what files are on the remote EC2 server.

Get DCommander now if you haven’t installed it already.

Open DCommander, click on the Connection Manager.

In the Connection Manager, click on Add New Connection.

Connect to AWS EC2 with SFTP on macOS - Devstorm Apps (9)

You’ll now be prompted to enter connection details.

Select type as SFTP (SSH) and type the Public IPv4 address you saved previously followed by : and port number (default SSH port is 22).

Depending on what Linux distribution you chose for your EC2 instance, you’ll need to type the default username:

  • For Amazon Linux 2 or the Amazon Linux AMI, the user name isec2-user.
  • For a CentOS AMI, the user name iscentosorec2-user.
  • For a Debian AMI, the user name isadmin.
  • For a Fedora AMI, the user name isfedoraorec2-user.
  • For a RHEL AMI, the user name isec2-userorroot.
  • For a SUSE AMI, the user name isec2-userorroot.
  • For an Ubuntu AMI, the user name isubuntu.
  • For an Oracle AMI, the user name isec2-user.
  • For a Bitnami AMI, the user name isbitnami.

See the Amazon EC2 documentation page for Managing User Accounts on Linux for more information.

For authentication choose Public Key Authentication then click Browse and select the .pem file you downloaded previously.

Click OK after entering all the details to save your connection.

Connect to AWS EC2 with SFTP on macOS - Devstorm Apps (10)

Select the newly created connection and click Connect.

Connect to AWS EC2 with SFTP on macOS - Devstorm Apps (11)

DCommander will now connect to your instance of Linux EC2 with SFTP and allow you to navigate, copy, delete and create new files and folders.

Connect to AWS EC2 with SFTP on macOS - Devstorm Apps (12)

DCommander will automatically reconnect in case the network connection drops, allowing you to continue without manually reconnecting each time.

That’s it – you can now manage files on EC2 with SFTP using your Mac.

Related Posts

Connect to AWS EC2 with SFTP on macOS - Devstorm Apps (2024)
Top Articles
Latest Posts
Article information

Author: Gregorio Kreiger

Last Updated:

Views: 6225

Rating: 4.7 / 5 (77 voted)

Reviews: 92% of readers found this page helpful

Author information

Name: Gregorio Kreiger

Birthday: 1994-12-18

Address: 89212 Tracey Ramp, Sunside, MT 08453-0951

Phone: +9014805370218

Job: Customer Designer

Hobby: Mountain biking, Orienteering, Hiking, Sewing, Backpacking, Mushroom hunting, Backpacking

Introduction: My name is Gregorio Kreiger, I am a tender, brainy, enthusiastic, combative, agreeable, gentle, gentle person who loves writing and wants to share my knowledge and understanding with you.