Skip to content

feat(batch): add consumableResourceProperties to job definitions#35827

Closed
matoom-nomu wants to merge 5 commits intoaws:mainfrom
matoom-nomu:feat/add-consumableResourceProperties-support
Closed

feat(batch): add consumableResourceProperties to job definitions#35827
matoom-nomu wants to merge 5 commits intoaws:mainfrom
matoom-nomu:feat/add-consumableResourceProperties-support

Conversation

@matoom-nomu
Copy link
Copy Markdown
Contributor

@matoom-nomu matoom-nomu commented Oct 23, 2025

Issue None

Reason for this change

AWS Batch Job Definitions now support Consumable Resource Properties, which allow jobs to specify and consume shared resources like software licenses or API call quotas. This feature was missing from the CDK construct library.

Description of changes

  • Added support for consumableResourceProperties in AWS Batch Job Definitions
  • Added ConsumableResourceProperties and ConsumableResource interfaces to define the structure
  • Updated EcsJobDefinitionProps, EksJobDefinitionProps, and MultiNodeJobDefinitionProps to include the optional consumableResourceProperties field

Describe any new or updated permissions being added

None

Description of how you validated changes

  • Added unit test.
  • Added integration test.

Checklist


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@aws-cdk-automation aws-cdk-automation requested a review from a team October 23, 2025 12:59
@github-actions github-actions bot added repeat-contributor [Pilot] contributed between 3-5 PRs to the CDK p2 labels Oct 23, 2025
@matoom-nomu matoom-nomu changed the title add consumableResourceProperties to jobDefinition feat(batch): add consumable resource properties to job definitions Oct 23, 2025
@matoom-nomu matoom-nomu changed the title feat(batch): add consumable resource properties to job definitions feat(batch): add consumableResourceProperties to job definitions Oct 23, 2025
@aws-cdk-automation aws-cdk-automation added the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Nov 27, 2025
},
consumableResourceProperties: baseJobDefinition.consumableResourceProperties ? {
consumableResourceList: baseJobDefinition.consumableResourceProperties.consumableResourceList.map(req => ({
consumableResource: req.consumableResource,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The property definition (docs) requires that this resource must match a pattern: arn:[a-z0-9-\.]{1,63}:[a-z0-9-\.]{0,63}:[a-z0-9-\.]{0,63}:[a-z0-9-\.]{0,63}:[^/].{0,1023}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for review.
Sounds I'd prefer to make consumableResource L2 construct and pass IConsumableResource to job-definition, I'll make another PR to create consumableResource L2 construct first.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for review. Sounds I'd prefer to make consumableResource L2 construct and pass IConsumableResource to job-definition, I'll make another PR to create consumableResource L2 construct first.

↑ I made PR about this.
#36971 feat(batch): add ConsumableResource L2 construct

consumableResourceProperties: baseJobDefinition.consumableResourceProperties ? {
consumableResourceList: baseJobDefinition.consumableResourceProperties.consumableResourceList.map(req => ({
consumableResource: req.consumableResource,
quantity: req.quantity,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs token resolution validation + input validation to ensure the quantity is > 0

if (!Token.isUnresolved(req.quantity)) {
        if (req.quantity <= 0 || !Number.isInteger(req.quantity)) {
          throw new Error(
            `Consumable resource at index ${index} must have a positive integer quantity, got: ${req.quantity}`
          );
        }
      }

@vishaalmehrishi vishaalmehrishi self-assigned this Feb 11, 2026
@aws-cdk-automation aws-cdk-automation removed the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Feb 11, 2026
@vishaalmehrishi
Copy link
Copy Markdown
Contributor

The what's new post says

you can associate up to 5 CRs with your AWS Batch jobs while creating or updating AWS Batch job definitions

I don't see this limit specified in the service quotas though. Is it possible to create a job with more than 5 consumable resources locally and check if it succeeds? If the limit is 5, the CDK code should add this validation.

@matoom-nomu
Copy link
Copy Markdown
Contributor Author

The what's new post says

you can associate up to 5 CRs with your AWS Batch jobs while creating or updating AWS Batch job definitions

I don't see this limit specified in the service quotas though. Is it possible to create a job with more than 5 consumable resources locally and check if it succeeds? If the limit is 5, the CDK code should add this validation.

i confirmed CR configuration is limited to 5 per job definition in the management console.
and it seems there is no service quota configuration for it.
so i'll add validation about this as you say.

@aws-cdk-automation
Copy link
Copy Markdown
Collaborator

This PR has been in the CHANGES REQUESTED state for 3 weeks, and looks abandoned. Note that PRs with failing linting check or builds are not reviewed, please ensure your build is passing

To prevent automatic closure:

  • Resume work on the PR
  • OR request an exemption by adding a comment containing 'Exemption Request' with justification e.x "Exemption Request: "
  • OR request clarification by adding a comment containing 'Clarification Request' with a question e.x "Clarification Request: "

This PR will automatically close in 14 days if no action is taken.

@matoom-nomu matoom-nomu marked this pull request as draft March 18, 2026 02:09
@aws-cdk-automation
Copy link
Copy Markdown
Collaborator

This PR has been deemed to be abandoned, and will be automatically closed. Please create a new PR for these changes if you think this decision has been made in error.

@aws-cdk-automation aws-cdk-automation added the closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. label Mar 19, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 19, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. p2 repeat-contributor [Pilot] contributed between 3-5 PRs to the CDK

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants