記事:
記事:
ひとつのジョブの中で 2 ~ 10,000 の子ジョブを生成できます。
resource "aws_batch_job_queue" "example" { name = "example" state = "ENABLED" priority = 1 compute_environment_order { order = 1 compute_environment = aws_batch_compute_environment.example.arn } job_state_time_limit_action { action = "CANCEL" max_time_seconds = 600 # 600 ~ 86400 reason = "MISCONFIGURATION:COMPUTE_ENVIRONMENT_MAX_RESOURCE" state = "RUNNABLE" } job_state_time_limit_action { action = "CANCEL" max_time_seconds = 600 # 600 ~ 86400 reason = "MISCONFIGURATION:JOB_RESOURCE_REQUIREMENT" state = "RUNNABLE" } job_state_time_limit_action { action = "CANCEL" max_time_seconds = 600 # 600 ~ 86400 reason = "CAPACITY:INSUFFICIENT_INSTANCE_CAPACITY" state = "RUNNABLE" } }
記事:
記事:
#!/bin/bash INPUT=$1 INPUT=$(bash -c "echo $INPUT") echo "INPUT: $INPUT"
bash entrypoint.sh '$(date +%Y-%m-%d)' INPUT: 2025-01-02
"jobDefinitions": [
{
...
"Parameters": {
"event_time": "2016-12-30T18:44:49Z"
},
...
"containerProperties": {
...
"command": [
"python3",
"./run.py",
"Ref::event_time"
],
aws batch submit-job --parameters event_time="$(date --iso-8601=sec -u)",...
記事:
resource "aws_cloudwatch_event_target" "batch_job" {
for_each = var.batch_job_event_config
rule = aws_cloudwatch_event_rule.batch_job["${each.key}"].name
role_arn = aws_iam_role.events_invoke_batch.arn
arn = aws_batch_job_queue.batch.arn
batch_target {
job_definition = aws_batch_job_definition.batch["${each.value.batch_job_name}"].arn
job_name = "${each.key}"
}
input_transformer {
input_paths = {
event_time = "$.time", # ISO8601. e.g.) 2016-12-30T18:44:49Z
}
input_template = <<EOF
{
"Parameters" : {
"event_time" : <event_time>
}
}
EOF
}
} "containerProperties": {
...
"command": [
"python3",
"./run.py",
"${EVENT_TIME}"
],
aws batch submit-job --container-overrides "environment=[{name=EVENT_TIME,value=$(date --iso-8601=sec -u)}, ...}]"