Codebuild service usage optimization

1

Hello,

Is there a way to optimize the usage of CodeBuild? We are using the CodeBuild a lot these days, and at times QUEUED phase duration is too high, which may be the reason. Is there a way to reduce this duration, because it is causing huge charges for us? I am open to any suggestions to reduce the billing on CodeBuild compute usage.

Thank you in advance.

VK
已提問 5 個月前檢視次數 2030 次
1 個回答
1
已接受的答案

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

profile pictureAWS
已回答 5 個月前
  • Thank you for replying and detailed information about optimization.

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南