CodeBuild has an on-demand fleet, which scales based on incoming customer volume. If capacity is not immediately available, CodeBuild tries to queue the builds for additional capacity to be available in the build fleet. So, QUEUED time is vary based on the resources availability with respect to availability of resources in region. Unfortunately, we do not have any option to reduce Code Build QUEUED phase duration. As said, it is subject to availability and allocation of resources to provision build container in particular region. More importantly, CodeBuild charges are applicable from PROVISIONING phase and QUEUED phase duration not calculated towards billing.
The following are some additional options for cost optimization in relation to CodeBuild.
Rightsize your compute resources. CodeBuild allows you to choose from different compute types like BUILD_GENERAL1_SMALL to BUILD_GENERAL3_LARGE. Choosing an appropriately sized instance based on your build workload can help reduce costs.
Use AWS Graviton processors where possible. Graviton processors on EC2 instances offer better price performance compared to x86 based instances and can lower your CodeBuild costs.
Keep build durations short. CodeBuild charges per minute, so optimizing builds to complete faster helps minimize costs. Some ways to do this include only running necessary steps, using caching, and addressing inefficiencies.
Leverage build caching. Caching dependencies, artifacts, and previous build steps can avoid unnecessary recompilation and testing, speeding up builds.
Additionally, I would suggest to verify the compute environments selected and analyze the past month usage metrics Memory and CPU. Based on that data, check the feasibility in selecting lower compute environments to reduce the cost. [+] Monitoring CodeBuild resource utilization metrics: https://docs.aws.amazon.com/codebuild/latest/userguide/monitoring-utilization-metrics.html [+] Build environment compute modes and types: https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-compute-types.html#environment.types
- AWS OFFICIALUpdated 10 months ago
- How do I resolve the "error pulling image configuration: toomanyrequests" error when I use Docker images in AWS CodeBuild?AWS OFFICIALUpdated 10 months ago
- AWS OFFICIALUpdated 6 months ago
- EXPERTpublished 4 months ago