Can't connect to EC2 instance via Putty [closed] - amazon-web-services

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
I am doing Team Project about Web Server and streaming.
One of my team member has created Instance, and I want to use that instance.
He and I are both IAM user.
But when I tried to use SSH connect by PUTTY, there was an error:
no supported authentication methods available (server sent publickey)
Is it because trying to access with my IAM account, but the owner of that instance is my team member? How can I connect his AWS EC2 instance with my account (using PUTTY)?
Thank you.

This error is similar like setting up AWS SSH for the first time, possible problems?
Incorrect .ppk file, Wrong username, Wrong IP.
Also check permission of your pem file
/folder/ec2-user/ - 700
/folder/ec2-user/.ssh/ -600
/folder/ec2-user/.ssh/authorized_keys - 600
This post may answer your question https://stackoverflow.com/a/46112210/13126651
if it doesnt
First of all make sure your security group attached to Ec2-instace allows inbound connection to ssh on port 22
the usual default username in EC2 for these Linux distro:
Amazon Linux: ec2-user
Ubuntu: ubuntu
Debian : admin
then, if you are using :
Windows - get PEM key from AWS website and generate PPK file using PuttyGen. Then use Putty to use the PPK (select it using left-column: Connection->SSH->Auth: Private key for authorization)
for Linux
Linux - run: ssh -i your-ssh-key.pem login#IP-or-DNS
there is one more sleek method to connect to your instance which doesn't require any pem file from your end since authentication key is stored on was side
To access the instance through a browser, make sure you add a rule in your security group to allow port 80 and port 443 inbound.
under your instance, you can see connect, click on it and select connect using the browser
Aws doc for troubleshooting, this error check this

Related

Hosting a Windows server 2016 on GCP

I have a Static Public IP RDP Windows server I want to host through GCP,so as to get the Security Feature to secure my server from RDP Attack and other...
What to Do ?
Since your question is very broad I can only suggest to improve your servers's security:
Go to your firewall settings in GCP console and set check/set up some rules:
limit the number of IP's able to connect via RDP (leave just the ones you need)
make sure ICMP response is turned off
block all TCP/UDP ports and leave only the ones you use (like RDP)
You can check what rules are already in place when you create your VPC (in automatic mode you get some prepoulated rules that allow to ping or rdp to an instances).
Lastly - - install all the latest updates on the server - it will also improve the security of your VM/
You can read more for example here - how to harden your 2016 machine.
These are just simple rules to make your machine much more secure. If you want more detailed solution then update your question and put some more details about your use case.

