Your setup so far

To ssh into your instance

First, change the permissions of the .pem file so only the root user can read it:

chmod 400 /path/to/pem/file.pem

Then, ssh into the instance using your instance’s public DNS hostname

ssh -i /path/to/pem/file.pem ubuntu@ec2-n-nn-nnn-nnn.example.amazonaws.com

Use tramp

Tramp helps me connect and work with the remote instance as if it were local. I can use the dired buffer, search and edit files, etc, just as I would do locally. It’s a great way to gently immerse oneself into the remote server world.

To connect to the instance using tramp, edit your ~/.ssh/config file to add:

Host aws_ubuntu # the name you'd like to use for sshing
Hostname ec2-n-nn-nnn-nnn.example.amazonaws.com # public DNS hostname
User ubuntu # username of your instance (it may not be ubuntu)
IdentityFile /path/to/pem/file.pem 

Then just C-x C-f /ssh:host:path-to-file your way to the file you want to edit. I’ve bound C-x C-f to C-x o to reduce key strokes for myself.