Yesterday I was setting up an EC2 instance with Ubuntu/Nginx/Node/Mongo/Meteor on it and ran into a couple of issues with the first attempt that could have easily been avoided.
When you are setup an EC2 instance on AWS (Amazon), you will be asked whether you want to authenticate with a private key (pem) file or a root password.
It is recommended that you authenticate with a key, because it is more secure and easier to manage when you have more and more instances.
I authenticated into the instance using the following command:
ssh -i /path/to/key.pem ubuntu@IP_ADDRESS
That got me into the server and everything was fine.
As soon as I started running commands I noticed I needed
sudo for pretty much every single operation, I decided to ignore that fact and use everything with sudo.
After setting up Nginx and Meteor, Nginx kept returning a 403 forbidden error whenever you would access the site, I checked permissions and everything looked okay.
After many permission changes, I decided to start over. This time I did a very subtle but key step before running the setup commands, here is how I authenticated:
ssh -i /path/to/key.pem ubuntu@IP_ADDRESS sudo -i
Then ran commands. Do not use
su as it will require a root password which you do not have.
sudo -i will have the same effect and require no password.
I hope this helps you, I can see this being useful to those who are used to services like Digital Ocean which have less complexity than AWS.