Disabling the firewall in Ubuntu on an Amazon EC2 instance [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 5 years ago.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Improve this question
How do I disable the Ubuntu server firewall running inside an amazon instance, though, without using ssh. I am not able to access via ssh because of the timeout error, I think it has a firewall on the server blocking but I can not disable it precisely because it can not access. I need to somehow disable it, directly from the Amazon web console. How do I do?
I already configured the security group in several ways, so I finally left it, with all the ports open for testing.
My route table is:
My ACLs is:
My instance settings:
Already tried to connect like this using openssh:
ssh -i "c: \ key \ owlcom.pem" ubuntu#ec2-54-149-193-61.us-west-2.compute.amazonaws.com
and so
ssh -i "C: \ key \ owlcom.pem" X.X.X.X <- elastic ip
and so
ssh -i "C: \ key \ owlcom.pem" ubuntu#x.x.x.x
none of them works on any of my computers using openssh or putty., setting the putty correctly with the key.ppk
NOTE: You will have to have access to the AWS dashboard in order to follow this procedure:
In your AWS Dashboard, please go to Services > Compute > EC2 so you can see all your EC2 instances (make sure you are in the correct region).
Once in the EC2 dashboard, go to the "Instances" tab. Once there, locate the instance in which you want to disable the firewall. Click in it and you should be able to see a summary of the instance in the lower part of the website. After that, go to the Security Group section and click on "view inbound rules". There you will be able to see all the open ports your instance has.
To modify such ports, you actually need to modify the Security Group rules your instance is attached to. To do so, click in the security group name in the panel where the "view inbound rules" was. It should take you to another page where you will be able to edit all the firewall rules.
I hope this helps!
Cheers!
It probably isn't an Ubuntu firewall issue. It is likely that it is a security group configuration problem.
AWS by defaults limits the access to your instance quite heavily but to enable it you will need to add your ip address a security group used by your instance.
To do this (Assuming you are using IPv4):
To add a rule to a security group for inbound SSH traffic over IPv4 using the console
In the navigation pane of the Amazon EC2 console, choose Instances.
Select your instance and look at the Description tab; Security
groups lists the security groups that are associated with the
instance. Choose view rules to display a list of the rules that are
in effect for the instance.
In the navigation pane, choose Security Groups. Select one of the security groups associated with your instance.
In the details pane, on the Inbound tab, choose Edit. In the dialog, choose Add Rule, and then choose SSH from the Type list.
In the Source field, choose My IP to automatically populate the field with the public IPv4 address of your local computer. Alternatively, choose Custom and specify the public IPv4 address of your computer or network in CIDR notation. For example, if your IPv4 address is 203.0.113.25, specify 203.0.113.25/32 to list this single IPv4 address in CIDR notation. If your company allocates addresses from a range, specify the entire range, such as 203.0.113.0/24.
In the Source field, choose My IP to automatically populate the field with the public IPv4 address of your local computer. Alternatively, choose Custom and specify the public IPv4 address of your computer or network in CIDR notation. For example, if your IPv4 address is 203.0.113.25, specify 203.0.113.25/32 to list this single IPv4 address in CIDR notation. If your company allocates addresses from a range, specify the entire range, such as 203.0.113.0/24.
Choose Save.
SOURCE: Amazon Web Services Docs

How to connect two Ec2 Instance so that they can Communicate with each other [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
The community reviewed whether to reopen this question 15 days ago and left it closed:
Not suitable for this site This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Improve this question
I want to connect two EC2 instances with each other so that they can communicate with each other.
One will have Wordpress installed, and the 2nd will have a database configured (e.g. Mysql/Mariadb).
I found the problem in the way we can connect 2 EC2 instances with each other by using private IP.
To keep it very simple, For any two programs to communicate with each other over a network, you need two things
IP Address
Port Number
Consider you have two EC2 instances. Lets name them
Instance1
Instance2
On each of these instances, you must be having some programs between which you want the communication to take place. Also, these programs must be running on a PORT of the instance. For example, tomcat instance runs on port 8080 by default. Lets name our programs:-
Program1 (program running on Instance1), running on port 1000
Program2 (program running on Instance2), running on port 2000
Let us first talk about Program1 running on port 1000 of Instance1.
Log onto AWS Console
Click on EC2 Service
In the left panel, click on Security Groups
Click on the button Create Security Group
An overlay will open.
Put-in the name and description of your choosing
Click on the tab Inbound and click on Add Rule
Here, you are adding which port should accept connections.
Set the following details:-
-Type: Custom TCP Rule
-Protocol: TCP
-Port Range: 1000 [Or any other port on which your program runs]
-Source: External IP from where Program1 can be accessed. It can be "Everywhere", "My IP" or a "Custom IP"
Click on the tab Outbound and click on Add Rule
Repeat Step 9, if you want outbound communication.
Repeat these steps on Instance2 and you will be good to go.
Well , you can launch the instances in a amazon VPC , then infront of your App server you can place a Load balancer for traffic. The VPC must have a internet gateway attached to it as well.
To access the whole VPC , you can create a jumpbox/bastion host.
Based on your "Ec# Scenario" image, you can add your "application server" & "backend server" under respective load balancer & can communicate with each other using LB name/end-point url. This would ensure, even if the underling EC2 instance shutdown/re-instanced, the communication won't break.

What is blocking this Nginx site on Amazon EC2? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
I have recently signed up for the Amazon Web Service Free Tier and started an EC2 instance. I installed Nginx on this server and started the service. The problem is that whenever I try to navigate to the public DNS provided by Amazon's EC2 Management Console, I receive "This page can't be displayed".
I have added a new security group within the EC2 Management Console providing access to port 80, 22, and 443 (to 0.0.0.0/0).
I have verified nginx is running by
ps -ef | grep nginx
and it returned
I verified it is listening on port 80 by running
netstat -pant | grep :80
and it returned
I verified the default site is enabled in the .conf file and contains the "Welcome to Nginx" message.
Any ideas what could be blocking the site?
Turns out I did not need to create a new security group. I had to edit an existing one, opening the HTTP port. I'm not sure what the security group I created did, but it's gone now.

How to create your own VPN on an instance and route your other instance through this VPN? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 5 years ago.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Improve this question
I understand that a VPC Amazon instance has the ability to create VPN connections but at a cost of $.05 per hour. Is it possible to create your own VPN on an instance and then route your other instance through this VPN? It seems like it would be more cost efficient? What are the pros/cons?
I understand that a VPC Amazon instance has the ability...
To clarify, your virtual environment in Amazon VPC is typically referred to as "a VPC," not "a VPC instance." A "VPC instance" typically refers to an EC2 instance that is provisioned inside a VPC.
A fixed VPN connection can be provisioned from Amazon VPC to a hardware device at your location, and this incurs the $0.05/hour charge (essentially $37.20/mo) you mentioned. This fee is charged for as long as the the connection is provisioned on the AWS side, whether it is properly configured on your side, and working, or not... because what you are paying for is the use of Amazon's hardware to accommodate the VPN.
To me, this seems like a ridiculously good deal, because my VPC VPN connections -- once established -- pretty much "just work," and if the underlying hardware fails, it seems a reasonable assumption that AWS's proactive monitoring will detect that condition and the hardware would be replaced with no real effort required from me.
But, yes, it's entirely possible to provision a VPN with EC2 instances, but to have a similar level of resiliency compared to what you have if you use the native solution, you would need at least 2 EC2 instances, for failover.
This Amazon article explains how to connect two different VPCs to each other via a VPN using EC2 machines -- since this is not something the native solution supports -- but it does not take much imagination at all to understand how you could use exactly the same logic to tie your corporate network into a VPC with a very comparable design to what's shown here.
The only thing, though, is that the $0.05/hour is cheaper than the price of an on-demand "m1.small" instance, at $0.06/hour, so unless you wanted to prepay for more discounts or try to use "micro" instances to connect your networks together, the native solution provided by VPC seems like a no-brainer.
Understand, though, that the native solution (that is, the VPN service offered by AWS as part of VPC) is only for fixed site-to-site (your-site-to-AWS) connections... it has nothing to do with remote users tunneling into your VPC. For ad-hoc on-demand connections that provide individual users with the ability to tunnel into your VPC, you'd need to roll your own solution.
It possible just install OpenVPN on your NAT instance, for example have a look on article:
Amazon AWS VPC Setting up OpenVPN server
Create an Ubuntu instance
This instance will serve as the OpenVPN server. I am using Ubuntu 12.04 LTS
Set up a VPC security group
Before I can create this instance I need to create a new VPC security group for it.
From the VPN console open Security Groups and click on Create Security Group
Name it openvpn and associate it with your VPC, then click create.
Select the Details tab and make not of the group ID, in this case its
sg-cd7c94a2
Select the Inbound tab and select the SSH rule and click Add Rule.
Select Custom UDP rule set the port range to 1194 for OpenVPN. Click Add Rule.
Select Custom TCP rule and enter 943 for the port range click Add Rule.
Select Custom TCP rule and enter 946 for the port range and click Add Rule
Select HTTPS and click Add Rule
Click Apply Rule Changes.
Here are the Security rules
Select Subnets and copy the ID of the public subnet, in my case its subnet-4c657627
Start the instance
Now start the instance
> ec2-run-instances ami-9c78c0f5 -b /dev/sda1=:8:true -k pats-keypair -t t1.micro -s subnet-4c657627 -g sg-cd7c94a2 --private-ip-address 10.0.0.99 --availability-zone us-east-1a
Change Source /Dest Check
From the EC2 console select the newly made instance and right click and select “Change Source / Dest Check”
Click Yes, Disable
Give it an elastic IP
From the VPC console select Elastic IPs and click Allocate New Address
Make sure its set to VPC and click Yes, Allocate
Click on associate Address
Select the instance that was just created and click on Yes, Associate
SSH into the new instance
To confirm its up and running SSH into this box
> ssh -i .ec2/pats-keypair.pem ubuntu#107.23.79.220
Install OpenVPN
You need to download the OpenVPN software from openvpn.net. This version of the software is free to use for two users, otherwise it costs $5 per user per year, but require a minimum of 10 users so $50 per year, which is not a bad deal. https://openvpn.net/index.php/access-server/pricing.html [2]
From the OpenVPN machine run the following commands
> wget https://swupdate.openvpn.org/as/openvpn-as-1.8.4-Ubuntu10.amd_64.deb
> sudo dpkg –i openvpn-as-1.8.4-Ubuntu10.amd_64.deb
After the install is done you will see the admin web interface address displayed
The admin needs a password for the openvpn user run the following command to set it.
> sudo passwd openvpn
I just set mine to adminpass for test purposes.
Configure OpenVPN
Open up OpenVPN admin web page at
https:// 107.23.79.220 :943/admin
Of course enter your static IP address for it.
You will see something like this, click on proceed anyway
The admin login page will now display. Enter the user name openvpn and the password you assigned to that user, then click Sign in
Click Agree for the license terms
Click on Server Network Settings
Enter the Elastic IP address in the hostname field
Scroll to the bottom of the page and click Save Settings
Click Update Running Server
Click on VPN settings
Scroll down to the routing section and add all your subnets to this section. I only have 2 subnets 10.0.0.0/24 and 10.0.1.0/24
Scroll down and click Save Settings
Click on Update Running Server
Set up Client machine
Open up https:// 107.23.79.220 / in a web browser (change the IP address for your own.
Login as the openvpn user and click go
Click on “Click here to continue” This will download software you need to your system to connect to this VPN
Install the software, on a windows machine you can right click on the download and click Open
Then click Run
This window should pop up, click Yes to create the tunnel.
The web site should now report that it is up.
To test this out I am going to attempt to ssh into my instances
I have the following instances
10.0.0.20
10.0.1.30
10.0.0.25 NAT from aws
10.0.0.99
Test Connection
From my cygwing command line:
ssh -i .ec2/pats-keypair.pem ubuntu#10.0.0.20