Security groups - port 22: Connection refused

0

Hello,
I'm having trouble accessing an instance via SSH.
I have the VPN working and I can access other instances, that is, my keys are working. I've already managed to access this instance but after rebooting via console I'm getting the message "port 22: Connection refused". The security groups are applied correctly and in theory the rules are correct, I applied, for testing, the default security group but the message remained the same, has anyone experienced this problem? Do you know what it could be?
It appears that security groups are not being applied.

Thank you guys.

asked 4 years ago260 views
1 Answer
0

This dependency failures during the boot process has resulted the instance to start in emergency mode.

In General , If here is an issue with the fstab entries saved in /etc/fstab file in the instance the instance is would be not reachable, you need to detach the boot volume of the instance, attach it to a temporary instance as a data volume, make changes in the /etc/fstab file and reattach it back to the original instance to resolve the issue. Please follow the below steps to move forward with this option. I recommend you to take an instance back up by creating an Image first for data retention purpose.

Steps for recovery:-

  1. Stop the original instance..
  2. Detach the root volume.
  3. Attach the root volume to another instance as a secondary volume in the same Availability Zone for recovery.
  4. SSH into the recovery instance.
  5. Mount the volume from the original instance inside the recovery instance (Use "lsblk" to find the correct device name):
    sudo mount /dev/xvdf1 /mnt
    cd /mnt
    At this point, the root directory "/" of the original instance is available at "/mnt" in the recovery instance.
  6. Troubleshoot the issue based on a given scenario.
    Change the root to the attached volume.
    First, check the fstab entries of the instance.
    $ sudo cat /mnt/etc/fstab
    Based on the output, comment out all the lines of fstab except mounting the root volume itself. Since instance is throwing an error for mount, it is important to start the instance without mounting any additional data volumes. Save the changes.
    7.Disconnect from the instance.

To return the volume to the original instance:-

  1. Unmount the volume.
    sudo umount /mnt
  2. Detach the volume from the recovery instance.
  3. Remount the volume on the original instance as the root volume (e.g. /dev/sda1).
  4. Start the instance and SSH into the instance.
    At this point, instance should be up and running without any data volumes attached, you can manually mount the data volumes using the following command.
    $ lsblk # check the volumes
    Mount device name using a mount point directory, following is one such example.
    $ sudo mount /dev/xvdf1 /mnt1

Filesystems like ’s3fs’ or ‘FUSE over s3fs’ are purely third-party tools that Amazon neither advertises nor does it recommend its customers to use it. Please note that as S3 is huge distributed object storage system we do not recommend mounting S3 buckets and using them as a shared storage.

I would recommend you to consider the Amazon Elastic File System (Amazon EFS) as a alternative for your Linux-based workloads for use with AWS Cloud services and on-premises resources.t is designed to provide massively parallel shared access to thousands of Amazon EC2 instances, enabling your applications to achieve high levels of aggregate throughput and IOPS with consistent low latencies.
For more information on EFS, I request you to refer the documentation link of EFS service. Reference: https://docs.aws.amazon.com/efs/latest/ug/whatisefs.html

answered 4 years ago

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