How to connect same AWS EC2 instance from work and home? - amazon-web-services

I have EC2 instance running in AWS. I can access it using SSH client and private key at work. Now, I want to connect to same instance from home using Ubuntu 18.04 OS. So I copied the private key and tried using SSH commands from ubuntu terminal. But I didn't work and AWS was saying that access is denied.
I am not good with networking and security stuff. Can anyone help me on how I can access my AWS EC2 instance from ubuntu at home?

I managed to get it working finally. I went to the directory location where the key file is stored on Ubuntu terminal and then typed chmod 400 <yourPrivateKey.pem> and hit enter. Nothing happened. Then type SSH command to connect to my AWS EC2 instance. That's it, I got connected. Now, I really don't know what has happened there and how secure it is to connect this way. Any help is much appreciated.
Thanks.

Related

Jenkins not connecting to AWS EC2 instance via SSH

I am trying to connect to an EC2 instance from Jenkins via SSH. I always get failure in the end. I am storing the SSH key in a global credential.
This is the task and shell, using SSH agent plugin
This is how I store the key (the whole key has been pasted in)
If I am using SSH connection from my local PC, everything is fine. I am a newbie in Jenkins so this is very chaotic for me.
you need to use SSH plugin . download the plugin using Manage Jenkins and configure
the ec2 in SSH remote.
follow the steps in this link
https://www.thesunflowerlab.com/blog/jenkins-aws-ec2-instance-ssh/

Default username for ec2 instance spawned by elastic beanstalk

I'm trying to use elastic beanstalk to deploy an application and one of the things I need to do is be able to log into the underlying ec2 instance and add dependencies. I added a key pair to the instance and put the private key file in ~/.ssh on my computer. Next I specified the key pair for the ec2 instance and it restarted and eventually the status was green
When I try to ssh into the ec2 instance I get the following error:
$ ssh ec2-user#myinstance.us-east-1.elasticbeanstalk.com
ec2-user#myinstance.us-east-1.elasticbeanstalk.com: Permission denied (publickey).
In the docs is says this could be due to an incorrect username.
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/TroubleshootingInstancesConnecting.html
Does anyone know what the default username is for ec2 instances created by elastic beanstalk?
Also if I'm doing this all wrong would appreciate some pointers there too.
1.To make sure that the there's no mistake the way you connect:
Go to EC2-> Instances
Select your instance
And press Connect
You should get the command to connect from the instructions from the Connect Popup. The correct username is mentioned there plus instructiins on how to set the correct permissions on the pem (applies to linux)
2.
Make sure that you modified the security group of the instance you're trying to connect do that it allows ssh from the ip of your pc. (This is not the case for the question, since the error is Permission denied (publickey), it means that it's not an sg issue, thx #diego)
3.
Also if you connect from a corporate network, try connecting from another network. It might be firewall issue.
4.
Last but not least make sure you ssh inside the .ssh path, or provide the correct pem path

No Supported Authentification Methods AWS EC2 Instance with PuTTY

I am a newbie to SSH and want to connect to my AWS EC2 instance using PuTTY to host a Discord bot. I have generated a RSA private key using the EC2 guide and have configured PuTTY as far as importing private keys and entering hostname.
I am pretty sure I entered the information right that I got from EC2. I'm not really sure if I can get log files either. I have seen other issues like this but no one seemed to be using AWS.
Redownloaded the .pem file. Sorry for wasting your time. Thanks

What should be my host name in putty configuration for setting up SSH server?

I am setting up a node.js server on AWS EC2 using putty configurations.There I found to configure putty.I stuck filling the hostname of EC2 in putty.What will be the hostname can anyone Help?
screenshot of putty config :
Note: I have an EC2 instance launched which I have connect with this.
You can give the public ip of your ec2 instance there. which you can find in the aws management console. Attached is the screen-shot for the same.
Let me know if you are not able to connect with this method.
After generating the key .ppk go to SSH-->Auth-->Browse the .ppk key,
save it and load then open.
Log in with ec2-user.
If you want to give a try, we developed an alternative CLI for AWS that makes this much easier: awless.
It should work on Windows too and with awless, you don't need to set either your IP address nor username, just awless ssh i-1234 or awless ssh my-instance-name.
Note that you may also need to add: -i path/to/your/key.pem if the key was not created with awless.

Run ipython/jupyter notebook server on aws ec2 without an ssh client

I can set up a ipython/jupyter notebook server on aws ec2 by following this tutorial, it starts the remote server by entering $jupyter notebook in the local terminal.
However I also saw a pre-configured community AMI graphlab-create, which will run the remote server without the need of a Linux/Unix ssh client at all.
I'm wondering how that could be realized, since some students may not have an access to a linux/unix system. Any hint is appreciated.
Using windows is not an issue. I hooked up to my notebook in AWS from my home computer. I have Windows 10.
You can link up to AWS using putty.
I am using a Ubuntu AMI.
Once you have a terminal open you simply follow the instruction you gave in your link
It worked like a charm for me.