I have problem with my AWS account

0

I am new to AWS, and currently, I am in the studying process. During my studies, I have encountered several issues. For example:

  • 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 can't attach a new volume to the EC2 instance because when I try to select an instance, there are no instances listed.

I am using the default VPC. I can't continue my course as I believe if I carry on, I will encounter more issues.

Centos9 this error from centos9 for ubuntu another error Ubuntu Ubuntu erro SSH ssh to ec2

Security Group for Instance Enter image description here

Subnets Enter image description here

Route Enter image description here

ACL Enter image description here

logs Enter image description here Enter image description here Enter image description here Enter image description here

Smbat
asked 3 months ago175 views
1 Answer
1

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.

profile picture
EXPERT
answered 3 months ago
profile pictureAWS
EXPERT
reviewed 3 months 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).

  • Regarding connecting to EC2 through SSH, I am still unable to connect, and the response times out.

    Is the Linux user specified when executing the SSH command correct? If you use CentOS9, you can probably connect as "ec2-user".

    ssh -i ./ssh-key.pem ec2-user@EC2-IP-Address
    

    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).

    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

  • In this case i use ubuntu, but for centos same error 'time out'.

    Select the relevant EC2 and show the security group settings. There may be something wrong with the security group settings.

    Exactly, my volume and instance both are in eu-west-3 AZ. In attached images you can see it

    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

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions