Please explain ec2_instance volumes config

should I mention any path for IdentityFile ?

Test the connection first using this command:

ssh -i ~/.ssh/keyfile.pem ubuntu@18.191.217.98

I just tried what you said and it just forced log out of Superuser then all the copied .pem file and id_rsa.pub key all are gone It’s been a week I’m only trying to ssh from one instance to another now its seems it’s not that worth of time. I’m sanding you screen shot. thanx

(attachments)


Hullo again.

Configuration files need to be copied exactly and accurately. Look at the config file you sent - it does not match the formatting I sent, unless email screwed it up. Each line - Host, Hostname, User and IdentityFile, must be on a separate line. The value for each keyword should be on the same line as the keyword, separated from it by a space. It looks to me as if the IdentityFile line has a line break in it - fix that. Also - just for neatness, not sure it’s actually necessary - indent the three lines after the Host line.

Now on to your login: It looks to me as if it worked. You have successfully logged in to 18.222.132.35.

I suggest you correct the permissions on Insta_1.pem (use 600 instead of 400, but as you can see it works either way with sudo, because root can read anything).

What files are you saying are “all gone”? Gone from where?

Regards, K.

I don’t think it “logged you out of superuser” - I think it logged you into the remote system :slight_smile:

I already did that all changes, made the path on same line. Then I changed permissions to from 777 to 666
Then I again changed to 400. Nothing worked. I just don’t understand what’s happening?
All the files from /.ssh are gone. Id_rsa, Id_rsa.pub, my .pem file config file all are not there when I automatically logged out of root.

Look carefully at the pictures you sent me. They show, very clearly, that you have successfully logged into 18.222.132.35.

The reason you think things are “gone” is because those things exist on your source system, not on your target system.

From the command prompt “ubuntu@ip-172-31-23-215” type “exit” and press return. You will find yourself back on your source system, and the “missing” items will be there. They never left - you did :slight_smile:

Regards, K.

I mean i was loged out as root user and become normal use. I didn’t really go to my remote machine. but I’m sending you screen shots of my cmd where i changed Insta_1.pen to 600 then try to shh -i ~/.ssh/Insta_1.pem ubuntu@publicIP and it did the same thing as last time.
Logged out of super user and vanished my .pen file.
I really have no idea what’s happening. please tell me what exactly happening, i’m doing something wrong ?

Thanx You’re really helping me so much.

I’m Constantly getting this window. What is this ? sending a new screen shot

I made Changes in my sshd_config file like yes to passwordauthentication and bunch of as shown on youtube. is that problem ? because it won’t be here it’ll give permission errors then .

Even now I directly tried without being an root user but it still shows the same thing . my last logged in details. but before that it may be connect to the client since there were no errors shown. so now I’m completely confused and tried every combination in this week. but no idea what exactly is happening.

sorry i forgot screen shot attachment

(attachments)

Please do this:

Use the AWS EC2 Console to find out the public and private addresses of the system you want to connect FROM. We will call this system “system A”. Please post those details here.

Use the AWS EC2 Console to find out the private and public addresses of the system you want to connect TO. We will call this system “system B”. Please post those details here.

Regards, K.

PS: You do not need PasswordAuthentication, and you should revert any changes you have made to ssh_config or sshd_config.

Good Morning Karl. I just tried Doing the same thing with newly created Instances but same error, you’re right though we don’t have to change anything in sshd_config.

Now I’m sending you screen shots of Master and Client1 instances Public Private IP’s .

(attachments)



So:

“System A” is the one you call “Master”, and has public IP 18.191.161.9. It has the private IP address 172.31.20.219.

“System B” is the one you call “Client”, and has the private IP address 172.31.24.31. I know this because before you changed the prompt to “Client@”, the prompt was “root@ip-172-31-24-31:~#”.

You were logged into System A, and you ran ssh to connect to 18.222.135.76. The next command prompt you saw was “ubuntu@ip-172-31-24-31:~$”. See above - that IP address, 172.31.24.31, is System B.

In other words, you were on System A, ran ssh, and ended up logged into System B. Success!

I do not understand what error you think you are seeing. This is how it is supposed to work.

Remember: You logged into System B as “ubuntu”, not “root”. So you were in a different home directory, with a different ~/.ssh directory.

Also remember that although you are connecting to a public address, in the AWS universe instances don’t know about their own public (or EIP) IPv4 addresses. That is why when you are logged in to AWS instances, you can see only their private addresses.

Regards, K.

PS: None of the steps you did on System B (“Client”) were needed.

I think this thread got derailed - so is there a way to configure volume with the ec2_instance module?

It works with ec2 module but hoping to use the ec2_instance module since it uses boto3 which I am told would help me workaround an issue I am having launching ec2 instances from a server with IAM role attached vs access/secret keys.

Hi all,
please help me.

Build ec2 instances with attaching multiple tags names :-
  For example- I have launched one ec2 instance with tag name "websever1"
the next builds of ec2 instances should start with tag name webserver2 ,
webserver3 .... automatically.

Note: No two ec2 instances have same tag name.