2 Answers
- Newest
- Most votes
- Most comments
6
Would suggest:
- Stop the affected instance.
- Detach the root EBS volume from it.
- Attach the volume to a temporary EC2 instance (same OS preferred).
- SSH into the rescue instance and mount the attached volume.
- Chroot into the mounted volume:
- Set a new password using passwd ec2-user or passwd root
- Unmount and detach the volume, then reattach it to the original instance as /dev/sda1.
- Start the original instance and SSH in as usual.
0
You can also try logging in using SSM Session Manager. To login with SSM, the EC2 will need to have an IAM role and it must have the SSM agent installed. Complete instructions here - https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-getting-started.html
Relevant content
asked 2 years ago

It's my EMR on EC2 cluster, not just the EC2 instance. Does this solution still work?