ssh: Could not resolve hostname -: Name or service not known(IP address)

0

I tried this
ssh - i /home/miki/Documents/jk/keys/aws/kjam/python-kjam.pem ubuntu@35.157.98.242
ssh: Could not resolve hostname -: Name or service not known

When I open session in AWS Systems Manager
root@ip-172-31-40-194:~# ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9001 qdisc fq_codel state UP group default qlen 1000
link/ether 06:8f:5c:fe:5a:c0 brd ff:ff:ff:ff:ff:ff
inet 172.31.40.194/20 brd 172.31.47.255 scope global dynamic eth0
valid_lft 2611sec preferred_lft 2611sec
inet6 fe80::48f:5cff:fefe:5ac0/64 scope link
valid_lft forever preferred_lft forever

Why is the IP adress different? What is the username of my EC2 instance?

Milenko
asked 5 years ago10296 views
1 Answer
0

Hi,
You need to use username@PublicDNS

ssh -i /path/my-key-pair.pem ec2-user@ec2-198-51-100-1.compute-1.amazonaws.com

If you click "Connect" from your EC2 dashboard, it will give you exactly what to enter in the terminal.

https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AccessingInstancesLinux.html

answered 5 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions