Registry / aws / aws-cdk-aws-batch

aws-cdk-aws-batch

JSON →
library1.204.0pypypi✓ verified 85d ago

The CDK Construct Library for AWS::Batch, enabling you to define and deploy AWS Batch resources (compute environments, job queues, job definitions) as infrastructure as code. Version 1.204.0 is a v1 release (maintenance mode) with monthly cadence. The stable v2 counterpart is 'aws-cdk-lib/aws-batch'.

pip install aws-cdk-aws-batch
INSTALL
IMPORT
SIG · AWS-CDK-AWS-BATCH
A
aws-cdk-aws-batch
awspythonv1.204.0
Install
11.0s avg
Import
Disk
92MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.204.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 86.4MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 11.0s · import 0.000s · 87MB
92MB installed
● package 92MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Batch
from aws_cdk.aws_batch import CfnComputeEnvironment, CfnJobQueue, CfnJobDefinition
from aws_cdk_aws_batch import ...
The pip package is 'aws-cdk-aws-batch' but the import namespace is 'aws_cdk.aws_batch' (underscored).
ComputeEnvironment
from aws_cdk.aws_batch import CfnComputeEnvironment
from aws_cdk.aws_batch import ComputeEnvironment
In v1, only L1 CloudFormation resources (Cfn*) are available. L2 constructs (e.g., ComputeEnvironment) exist in v2.

Create a simple AWS Batch compute environment and job queue using L1 CloudFormation resources.

import aws_cdk as cdk from aws_cdk.aws_batch import CfnComputeEnvironment, CfnJobQueue, CfnJobDefinition app = cdk.App() stack = cdk.Stack(app, 'MyBatchStack') compute_env = CfnComputeEnvironment(stack, 'MyComputeEnv', type='MANAGED', service_role='arn:aws:iam::123456789012:role/AWSBatchServiceRole', compute_resources=CfnComputeEnvironment.ComputeResourcesProperty( type='EC2', minv_cpus=0, maxv_cpus=256, desiredv_cpus=0, instance_types=['c5.large'], subnets=['subnet-12345678'], security_group_ids=['sg-12345678'] ) ) job_queue = CfnJobQueue(stack, 'MyJobQueue', job_queue_name='MyQueue', compute_environment_order=[ CfnJobQueue.ComputeEnvironmentOrderProperty( compute_environment=compute_env.ref, order=1 ) ] ) app.synth()
cdk --version
Debug
Known issues
deprecatedaws-cdk-aws-batch v1 is in maintenance mode. No new features, only critical bug fixes. Migrate to v2 for full support.
fix
Use 'aws-cdk-lib/aws-batch' with CDK v2.
affects: >=1.0.0, <2.0.0
breakingIn v1, only L1 CloudFormation resources (Cfn*) exist. L2 constructs like aws_batch.ComputeEnvironment were introduced in v2.
fix
Use Cfn* constructs or migrate to CDK v2 for L2 constructs.
affects: >=1.0.0
gotchaThe pip package name is 'aws-cdk-aws-batch', but the import path is 'aws_cdk.aws_batch' (hyphens become underscores).
fix
Import from 'aws_cdk.aws_batch', not 'aws_cdk_aws_batch'.
affects: all
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'aws_cdk_aws_batch'
Incorrect import path; the package name uses hyphens, but the import uses underscores.
fix
Use 'from aws_cdk.aws_batch import ...'
'module' object has no attribute 'ComputeEnvironment'
Trying to use L2 construct in v1; only Cfn* resources exist.
fix
Use CfnComputeEnvironment instead, or upgrade to CDK v2.
AttributeError: 'list' object has no attribute 'to_string'
Misuse of Cfn* property structure; e.g., passing a list where a single value is expected.
fix
Check the CloudFormation resource specification and use the correct Property objects.
Upgrade
Version history
1.204.0latest on PyPI · released Jun 19, 2023
Audit
Dependencies
aws-cdk-librequiredCore CDK library, version must be >=1.204.0, <2.0
Agent activity
25 hits · last 30 days
node
20
OpenAI (training)
2
Resources
aws-cdk-aws-batch — pip install aws-cdk-aws-batch · libregistry