SCP deploy failing port 22: Operation timed out 64 lost connection
Asked by Sai Teja Makani:

image: node:10.15.3  

pipelines:  
branches:  
main:  
- step:  
name: Deploy artifacts using SCP to PROD  
deployment: prod  
script:  
- pipe: atlassian/scp-deploy:0.3.3  
variables:  
USER: $USER  
SERVER: $SERVER  
SSH_KEY: $SSH_KEY  
REMOTE_PATH: '/var/www/html'  
LOCAL_PATH: 'html/\*'

<br />

Below is the error:  
########################  

pipe: atlassian/scp-deploy:0.3.32m 11s  
1
+ docker container run \  
2
--volume=/opt/atlassian/pipelines/agent/build:/opt/atlassian/pipelines/agent/build \  
3
--volume=/opt/atlassian/pipelines/agent/ssh:/opt/atlassian/pipelines/agent/ssh:ro \  
4
--volume=/usr/local/bin/docker:/usr/local/bin/docker:ro \  
5
--volume=/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes:/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes \  
6
--volume=/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes/atlassian/scp-deploy:/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes/atlassian/scp-deploy \  
7
--workdir=$(pwd) \  
8
--label=org.bitbucket.pipelines.system=true \  
9
--env=BITBUCKET_STEP_TRIGGERER_UUID="$BITBUCKET_STEP_TRIGGERER_UUID" \  
10
--env=BITBUCKET_REPO_FULL_NAME="$BITBUCKET_REPO_FULL_NAME" \  
11
--env=BITBUCKET_GIT_HTTP_ORIGIN="$BITBUCKET_GIT_HTTP_ORIGIN" \  
12
--env=BITBUCKET_PROJECT_UUID="$BITBUCKET_PROJECT_UUID" \  
13
--env=BITBUCKET_REPO_IS_PRIVATE="$BITBUCKET_REPO_IS_PRIVATE" \  
14
--env=BITBUCKET_WORKSPACE="$BITBUCKET_WORKSPACE" \  
15
--env=BITBUCKET_DEPLOYMENT_ENVIRONMENT_UUID="$BITBUCKET_DEPLOYMENT_ENVIRONMENT_UUID" \  
16
--env=BITBUCKET_SSH_KEY_FILE="$BITBUCKET_SSH_KEY_FILE" \  
17
--env=BITBUCKET_REPO_OWNER_UUID="$BITBUCKET_REPO_OWNER_UUID" \  
18
--env=BITBUCKET_BRANCH="$BITBUCKET_BRANCH" \  
19
--env=BITBUCKET_REPO_UUID="$BITBUCKET_REPO_UUID" \  
20
--env=BITBUCKET_PROJECT_KEY="$BITBUCKET_PROJECT_KEY" \  
21
--env=BITBUCKET_DEPLOYMENT_ENVIRONMENT="$BITBUCKET_DEPLOYMENT_ENVIRONMENT" \  
22
--env=BITBUCKET_REPO_SLUG="$BITBUCKET_REPO_SLUG" \  
23
--env=CI="$CI" \  
24
--env=BITBUCKET_REPO_OWNER="$BITBUCKET_REPO_OWNER" \  
25
--env=BITBUCKET_STEP_RUN_NUMBER="$BITBUCKET_STEP_RUN_NUMBER" \  
26
--env=BITBUCKET_BUILD_NUMBER="$BITBUCKET_BUILD_NUMBER" \  
27
--env=BITBUCKET_GIT_SSH_ORIGIN="$BITBUCKET_GIT_SSH_ORIGIN" \  
28
--env=BITBUCKET_PIPELINE_UUID="$BITBUCKET_PIPELINE_UUID" \  
29
--env=BITBUCKET_COMMIT="$BITBUCKET_COMMIT" \  
30
--env=BITBUCKET_CLONE_DIR="$BITBUCKET_CLONE_DIR" \  
31
--env=PIPELINES_JWT_TOKEN="$PIPELINES_JWT_TOKEN" \  
32
--env=BITBUCKET_STEP_UUID="$BITBUCKET_STEP_UUID" \  
33
--env=BITBUCKET_DOCKER_HOST_INTERNAL="$BITBUCKET_DOCKER_HOST_INTERNAL" \  
34
--env=DOCKER_HOST="tcp://host.docker.internal:2375" \  
35
--env=BITBUCKET_PIPE_SHARED_STORAGE_DIR="/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes" \  
36
--env=BITBUCKET_PIPE_STORAGE_DIR="/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes/atlassian/scp-deploy" \  
37
--env=LOCAL_PATH="html/*" \  
38
--env=REMOTE_PATH="/var/www/html" \  
39
--env=SERVER="$SERVER" \  
40
--env=SSH_KEY="$SSH_KEY" \  
41
--env=USER="$USER" \  
42
--add-host="host.docker.internal:$BITBUCKET_DOCKER_HOST_INTERNAL" \  
43
bitbucketpipelines/scp-deploy:0.3.3  
44
Unable to find image 'bitbucketpipelines/scp-deploy:0.3.3' locally  
45
0.3.3: Pulling from bitbucketpipelines/scp-deploy  
46
c87736221ed0: Pulling fs layer  
47
aca9d7420f98: Pulling fs layer  
48
0f3ac11eee9e: Pulling fs layer  
49
0f3ac11eee9e: Verifying Checksum  
50
0f3ac11eee9e: Download complete  
51
c87736221ed0: Verifying Checksum  
52
c87736221ed0: Download complete  
53
c87736221ed0: Pull complete  
54
aca9d7420f98: Verifying Checksum  
55
aca9d7420f98: Download complete  
56
aca9d7420f98: Pull complete  
57
0f3ac11eee9e: Pull complete  
58
Digest: sha256:92cc16bb0a383f038bdc2443d0ea83dc390aa2f19beb0f56bf3c77ffff78ef41  
59
Status: Downloaded newer image for bitbucketpipelines/scp-deploy:0.3.3  
60
INFO: Starting SCP deployment to [ec2-35-92-201-11.us-west-2.compute.amazonaws.com](http://ec2-35-92-201-11.us-west-2.compute.amazonaws.com/):/var/www/html...  
61
scp -rp -i /opt/atlassian/pipelines/agent/ssh/id_rsa_tmp [html/index.html](https://bitbucket.org/spotter-technology/palo-alto-ex-dynamic-lists/src/fd4c467266ef19599cd14d51329cd6721387a41e/html/index.html) html/paloalto-whitelists [ubuntu@ec2-35-92-201-11.us-west-2.compute.amazonaws.com](mailto:ubuntu@ec2-35-92-201-11.us-west-2.compute.amazonaws.com):/var/www/html  
62
Warning: Identity file /opt/atlassian/pipelines/agent/ssh/id_rsa_tmp not accessible: No such file or directory.  
63
ssh: connect to host [ec2-35-92-201-11.us-west-2.compute.amazonaws.com](http://ec2-35-92-201-11.us-west-2.compute.amazonaws.com/) port 22: Operation timed out  
64
lost connection  
65
? Deployment failed.


Answers:
author: Ben
body: Hi Sai,

I have executed a telnet connection test command against that remote URL on both port 22 and port 80 and both have failed, this would imply that there is some kind of firewall blocking incoming connections or that the URL is incorrect.

Please review the URL that you are attempting to connect to, and if it is correct - please proceed with whitelisting the IP addresses found in our firewall documentation below:

* <https://support.atlassian.com/bitbucket-cloud/docs/what-are-the-bitbucket-cloud-ip-addresses-i-should-use-to-configure-my-corporate-firewall/>

Hope this helps.

Cheers!

- Ben (Bitbucket Cloud Support)


Tags: bitbucket-cloud

cloud