How to do SFTP using pem file from command line?

A simple file transfer protocol ( SFTP ) is really essential in many cases. The regular SFTP is very straightforward. But when we want to do SFTP using an identity file (.pem) then the command is a bit different.

We will have to use ssh_option (-o) with the IdentityFile like below:

$ sftp -o IdentityFile=demo.pem ubuntu@ec2-52-25-231-230.eu-west-1.compute.amazonaws.com