job_definitions
Creates, updates, deletes or gets a job_definition resource or lists job_definitions in a region
Overview
| Name | job_definitions |
| Type | Resource |
| Description | Resource Type definition for AWS::Batch::JobDefinition |
| Id | awscc.batch.job_definitions |
Fields
- get (all properties)
- list (identifiers only)
| Name | Datatype | Description |
|---|---|---|
container_properties | object | |
ecs_properties | object | |
node_properties | object | |
job_definition_name | string | |
job_definition_arn | string | |
scheduling_priority | integer | |
parameters | object | |
platform_capabilities | array | |
propagate_tags | boolean | |
retry_strategy | object | |
timeout | object | |
type | string | |
tags | object | A key-value pair to associate with a resource. |
eks_properties | object | |
consumable_resource_properties | object | |
region | string | AWS region. |
| Name | Datatype | Description |
|---|---|---|
job_definition_name | string | |
region | string | AWS region. |
For more information, see AWS::Batch::JobDefinition.
Methods
| Name | Resource | Accessible by | Required Params |
|---|---|---|---|
create_resource | job_definitions | INSERT | Type, region |
delete_resource | job_definitions | DELETE | Identifier, region |
update_resource | job_definitions | UPDATE | Identifier, PatchDocument, region |
list_resources | job_definitions_list_only | SELECT | region |
get_resource | job_definitions | SELECT | Identifier, region |
SELECT examples
- get (all properties)
- list (identifiers only)
Gets all properties from an individual job_definition.
SELECT
region,
container_properties,
ecs_properties,
node_properties,
job_definition_name,
job_definition_arn,
scheduling_priority,
parameters,
platform_capabilities,
propagate_tags,
retry_strategy,
timeout,
type,
tags,
eks_properties,
consumable_resource_properties
FROM awscc.batch.job_definitions
WHERE
region = 'us-east-1' AND
Identifier = '{{ job_definition_name }}';
Lists all job_definitions in a region.
SELECT
region,
job_definition_name
FROM awscc.batch.job_definitions_list_only
WHERE
region = 'us-east-1';
INSERT example
Use the following StackQL query and manifest file to create a new job_definition resource, using stack-deploy.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO awscc.batch.job_definitions (
Type,
region
)
SELECT
'{{ type }}',
'{{ region }}';
/*+ create */
INSERT INTO awscc.batch.job_definitions (
ContainerProperties,
EcsProperties,
NodeProperties,
JobDefinitionName,
SchedulingPriority,
Parameters,
PlatformCapabilities,
PropagateTags,
RetryStrategy,
Timeout,
Type,
Tags,
EksProperties,
ConsumableResourceProperties,
region
)
SELECT
'{{ container_properties }}',
'{{ ecs_properties }}',
'{{ node_properties }}',
'{{ job_definition_name }}',
'{{ scheduling_priority }}',
'{{ parameters }}',
'{{ platform_capabilities }}',
'{{ propagate_tags }}',
'{{ retry_strategy }}',
'{{ timeout }}',
'{{ type }}',
'{{ tags }}',
'{{ eks_properties }}',
'{{ consumable_resource_properties }}',
'{{ region }}';
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: job_definition
props:
- name: container_properties
value:
command:
- '{{ command[0] }}'
environment:
- name: '{{ name }}'
value: '{{ value }}'
image: '{{ image }}'
job_role_arn: '{{ job_role_arn }}'
memory: '{{ memory }}'
mount_points:
- container_path: '{{ container_path }}'
read_only: '{{ read_only }}'
source_volume: '{{ source_volume }}'
privileged: '{{ privileged }}'
readonly_root_filesystem: '{{ readonly_root_filesystem }}'
ulimits:
- hard_limit: '{{ hard_limit }}'
name: '{{ name }}'
soft_limit: '{{ soft_limit }}'
user: '{{ user }}'
vcpus: '{{ vcpus }}'
volumes:
- host:
source_path: '{{ source_path }}'
efs_volume_configuration:
file_system_id: '{{ file_system_id }}'
root_directory: '{{ root_directory }}'
transit_encryption: '{{ transit_encryption }}'
transit_encryption_port: '{{ transit_encryption_port }}'
authorization_config:
access_point_id: '{{ access_point_id }}'
iam: '{{ iam }}'
name: '{{ name }}'
resource_requirements:
- type: '{{ type }}'
value: '{{ value }}'
linux_parameters:
devices:
- host_path: '{{ host_path }}'
container_path: '{{ container_path }}'
permissions:
- '{{ permissions[0] }}'
init_process_enabled: '{{ init_process_enabled }}'
max_swap: '{{ max_swap }}'
swappiness: '{{ swappiness }}'
shared_memory_size: '{{ shared_memory_size }}'
tmpfs:
- container_path: '{{ container_path }}'
size: '{{ size }}'
mount_options:
- '{{ mount_options[0] }}'
log_configuration:
log_driver: '{{ log_driver }}'
options: {}
secret_options:
- name: '{{ name }}'
value_from: '{{ value_from }}'
execution_role_arn: '{{ execution_role_arn }}'
secrets:
- null
network_configuration:
assign_public_ip: '{{ assign_public_ip }}'
fargate_platform_configuration:
platform_version: '{{ platform_version }}'
ephemeral_storage:
size_in_gi_b: '{{ size_in_gi_b }}'
runtime_platform:
operating_system_family: '{{ operating_system_family }}'
cpu_architecture: '{{ cpu_architecture }}'
repository_credentials:
credentials_parameter: '{{ credentials_parameter }}'
enable_execute_command: '{{ enable_execute_command }}'
- name: ecs_properties
value:
task_properties:
- containers:
- command:
- '{{ command[0] }}'
environment:
- null
depends_on:
- container_name: '{{ container_name }}'
condition: '{{ condition }}'
name: '{{ name }}'
image: '{{ image }}'
linux_parameters: null
log_configuration: null
mount_points:
- null
essential: '{{ essential }}'
privileged: '{{ privileged }}'
readonly_root_filesystem: '{{ readonly_root_filesystem }}'
ulimits:
- null
user: '{{ user }}'
secrets:
- null
repository_credentials: null
resource_requirements:
- null
firelens_configuration:
type: '{{ type }}'
options: {}
ephemeral_storage: null
execution_role_arn: '{{ execution_role_arn }}'
runtime_platform: null
network_configuration: null
volumes:
- null
pid_mode: '{{ pid_mode }}'
ipc_mode: '{{ ipc_mode }}'
platform_version: '{{ platform_version }}'
task_role_arn: '{{ task_role_arn }}'
enable_execute_command: '{{ enable_execute_command }}'
- name: node_properties
value:
num_nodes: '{{ num_nodes }}'
main_node: '{{ main_node }}'
node_range_properties:
- target_nodes: '{{ target_nodes }}'
container:
command:
- '{{ command[0] }}'
environment:
- null
image: '{{ image }}'
job_role_arn: '{{ job_role_arn }}'
memory: '{{ memory }}'
mount_points:
- null
privileged: '{{ privileged }}'
readonly_root_filesystem: '{{ readonly_root_filesystem }}'
ulimits:
- null
user: '{{ user }}'
vcpus: '{{ vcpus }}'
volumes:
- null
instance_type: '{{ instance_type }}'
resource_requirements:
- null
linux_parameters: null
log_configuration: null
execution_role_arn: '{{ execution_role_arn }}'
secrets:
- null
ephemeral_storage: null
runtime_platform: null
repository_credentials: null
enable_execute_command: '{{ enable_execute_command }}'
ecs_properties:
task_properties:
- containers:
- null
execution_role_arn: '{{ execution_role_arn }}'
volumes:
- null
pid_mode: '{{ pid_mode }}'
ipc_mode: '{{ ipc_mode }}'
task_role_arn: '{{ task_role_arn }}'
enable_execute_command: '{{ enable_execute_command }}'
eks_properties:
pod_properties:
service_account_name: '{{ service_account_name }}'
host_network: '{{ host_network }}'
dns_policy: '{{ dns_policy }}'
init_containers:
- name: '{{ name }}'
image: '{{ image }}'
image_pull_policy: '{{ image_pull_policy }}'
command:
- '{{ command[0] }}'
args:
- '{{ args[0] }}'
env:
- name: '{{ name }}'
value: '{{ value }}'
resources:
limits: {}
requests: {}
volume_mounts:
- name: '{{ name }}'
mount_path: '{{ mount_path }}'
sub_path: '{{ sub_path }}'
read_only: '{{ read_only }}'
security_context:
run_as_user: '{{ run_as_user }}'
run_as_group: '{{ run_as_group }}'
privileged: '{{ privileged }}'
allow_privilege_escalation: '{{ allow_privilege_escalation }}'
read_only_root_filesystem: '{{ read_only_root_filesystem }}'
run_as_non_root: '{{ run_as_non_root }}'
containers:
- null
volumes:
- name: '{{ name }}'
host_path:
path: '{{ path }}'
empty_dir:
medium: '{{ medium }}'
size_limit: '{{ size_limit }}'
secret:
secret_name: '{{ secret_name }}'
optional: '{{ optional }}'
persistent_volume_claim:
claim_name: '{{ claim_name }}'
read_only: '{{ read_only }}'
image_pull_secrets:
- name: '{{ name }}'
metadata:
labels: {}
annotations: {}
namespace: '{{ namespace }}'
share_process_namespace: '{{ share_process_namespace }}'
consumable_resource_properties:
consumable_resource_list:
- consumable_resource: '{{ consumable_resource }}'
quantity: '{{ quantity }}'
instance_types:
- '{{ instance_types[0] }}'
- name: job_definition_name
value: '{{ job_definition_name }}'
- name: scheduling_priority
value: '{{ scheduling_priority }}'
- name: parameters
value: {}
- name: platform_capabilities
value:
- '{{ platform_capabilities[0] }}'
- name: propagate_tags
value: '{{ propagate_tags }}'
- name: retry_strategy
value:
attempts: '{{ attempts }}'
evaluate_on_exit:
- on_exit_code: '{{ on_exit_code }}'
on_status_reason: '{{ on_status_reason }}'
on_reason: '{{ on_reason }}'
action: '{{ action }}'
- name: timeout
value:
attempt_duration_seconds: '{{ attempt_duration_seconds }}'
- name: type
value: '{{ type }}'
- name: tags
value: {}
- name: eks_properties
value: null
- name: consumable_resource_properties
value: null
UPDATE example
Use the following StackQL query and manifest file to update a job_definition resource, using stack-deploy.
/*+ update */
UPDATE awscc.batch.job_definitions
SET PatchDocument = string('{{ {
"ContainerProperties": container_properties,
"EcsProperties": ecs_properties,
"NodeProperties": node_properties,
"SchedulingPriority": scheduling_priority,
"Parameters": parameters,
"PlatformCapabilities": platform_capabilities,
"PropagateTags": propagate_tags,
"RetryStrategy": retry_strategy,
"Timeout": timeout,
"Type": type,
"Tags": tags,
"EksProperties": eks_properties,
"ConsumableResourceProperties": consumable_resource_properties
} | generate_patch_document }}')
WHERE
region = '{{ region }}' AND
Identifier = '{{ job_definition_name }}';
DELETE example
/*+ delete */
DELETE FROM awscc.batch.job_definitions
WHERE
Identifier = '{{ job_definition_name }}' AND
region = 'us-east-1';
Permissions
To operate on the job_definitions resource, the following permissions are required:
- Create
- Read
- Update
- Delete
- List
Batch:RegisterJobDefinition,
Batch:TagResource,
Batch:DescribeJobDefinitions,
Iam:PassRole
Batch:DescribeJobDefinitions
Batch:DescribeJobDefinitions,
Batch:RegisterJobDefinition,
Batch:DeregisterJobDefinition,
Batch:TagResource,
Batch:UntagResource,
Iam:PassRole
Batch:DescribeJobDefinitions,
Batch:DeregisterJobDefinition,
Iam:PassRole
Batch:DescribeJobDefinitions