How to SSH into EC2 from Mac/Linux

I am using iTerm on mac to ssh into my ec2.

Tip: Once logged in you can type “whoami” in the terminal and ec2 will reply back with its username

                    

// step 1
ssh ec2-user@54.216.19.124

// you will get the following reply
The authenticity of host '54.216.19.124 (54.216.19.124)' can't be established.
ECDSA key fingerprint is SHA256:qysd2tOrszwHr0lsS4hf+dqIRXWB3dTg1op/saOxuR0.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes

// step 2
ssh -i EC2Tutorial.pem ec2-user@54.216.19.124

// you will get the following reply, type yes
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0644 for 'EC2Tutorial.pem' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
Load key "EC2Tutorial.pem": bad permissions
ec2-user@54.216.19.124: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).

// step 3, allows the owner to read
chmod 0400 EC2Tutorial.pem

// step 4
ssh -i EC2Tutorial.pem ec2-user@54.216.19.124

// you will be greeted with EC2 logo (after successful login)