I'm trying to connect in SSH to my AWS EC2 into my bitbucket pipelines.
I've generate and setup a KEY pair in AWS (Key pair name :
ShareaDreamKP)
From this, I add the public key and private key into my bitbucket SSH keys
I also add all my know host.
Then, when I try to connect in SSH using this :
"ssh ubuntu@ec2-52-29-215-157.eu-central-1.compute.amazonaws.comPseudo-terminal will not be allocated because stdin is not a terminal.Permission denied (publickey)."
It's not working...
So I try to follow the guide to use multiple SSH keys (https://confluence.atlassian.com/bitbucket/use-ssh-keys-in-bitbucket-pipelines-847452940.html#UseSSHkeysinBitbucketPipelines-UsemultipleSSHkeysinyourpipeline)
a) I have put my base64 keys into my Environment variables as "MY_SSH_KEYS"
b) My public key is installed on AWS (/home/ubuntu/.ssh/authorized_keys)
c) I try to add manually a the root of my repository a my_known_hosts file with my pubic key and my host.
d) I change my pipelines to this :
pipelines: branches: dev: - step: script: - mkdir -p ~/.ssh - cat my_known_hosts >> ~/.ssh/known_hosts - (umask 077 ; echo $MY_SSH_KEY | base64 --decode > ~/.ssh/id_rsa) - ssh -i ubuntu@ec2-52-29-215-157.eu-central-1.compute.amazonaws.com - sudo npm run dev
Still not working... I don't know what I can do !
Please, help me !
What worked for me is to put the SSH Key from your screenshot into the /home/ubuntu/.ssh/authorized_keys file on a new line. The .ssh folder must be set up with drwx------ or the server will refuse it...that was a gotcha for me.
It looks like you already have your known_hosts set in Pipelines so that should be ok.
Then you should be able to just
ssh ubuntu@ec2-52-29-215-157.eu-central-1.compute.amazonaws.com
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.