Run command ec2-instance-connect ssh #8026
-
How could I pass commands to SSH tty after connecting through ec2-instance-connect? I could ssh in to my instance using the command which is private no public iP
This is working great after setting up the ec2 end points I wanted to pass a command, since it is based on OpenSSH, in ssh I do something like this
Similarly i am looking how to pass Linux commands following the SSH |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Hi @sandeza-admin - thanks for reaching out and sorry for not getting to you sooner. I understand that you were able to connect your EC2 instance using OpenSSH client with AWS CLI command. Can you elaborate more on what you're trying accomplish as I'm trying to understand when you asked
Here are some of the resources that I think you might find it helpful: Hope that helps! |
Beta Was this translation helpful? Give feedback.
-
@aBurmeseDev thanks for the reply I am using AWS CLI command ec2-instance-connect which let me to login EC2 instances without private key (not literally) this is working fine. However after login I wanted to pass a command which needs to be executed. I wanted to pass this along with the login command. Similar to RemoteCommand or ssh -t 'command; bash -l' |
Beta Was this translation helpful? Give feedback.
-
I had this same question. It's not as straightforward, but it appears that piping to it appears to work.
Note that the login banner will be included in the output. If you need the output for something, you might want to skip that using sed or something. |
Beta Was this translation helpful? Give feedback.
Hi @sandeza-admin - thanks for reaching out and sorry for not getting to you sooner. I understand that you were able to connect your EC2 instance using OpenSSH client with AWS CLI command. Can you elaborate more on what you're trying accomplish as I'm trying to understand when you asked
Here are some of the resources that I think you might find it helpful:
Hope that helps!
John