For Ubuntu Instance,
First, check whether you have given permission to the Keys, if not give it using:
chmod 600 ec2-keypair.pemg
Then try to login in that using
ssh -v -i ec2-keypair.pem ubuntu@DNS_name
And the give your login name as ubuntu
For the windows instance,
Install Putty from https://www.putty.org/ and then log in using your DNS_name and Key_pair.ppk
type your login name as ec2-user
To know more about EC2: https://www.youtube.com/watch?v=QNIPh4DhLx0&t=341s