So, I have been struggling with this issue over the weekend and have tried everything that was available on the internet.
The Issue: I need to SSH into my EC2 instance but I'm unable to.
Error: Permission Denied Permission denied (publickey).
Things I've Done:
1. Tried pasting the private public key pair that I have generated from the AWS console (.pem )
2. When the above way didn't work I tried generating the key pairs from the bitbucket pipeline console and pasted the public key in the .ssh/authorized_keys
3. Fetched hosts and added them in my pipeline configuration
4. tried ssh -t ( didn't work ) |
5. tried ssh - i ~./ssh/config root@ip ( didn't work )
pipelines:
default:
- step:
name: Deploy to AWS EC2
deployment: development
caches:
- node
script:
- sudo apt install ssh-askpass
- ssh-keyscan -t rsa bitbucket.org >> ~/.ssh/known_hosts
- ssh $root@$ip 'sudo su && cd /home/ubuntu/scripts && sh deployment.sh'
Can someone please help me out here?