

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# Fargate 上的作业定义
<a name="fargate-job-definitions"></a>

AWS Batch job AWS Fargate s on 不支持所有可用的作业定义参数。某些参数完全不受支持，而其他参数对于 Fargate 任务的行为则不同。

以下列表描述了在 Fargate 作业中无效或以其他方式受到限制的作业定义参数。

`platformCapabilities`  
必须指定为 `FARGATE`。  

```
"platformCapabilities": [ "FARGATE" ]
```

`type`  
必须指定为 `container`。  

```
"type": "container"
```

`containerProperties` 中的参数    
`executionRoleArn`  
对于在 Fargate 资源上运行的作业，指定。有关更多信息，请参阅 *Amazon Elastic Container Service 开发人员指南*中的[任务的 IAM 角色](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-iam-roles.html)。  

```
"executionRoleArn": "arn:aws:iam::123456789012:role/ecsTaskExecutionRole"
```  
`fargatePlatformConfiguration`  
（可选，仅适用于 Fargate 作业定义）。指定 Fargate 平台版本或 `LATEST` 最新平台版本。`platformVersion` 的可能值为 `1.3.0`、`1.4.0` 和 `LATEST`。  

```
"fargatePlatformConfiguration": { "platformVersion": "1.4.0" }
```

`instanceType``ulimits`  
不适用于在 Fargate 资源上运行的作业。

`memory``vcpus`  
这些设置必须在 `resourceRequirements` 中指定

`privileged`  
要么不指定此参数，要么指定 `false`。  

```
"privileged": false
```

`resourceRequirements`  
必须使用[支持的值](job_definition_parameters.md#ContainerProperties-resourceRequirements-Fargate-memory-vcpu)来指定内存和 vCPU 要求。GPU 资源在 Fargate 资源上运行的作业不支持 GPU 资源。  
如果您使用 GuardDuty 运行时监控，则 GuardDuty 安全代理会有轻微的内存开销。因此，内存限制必须包括 GuardDuty安全代理的大小。有关 GuardDuty 安全代理内存限制的信息，请参阅《*GuardDuty 用户指南》*中的 [CPU 和内存限制](https://docs.aws.amazon.com/guardduty/latest/ug/prereq-runtime-monitoring-ecs-support.html#ecs-runtime-agent-cpu-memory-limits)。有关最佳实践的信息，请参阅《Amazon ECS 开发人员指南》**中的[启用运行时监控后，如何解决 Fargate 任务中的内存不足错误](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-guard-duty-troubleshooting.html#memory-error)。  

```
"resourceRequirements": [
  {"type": "MEMORY", "value": "512"},
  {"type": "VCPU",   "value": "0.25"}
]
```

`linuxParameters` 中的参数    
`devices``maxSwap``sharedMemorySize``swappiness``tmpfs`  
不适用于在 Fargate 资源上运行的作业。

`logConfiguration` 中的参数    
`logDriver`  
仅支持 `awslogs` 和 `splunk`。有关更多信息，请参阅 [使用 awslogs 日志驱动程序](using_awslogs.md)。

`networkConfiguration` 中的会员    
`assignPublicIp`  
如果私有子网未连接用于向互联网发送流量的 NAT 网关，`[assignPublicIp](https://docs.aws.amazon.com/batch/latest/APIReference/API_NetworkConfiguration.html#Batch-Type-NetworkConfiguration-assignPublicIp)` 则必须为“`ENABLED`”。有关更多信息，请参阅 [AWS Batch IAM 执行角色](execution-IAM-role.md)。