Skip to content

fix(aws-ssi): retry stack up in-process on InsufficientInstanceCapacity - #8041

Draft
cbeauchesne wants to merge 1 commit into
mainfrom
cbeauchesne/retry-insufficient-instance-capacity
Draft

cbeauchesne wants to merge 1 commit into
mainfrom
cbeauchesne/retry-insufficient-instance-capacity

Conversation

@cbeauchesne

Copy link
Copy Markdown
Collaborator

Motivation

Several AWS SSI jobs fail on EC2 capacity errors, e.g. in pipeline 144379440:

creating EC2 Instance: InsufficientInstanceCapacity: We currently do not have sufficient t4g.medium capacity
in the Availability Zone you requested (us-east-1c). [...] You can currently get t4g.medium capacity by [...]
choosing us-east-1a, us-east-1b, us-east-1d, us-east-1f.

This error was neither retried in-process (only IdempotentParameterMismatch was) nor listed in the known infra exceptions. So the job failed with exit code 1, and GitLab never retried it.

Changes

  • _stack_up_with_idempotency_retry is renamed to _stack_up_with_retry. It also retries on InsufficientInstanceCapacity: it excludes the subnet that failed, destroys the stack, waits 30s, then runs the stack up again on another subnet (3 attempts in total, same as before).
  • The new _pick_subnet_id picks randomly among subnets that haven't failed yet. If all of them have failed, it picks among all subnets.
  • InsufficientInstanceCapacity is added to aws_infra_exceptions.json, so if every attempt fails the job exits with code 3 and GitLab retries it.

Note: a retry only reaches another AZ if the subnets in ONBOARDING_AWS_INFRA_SUBNET_ID are in different AZs.

Workflow

  1. ⚠️ Create your PR as draft ⚠️
  2. Work on you PR until the CI passes
  3. Mark it as ready for review
    • Tests, manifest, weblog are modified -> you'll need a review from system-tests-reviewers: ask to one of youre co-worker familiar with the tested feature.
    • Framework is modified, or non obvious usage of it -> get a review from system-tests-core (slack)

🚀 Once your PR is reviewed and the CI green, you can merge it!

🛟 #apm-shared-testing 🛟

🤖 Generated with Claude Code

When the AZ of the randomly chosen subnet has no capacity for the instance
type, retry the stack up excluding that subnet, so another AZ can be tried.
Also add it to the known infra exceptions, so that if every attempt fails
the job exits with code 3 and gets retried by GitLab.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

CODEOWNERS have been resolved as:

utils/virtual_machine/aws_infra_exceptions.json                         @DataDog/system-tests-core
utils/virtual_machine/aws_provider.py                                   @DataDog/system-tests-core

@cbeauchesne
cbeauchesne marked this pull request as ready for review October 14, 2026 09:05
@cbeauchesne
cbeauchesne requested a review from a team as a code owner October 14, 2026 09:05
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-14T09:07:52.986632Z 3344574 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant