- Newest
- Most votes
- Most comments
Hello.
I can't SSH to my EC2 instance (sometimes it works, but only for Ubuntu and only from the AWS console, not from the SSH agent) when in the security group, I use 'anywhere' instead of my IP.
I think it is not possible to connect because EC2 Instance Connect is not preinstalled on CentOS.
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-connect-prerequisites.html
Therefore, please connect to EC2 once using an ssh command etc. without connecting from the management console.
Once connected, run the following command.
Wait a while after executing the command, and then try connecting from the management console.
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-connect-set-up.html
mkdir /tmp/ec2-instance-connect
curl https://amazon-ec2-instance-connect-us-west-2.s3.us-west-2.amazonaws.com/latest/linux_amd64/ec2-instance-connect.rpm -o /tmp/ec2-instance-connect/ec2-instance-connect.rpm
curl https://amazon-ec2-instance-connect-us-west-2.s3.us-west-2.amazonaws.com/latest/linux_amd64/ec2-instance-connect-selinux.noarch.rpm -o /tmp/ec2-instance-connect/ec2-instance-connect-selinux.rpm
sudo yum install -y /tmp/ec2-instance-connect/ec2-instance-connect.rpm /tmp/ec2-instance-connect/ec2-instance-connect-selinux.rpm
I can't attach a new volume to the EC2 instance because when I try to select an instance, there are no instances listed.
This is because the availability zone specified when creating the EBS volume is different from EC2.
You cannot select EC2 unless you create the EBS volume in the same availability zone as the EC2 you want to attach.
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-volumes.html
The volume and instance must be in the same Availability Zone.
Relevant content
- asked 5 months ago
- asked 2 years ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 6 months ago
- AWS OFFICIALUpdated 3 months ago
- AWS OFFICIALUpdated 3 years ago
Thank you for your response. Regarding connecting to EC2 through SSH, I am still unable to connect, and the response times out.
As for the volumes, I have created a new volume and ensured that both the volume and instances are in the same availability zone (AZ).
Is the Linux user specified when executing the SSH command correct? If you use CentOS9, you can probably connect as "ec2-user".
Even if you create EBS in the same availability zone as EC2, can you not select EC2?
In this case i use ubuntu, but for centos same error 'time out'. Exactly, my volume and instance both are in eu-west-3 AZ. In attached images you can see it
Select the relevant EC2 and show the security group settings. There may be something wrong with the security group settings.
As you can see in the image, EBS is created with "eu-west-3a" and EC2 is started with "eu-west-3c". From this it is clear that they are in different availability zones. I think you're probably confusing regions and availability zones. Please check the following document for the difference between regions and availability zones. https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html
Please find last attached scrinshot regarding sg.
I am sorry, its my fail. With EBS now everything is OK