ComputeEnvironment

class aws_cdk.aws_batch.ComputeEnvironment(scope, id, *, compute_environment_name=None, compute_resources=None, enabled=None, managed=None, service_role=None)

Bases: aws_cdk.core.Resource

(experimental) Batch Compute Environment.

Defines a batch compute environment to run batch jobs on.

Stability

experimental

Example:

# vpc is of type Vpc

my_compute_env = batch.ComputeEnvironment(self, "ComputeEnv",
    compute_resources=batch.ComputeResources(
        image=ecs.EcsOptimizedAmi(
            generation=ec2.AmazonLinuxGeneration.AMAZON_LINUX_2
        ),
        vpc=vpc
    )
)
Parameters
  • scope (Construct) –

  • id (str) –

  • compute_environment_name (Optional[str]) – (experimental) A name for the compute environment. Up to 128 letters (uppercase and lowercase), numbers, hyphens, and underscores are allowed. Default: - CloudFormation-generated name

  • compute_resources (Optional[ComputeResources]) – (experimental) The details of the required compute resources for the managed compute environment. If specified, and this is an unmanaged compute environment, will throw an error. By default, AWS Batch managed compute environments use a recent, approved version of the Amazon ECS-optimized AMI for compute resources. Default: - CloudFormation defaults

  • enabled (Optional[bool]) – (experimental) The state of the compute environment. If the state is set to true, then the compute environment accepts jobs from a queue and can scale out automatically based on queues. Default: true

  • managed (Optional[bool]) – (experimental) Determines if AWS should manage the allocation of compute resources for processing jobs. If set to false, then you are in charge of providing the compute resource details. Default: true

  • service_role (Optional[IRole]) – (experimental) The IAM role used by Batch to make calls to other AWS services on your behalf for managing the resources that you use with the service. By default, this role is created for you using the AWS managed service policy for Batch. Default: - Role using the ‘service-role/AWSBatchServiceRole’ policy.

Stability

experimental

Methods

apply_removal_policy(policy)

Apply the given removal policy to this resource.

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you’ve removed it from the CDK application or because you’ve made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).

Parameters

policy (RemovalPolicy) –

Return type

None

to_string()

Returns a string representation of this construct.

Return type

str

Attributes

compute_environment_arn

(experimental) The ARN of this compute environment.

Stability

experimental

Attribute

true

Return type

str

compute_environment_name

(experimental) The name of this compute environment.

Stability

experimental

Attribute

true

Return type

str

env

The environment this resource belongs to.

For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.

Return type

ResourceEnvironment

node

The construct tree node associated with this construct.

Return type

ConstructNode

stack

The stack in which this resource is defined.

Return type

Stack

Static Methods

classmethod from_compute_environment_arn(scope, id, compute_environment_arn)

(experimental) Fetches an existing batch compute environment by its amazon resource name.

Parameters
  • scope (Construct) –

  • id (str) –

  • compute_environment_arn (str) –

Stability

experimental

Return type

IComputeEnvironment

classmethod is_construct(x)

Return whether the given object is a Construct.

Parameters

x (Any) –

Return type

bool

classmethod is_resource(construct)

Check whether the given construct is a Resource.

Parameters

construct (IConstruct) –

Return type

bool