28

Whenever I start AWS CodeBuild I get this type of error every time. please help.

DOWNLOAD_SOURCE Failed 3 mins, 2 secs

Get https://github.com/themithunbiswas/test-repo.git/info/refs?service=git-upload-pack: dial tcp 192.30.253.113:443: i/o timeout

Mithun Biswas
  • 1,617
  • 1
  • 12
  • 19

4 Answers4

45

The error message indicates that your build doesn't have internet connectivity. If you are setting up a project with VPC config, please check your VPC settings. You can refer to this documentation .Troubleshooting Your VPC Setup section to verify your VPC settings. You may also click the Validate VPC Settings button in CodeBuild's console to check your VPC settings.

Another most likely scenario is your codebuild does not have appropriate permission for accessing code which is either in codecommit,git or s3, if you use wizard to create this it will automatically grant appropriate permission to it.

Hope this helps!

Kush Vyas
  • 5,813
  • 2
  • 26
  • 36
  • 7
    To see "Validate VPC Settings" button you have to start editing the Build Project, the button will be at the bottom of the "VPC" section. – Putnik Nov 12 '18 at 15:13
  • 1
    This button is only available in the old console – Ryan Williams Nov 28 '18 at 04:56
  • 5
    I was forced to do the following to get it working 1) Create a new subnet (for private use only) 2) Create a "NAT Gateway" in that subnet 3) Add a "0.0.0.0/0" route via the NAT Gateway in my "Main" route table 4) Associate the private subnet with the "Main" route table 5) Associate my mixed private/public subnets with an alternate route table 6) Add a "0.0.0.0/0" route via an "Internet Gateway" to my alternate route table – Ryan Williams Nov 28 '18 at 04:57
  • super helpful. changing vpc settings solved it - thank you! – Tamas Kalman Jan 26 '19 at 01:34
  • 2
    The button is now back in the new console – WattsInABox Sep 17 '19 at 17:15
  • I had faced the same issue and the fixed that has worked well, I have shared it here - https://stackoverflow.com/a/74123362/9375172 – Vikash Choudhary Oct 19 '22 at 09:59
3

For a repository in codecommit the NO VPC setting worked fine for me

  • @MichaelWarner Can you elaborate on what do you mean by 'insecure' in this case? Thanks. – Eternal21 Apr 18 '23 at 23:51
  • My stance on this has changed. As with most things it depends on what you are going for. If your codecommit repo is behind a VPC you can build, test, and use your code without it passing through the open internet making it more secure, however you will not have the ability to use things like code pipeline for example lowering development agility. You can read about it here. It all depends on your priorities but in most cases dropping VPC is a ok solution. https://docs.aws.amazon.com/codecommit/latest/userguide/codecommit-and-interface-VPC.html – Michael Warner Apr 19 '23 at 03:07
0

For those arriving here via Google and finding the approved answer doesn't help:

In my case I found the "Source version" setting seen in the "Edit Source" had somehow become blanked out, despite full automated definition via CloudFormation. That in turn led to a wrong branch being checked out, and having the buildspec.yaml in a different location than expected.

Alex R
  • 11,364
  • 15
  • 100
  • 180
-1

if you have defined vpc in codebuild environment settings then select private subnets. It is recommended to use private subnets in this document. Check the security groups selected, it should allow to fetch your code from the source like Amazon S3 or bitbucket