> I am taking this udemy course and were asked to ssh into the command line to connect to the EC2 INSTANCE.which requires root access.
TL;DR: The Udemy instructor is an idiot.
Reading between the lines here, and unless I'm mistaken you DO NOT NEED root access on your own machine.
It looks like you are trying to connect to the EC2 instance as root.
The instructions are stupidly telling you to first become root on your own machine, then (presumably) invoke the SSH connection - this will inherently use your current username (i.e. root) to attempt the login.
Instead, it is MUCH SAFER to remain in your standard user account on your own machine and override the login to EC2 by passing in the username you want to connect to as part of the connection parameters.
There are numerous ways of doing this. AWS usually uses private keys, so you may need to tweak the setup, but normally you can just:
> ssh root@my.ec2.hostname
or:
> ssh -l root my.ec2.hostname
(where 'my.ec2.hostname' is the name and/or IP address of your EC2 host). This will work regardless of your local user ID and (attempt to) connect to the remote server as root.