class ComputeEnvironment (construct)
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.Batch.ComputeEnvironment |
Java | software.amazon.awscdk.services.batch.ComputeEnvironment |
Python | aws_cdk.aws_batch.ComputeEnvironment |
TypeScript (source) | @aws-cdk/aws-batch » ComputeEnvironment |
Implements
IConstruct
, IConstruct
, IDependable
, IResource
, ICompute
Batch Compute Environment.
Defines a batch compute environment to run batch jobs on.
Example
declare const vpc: ec2.Vpc;
const myComputeEnv = new batch.ComputeEnvironment(this, 'ComputeEnv', {
computeResources: {
image: new ecs.EcsOptimizedAmi({
generation: ec2.AmazonLinuxGeneration.AMAZON_LINUX_2,
}),
vpc,
}
});
Initializer
new ComputeEnvironment(scope: Construct, id: string, props?: ComputeEnvironmentProps)
Parameters
- scope
Construct
- id
string
- props
Compute
Environment Props
Construct Props
Name | Type | Description |
---|---|---|
compute | string | A name for the compute environment. |
compute | Compute | The details of the required compute resources for the managed compute environment. |
enabled? | boolean | The state of the compute environment. |
managed? | boolean | Determines if AWS should manage the allocation of compute resources for processing jobs. |
service | IRole | 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. |
computeEnvironmentName?
Type:
string
(optional, default: CloudFormation-generated name)
A name for the compute environment.
Up to 128 letters (uppercase and lowercase), numbers, hyphens, and underscores are allowed.
computeResources?
Type:
Compute
(optional, default: CloudFormation defaults)
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.
enabled?
Type:
boolean
(optional, default: true)
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.
managed?
Type:
boolean
(optional, default: true)
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.
serviceRole?
Type:
IRole
(optional, default: Role using the 'service-role/AWSBatchServiceRole' policy.)
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.
Properties
Name | Type | Description |
---|---|---|
compute | string | The ARN of this compute environment. |
compute | string | The name of this compute environment. |
env | Resource | The environment this resource belongs to. |
node | Construct | The construct tree node associated with this construct. |
stack | Stack | The stack in which this resource is defined. |
computeEnvironmentArn
Type:
string
The ARN of this compute environment.
computeEnvironmentName
Type:
string
The name of this compute environment.
env
Type:
Resource
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.
node
Type:
Construct
The construct tree node associated with this construct.
stack
Type:
Stack
The stack in which this resource is defined.
Methods
Name | Description |
---|---|
apply | Apply the given removal policy to this resource. |
to | Returns a string representation of this construct. |
static from | Fetches an existing batch compute environment by its amazon resource name. |
RemovalPolicy(policy)
applypublic applyRemovalPolicy(policy: RemovalPolicy): void
Parameters
- policy
Removal
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
).
String()
topublic toString(): string
Returns
string
Returns a string representation of this construct.
ComputeEnvironmentArn(scope, id, computeEnvironmentArn)
static frompublic static fromComputeEnvironmentArn(scope: Construct, id: string, computeEnvironmentArn: string): IComputeEnvironment
Parameters
- scope
Construct
- id
string
- computeEnvironmentArn
string
Returns
Fetches an existing batch compute environment by its amazon resource name.