How do I resolve unexpected CodeBuild AccountLimitExceededException error?

0

I have a CodeBuild project that was created by AWS Control Tower Account Factory for Terraform.

Every time I tried to "Start build" in the console, it spits out following error:

Build failed to Start. The following error occurred: Cannot have more than 0 builds in queue for the account

Log events from CloudWatch:

[ERROR] 2022-02-27T01:01:56.498Z 5aaae098-f77f-457d-8ff8-ee202b27c308 {'FILE': 'codebuild_invoker.py', 'METHOD': 'lambda_handler', 'EXCEPTION': 'An error occurred (AccountLimitExceededException) when calling the StartBuild operation: Cannot have more than 0 builds in queue for the account'} Traceback (most recent call last): File "/var/task/codebuild_invoker.py", line 30, in lambda_handler job_id = client.start_build(projectName=codebuild_project_name)["build"]["id"] File "/var/runtime/botocore/client.py", line 386, in _api_call return self._make_api_call(operation_name, kwargs) File "/var/runtime/botocore/client.py", line 705, in _make_api_call raise error_class(parsed_response, operation_name) botocore.errorfactory.AccountLimitExceededException: An error occurred (AccountLimitExceededException) when calling the StartBuild operation: Cannot have more than 0 builds in queue for the account

[ERROR] 2022-02-27T01:01:56.498Z 5aaae098-f77f-457d-8ff8-ee202b27c308 {'FILE': 'codebuild_invoker.py', 'METHOD': 'lambda_handler', 'EXCEPTION': 'An error occurred (AccountLimitExceededException) when calling the StartBuild operation: Cannot have more than 0 builds in queue for the account'} Traceback (most recent call last): File "/var/task/codebuild_invoker.py", line 30, in lambda_handler job_id = client.start_build(projectName=codebuild_project_name)["build"]["id"] File "/var/runtime/botocore/client.py", line 386, in _api_call return self._make_api_call(operation_name, kwargs) File "/var/runtime/botocore/client.py", line 705, in _make_api_call raise error_class(parsed_response, operation_name) botocore.errorfactory.AccountLimitExceededException: An error occurred (AccountLimitExceededException) when calling the StartBuild operation: Cannot have more than 0 builds in queue for the account

Any pointer to solve the error?

4 Answers
1

Update:

I tried CodeBuild StartBuild from an account that was not managed by Control Tower and it works as expected.

So I'm assuming that this is caused by some configuration in the Control Tower managed account. Checked the SCP and GuardRails but does not look like there is any related restriction to CodeBuild nor the services that it uses (IAM, CloudWatch).

answered 2 years ago
1

There are various account level quotas that AWS sets for new and existing accounts. Some of the quotas protect you from unpredicted cost skyrocketing when you just start the cloud journey, the other ones might be applied if AWS detects something unusual in your accounts (e.g. an open vulnerability, an expired credit card, ...)

The best way to resolve this issue is contacting AWS Support and requesting the quota increase for the number of concurrent builds in AWS CodeBuild in that account. If there are some things than need to be fixed in your account first, you will be informed about that. Otherwise, the quota will be increased, so you can run your builds in AWS CodeBuild.

profile pictureAWS
answered 2 years ago
0

Submitting an AWS Support ticket for Service Limit Increase of CodeBuild Maximum Number of Concurrent Builds fixed this for me. It is odd though that the default AWS value in ServiceQuota for "Concurrently running builds" is 60, but we still need to ask AWS support for service increase.

Neal
answered a year ago
0

I faced this problem recently and after researching a lot on google I ended up raising a support ticket to increase me build quota. After increase, I was able to build and this error was not coming any more.

On side note, in case anyone face this error and they still want to try and test buildspec.yml, it is possible to do that in the local environment using CodeBuild agent. Here is the full documentation for this - https://docs.aws.amazon.com/codebuild/latest/userguide/use-codebuild-agent.html

answered 8 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions