Codebuild Project fails at DOWNLOAD_SOURCE Phase
August 2, 2020
August 2, 2020
If you’re like me, you don’t run a custom VPC all the time in your AWS development account. I generally use the default VPC when I can to avoid the costs that occur when spinning up my own VPC.
I’ve been on this kick lately to get rid of the pain of having to set things up all the time when I start development. I want things like code pipelines super easy to set up and tear down. I’ve been handling this with Cloudformation templates. When I do set up my Cloudformation templates though, I want them to work in the default VPC as well as a VPC I might spin up. Either way, I run everything in a defined VPC.
One thing to keep in mind when you are using your default VPC is that there are no Endpoints defined for AWS services. I recently ran into an issue where I was building out a Codepipeline for my Lambda and was running into an issue where the Codebuild project was hanging on the DOWNOAD_SOURCE phase.
I scratched my head for about 30 minutes before I realized that since I was defining the codebuild project to spin up an instance inside my VPC, in this case, my default VPC, that it was having trouble getting to S3.
As soon as I realized this, I went to the VPC console and added an endpoint for s3 into my VPC and made it accessible by all my subnets. I then realized that perhaps logs would have the same problem. But I wanted to test this out so I ran it again. As you can see below, I got passed the DOWNLOAD_SOURCE and the build was marked successfully, but I got another error.
The error states “: RequestError: send request failed caused by: Post https://logs.us-east-1.amazonaws.com/: dial tcp 126.96.36.199:443: i/o timeout”
This happens because all the subnets in the default VPC are public. The error isn’t that big a deal in development, so we’ll let slide.
Once done, CodeBuild was happy. And happy is good.
Advanced Data Engineering Platform for Cleansing, Preprocessing and Analytics