Q: How to connect to EC2 instance via Jenkins pipeline? I have configured my EC2 instance via 'adding cloud' in Jenkins and the test connection was successful. I have also added the same 'Publish over SSH key' section. But when I try to SSH to the instance via my pipeline, it's showing authentication failed.
I have also tried creating a separate folder and added the key file and created pipeline in that and tried ssh-add -l to check connectivity. But that is also not connecting.
Could someone tell me how to link or call the added cloud in my Jenkins pipeline? The action I want to perform is connecting to that instance and perhaps performing a touch command to check connectivity through JENKINS PIPELINE.
