I'm trying to deploy code to an AWS EC2 instance from a Bitbucket Pipeline using SSH, but the SSH connection consistently fails with a timeout error.
Here's my setup ( I have removed the IP in this message for security purposes ):
What I've done so far:
Added my SSH private key as a Bitbucket Repository Variable ($DEV_SSH_KEY)
Created a security group in AWS that allows inbound TCP on port 22 from all Bitbucket outbound IPs listed here (IPV4 outbound IPs about 24 of them).
- Attached the security group to my EC2 instance.
- Confirmed the EC2 instance has a public IP and SSH is enabled.
- Verified the instance is running and accessible from my local machine.
Still, the connection fails from Bitbucket Pipelines. Is there something I'm missing in terms of:
Bitbucket's outbound IPs or network restrictions?
EC2 or security group setup?
Pipeline environment limitations (e.g., needing to use a newer SSH/OpenSSL image)?
Any insights would be much appreciated!