Referensi: skenario AWS Batch pekerjaan menggunakan EcsProperties - AWS Batch

Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris.

Referensi: skenario AWS Batch pekerjaan menggunakan EcsProperties

Untuk mengilustrasikan bagaimana definisi AWS Batch pekerjaan yang digunakan EcsProperties dapat disusun berdasarkan kebutuhan Anda, topik ini menyajikan RegisterJobDefinitionmuatan berikut. Anda dapat menyalin contoh-contoh ini ke dalam file, menyesuaikannya dengan kebutuhan Anda, dan kemudian menggunakan AWS Command Line Interface (AWS CLI) untuk memanggilRegisterJobDefinition.

AWS Batch pekerjaan untuk Amazon ECS di Amazon EC2

Berikut ini adalah contoh AWS Batch pekerjaan untuk Amazon Elastic Container Service di Amazon Elastic Compute Cloud:

{ "jobDefinitionName": "multicontainer-ecs-ec2", "type": "container", "ecsProperties": { "taskProperties": [ { "containers": [ { "name": "c1", "essential": false, "command": [ "echo", "hello world" ], "image": "public.ecr.aws/amazonlinux/amazonlinux:latest", "resourceRequirements": [ { "type": "VCPU", "value": "2" }, { "type": "MEMORY", "value": "4096" } ] }, { "name": "c2", "essential": true, "command": [ "echo", "hello world" ], "image": "public.ecr.aws/amazonlinux/amazonlinux:latest", "resourceRequirements": [ { "type": "VCPU", "value": "6" }, { "type": "MEMORY", "value": "12288" } ] } ] } ] } }

AWS Batch pekerjaan untuk Amazon ECS di Fargate

Berikut ini adalah contoh AWS Batch pekerjaan untuk Amazon Elastic Container Service di AWS Fargate:

{ "jobDefinitionName": "multicontainer-ecs-fargate", "type": "container", "platformCapabilities": [ "FARGATE" ], "ecsProperties": { "taskProperties": [ { "containers": [ { "name": "c1", "command": [ "echo", "hello world" ], "image": "public.ecr.aws/amazonlinux/amazonlinux:latest", "resourceRequirements": [ { "type": "VCPU", "value": "2" }, { "type": "MEMORY", "value": "4096" } ] }, { "name": "c2", "essential": true, "command": [ "echo", "hello world" ], "image": "public.ecr.aws/amazonlinux/amazonlinux:latest", "resourceRequirements": [ { "type": "VCPU", "value": "6" }, { "type": "MEMORY", "value": "12288" } ] } ], "executionRoleArn": "arn:aws:iam::1112223333:role/ecsTaskExecutionRole" } ] } }

AWS Batch pekerjaan untuk Amazon EKS

Berikut ini adalah contoh AWS Batch pekerjaan untuk Amazon Elastic Kubernetes Service:

{ "jobDefinitionName": "multicontainer-eks", "type": "container", "eksProperties": { "podProperties": { "shareProcessNamespace": true, "initContainers": [ { "name": "init-container", "image": "public.ecr.aws/amazonlinux/amazonlinux:2", "command": [ "echo" ], "args": [ "hello world" ], "resources": { "requests": { "cpu": "1", "memory": "512Mi" } } }, { "name": "init-container-2", "image": "public.ecr.aws/amazonlinux/amazonlinux:2", "command": [ "echo", "my second init container" ], "resources": { "requests": { "cpu": "1", "memory": "512Mi" } } } ], "containers": [ { "name": "c1", "image": "public.ecr.aws/amazonlinux/amazonlinux:2", "command": [ "echo world" ], "resources": { "requests": { "cpu": "1", "memory": "512Mi" } } }, { "name": "sleep-container", "image": "public.ecr.aws/amazonlinux/amazonlinux:2", "command": [ "sleep", "20" ], "resources": { "requests": { "cpu": "1", "memory": "512Mi" } } } ] } } }

MNP AWS Batch pekerjaan dengan beberapa kontainer per node

Berikut ini adalah contoh AWS Batch pekerjaan paralel (MNP) multi-node dengan beberapa kontainer per node:

{ "jobDefinitionName": "multicontainer-mnp", "type": "multinode", "nodeProperties": { "numNodes": 6, "mainNode": 0, "nodeRangeProperties": [ { "targetNodes": "0:5", "ecsProperties": { "taskProperties": [ { "containers": [ { "name": "range05-c1", "command": [ "echo", "hello world" ], "image": "public.ecr.aws/amazonlinux/amazonlinux:latest", "resourceRequirements": [ { "type": "VCPU", "value": "2" }, { "type": "MEMORY", "value": "4096" } ] }, { "name": "range05-c2", "command": [ "echo", "hello world" ], "image": "public.ecr.aws/amazonlinux/amazonlinux:latest", "resourceRequirements": [ { "type": "VCPU", "value": "2" }, { "type": "MEMORY", "value": "4096" } ] } ] } ] } } ] } }