compute_environments
Creates, updates, deletes or gets a compute_environment resource or lists compute_environments in a region
Overview
| Name | compute_environments |
| Type | Resource |
| Description | Resource Type definition for AWS::Batch::ComputeEnvironment |
| Id | awscc.batch.compute_environments |
Fields
- get (all properties)
- list (identifiers only)
| Name | Datatype | Description |
|---|---|---|
compute_environment_arn | string | |
compute_environment_name | string | |
compute_resources | object | |
replace_compute_environment | boolean | |
service_role | string | |
state | string | |
tags | object | A key-value pair to associate with a resource. |
type | string | |
update_policy | object | |
unmanagedv_cpus | integer | |
eks_configuration | object | |
context | string | |
region | string | AWS region. |
| Name | Datatype | Description |
|---|---|---|
compute_environment_arn | string | |
region | string | AWS region. |
For more information, see AWS::Batch::ComputeEnvironment.
Methods
| Name | Resource | Accessible by | Required Params |
|---|---|---|---|
create_resource | compute_environments | INSERT | Type, region |
delete_resource | compute_environments | DELETE | Identifier, region |
update_resource | compute_environments | UPDATE | Identifier, PatchDocument, region |
list_resources | compute_environments_list_only | SELECT | region |
get_resource | compute_environments | SELECT | Identifier, region |
SELECT examples
- get (all properties)
- list (identifiers only)
Gets all properties from an individual compute_environment.
SELECT
region,
compute_environment_arn,
compute_environment_name,
compute_resources,
replace_compute_environment,
service_role,
state,
tags,
type,
update_policy,
unmanagedv_cpus,
eks_configuration,
context
FROM awscc.batch.compute_environments
WHERE
region = 'us-east-1' AND
Identifier = '{{ compute_environment_arn }}';
Lists all compute_environments in a region.
SELECT
region,
compute_environment_arn
FROM awscc.batch.compute_environments_list_only
WHERE
region = 'us-east-1';
INSERT example
Use the following StackQL query and manifest file to create a new compute_environment resource, using stack-deploy.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO awscc.batch.compute_environments (
Type,
region
)
SELECT
'{{ type }}',
'{{ region }}';
/*+ create */
INSERT INTO awscc.batch.compute_environments (
ComputeEnvironmentName,
ComputeResources,
ReplaceComputeEnvironment,
ServiceRole,
State,
Tags,
Type,
UpdatePolicy,
UnmanagedvCpus,
EksConfiguration,
Context,
region
)
SELECT
'{{ compute_environment_name }}',
'{{ compute_resources }}',
'{{ replace_compute_environment }}',
'{{ service_role }}',
'{{ state }}',
'{{ tags }}',
'{{ type }}',
'{{ update_policy }}',
'{{ unmanagedv_cpus }}',
'{{ eks_configuration }}',
'{{ context }}',
'{{ region }}';
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: compute_environment
props:
- name: compute_environment_name
value: '{{ compute_environment_name }}'
- name: compute_resources
value:
allocation_strategy: '{{ allocation_strategy }}'
bid_percentage: '{{ bid_percentage }}'
desiredv_cpus: '{{ desiredv_cpus }}'
ec2_configuration:
- image_id_override: '{{ image_id_override }}'
image_type: '{{ image_type }}'
image_kubernetes_version: '{{ image_kubernetes_version }}'
ec2_key_pair: '{{ ec2_key_pair }}'
image_id: '{{ image_id }}'
instance_role: '{{ instance_role }}'
instance_types:
- '{{ instance_types[0] }}'
launch_template:
launch_template_id: '{{ launch_template_id }}'
launch_template_name: '{{ launch_template_name }}'
version: '{{ version }}'
userdata_type: '{{ userdata_type }}'
overrides:
- launch_template_id: '{{ launch_template_id }}'
launch_template_name: '{{ launch_template_name }}'
version: '{{ version }}'
userdata_type: '{{ userdata_type }}'
target_instance_types:
- '{{ target_instance_types[0] }}'
maxv_cpus: '{{ maxv_cpus }}'
minv_cpus: '{{ minv_cpus }}'
placement_group: '{{ placement_group }}'
security_group_ids:
- '{{ security_group_ids[0] }}'
spot_iam_fleet_role: '{{ spot_iam_fleet_role }}'
subnets:
- '{{ subnets[0] }}'
tags: {}
type: '{{ type }}'
update_to_latest_image_version: '{{ update_to_latest_image_version }}'
- name: replace_compute_environment
value: '{{ replace_compute_environment }}'
- name: service_role
value: '{{ service_role }}'
- name: state
value: '{{ state }}'
- name: tags
value: {}
- name: type
value: '{{ type }}'
- name: update_policy
value:
terminate_jobs_on_update: '{{ terminate_jobs_on_update }}'
job_execution_timeout_minutes: '{{ job_execution_timeout_minutes }}'
- name: unmanagedv_cpus
value: '{{ unmanagedv_cpus }}'
- name: eks_configuration
value:
eks_cluster_arn: '{{ eks_cluster_arn }}'
kubernetes_namespace: '{{ kubernetes_namespace }}'
- name: context
value: '{{ context }}'
UPDATE example
Use the following StackQL query and manifest file to update a compute_environment resource, using stack-deploy.
/*+ update */
UPDATE awscc.batch.compute_environments
SET PatchDocument = string('{{ {
"ReplaceComputeEnvironment": replace_compute_environment,
"ServiceRole": service_role,
"State": state,
"UpdatePolicy": update_policy,
"UnmanagedvCpus": unmanagedv_cpus,
"Context": context
} | generate_patch_document }}')
WHERE
region = '{{ region }}' AND
Identifier = '{{ compute_environment_arn }}';
DELETE example
/*+ delete */
DELETE FROM awscc.batch.compute_environments
WHERE
Identifier = '{{ compute_environment_arn }}' AND
region = 'us-east-1';
Permissions
To operate on the compute_environments resource, the following permissions are required:
- Create
- Read
- Update
- Delete
- List
Batch:CreateComputeEnvironment,
Batch:TagResource,
Batch:DescribeComputeEnvironments,
iam:CreateServiceLinkedRole,
Iam:PassRole,
Eks:DescribeCluster,
ec2:DescribeLaunchTemplateVersions
Batch:DescribeComputeEnvironments
Batch:UpdateComputeEnvironment,
Batch:DescribeComputeEnvironments,
Batch:TagResource,
Batch:UnTagResource,
Iam:PassRole,
Eks:DescribeCluster,
ec2:DescribeLaunchTemplateVersions
Batch:DeleteComputeEnvironment,
Batch:DescribeComputeEnvironments,
Batch:UpdateComputeEnvironment,
Iam:PassRole,
Eks:DescribeCluster,
ec2:DescribeLaunchTemplateVersions
Batch:DescribeComputeEnvironments