How to Upload Files to an AWS EC2 Instance Using PhpStorm

In this tutorial, I will teach you how to upload files to your EC2 instance using PhpStorm’s inbuilt SFTP client.

Prerequisites

  1. You have installed and opened a copy of the PhpStorm Integrated Development Environment (IDE)
  2. You have an AWS EC2 instance running and have a public IP address and private key file for the instance – see How to Create a PPK file from a PEM file – Windows 10

Connecting to your EC2 instance using PHPStorm

Step 1 – Go to File >> Settings or press Ctrl+Alt+S

Step 2 – Click on Build, Execution, Deployment

Step 3 – Click on Deployment

Step 4 – Click on the ‘+’ sign (or press the Insert key) to create a new remote connection

Step 5 – Enter the following:

  • Type: SFTP
  • Port: 22
  • SFTP host: the public IP address of your EC2 instance
  • User name: the user name usually ec2-user
  • Auth type: Key pair (OpenSSH or PuTTY)
  • Private key file: click to upload the private .ppk key file for your instance

Step 6 – Click on TEST SFTP CONNECTION button – it should connect

Step 7 – Click OK to save the connection

You should now see ‘Remote Host’ and be able to drag and drop files from your local machine to the EC2 instance.

 

Leave a Reply