本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
参考:环境变量
以下作业定义示例使用环境变量来指定文件类型和 Amazon S3 URL。该特定示例来自创建简单的“Fetch & Run”AWS Batch 作业fetch_and_run.sh
myjob.sh
脚本并声明其文件类型。
尽管在本示例中,命令和环境变量被硬编码到作业定义中,但仍可指定命令和环境变量覆盖,使作业定义更具通用性。
{ "jobDefinitionName": "fetch_and_run", "type": "container", "containerProperties": { "image": "
123456789012
.dkr.ecr.us-east-1.amazonaws.com/fetch_and_run", "resourceRequirements": [ { "type": "MEMORY", "value": "2000" }, { "type": "VCPU", "value": "2" } ], "command": [ "myjob.sh", "60" ], "jobRoleArn": "arn:aws:iam::123456789012
:role/AWSBatchS3ReadOnly", "environment": [ { "name": "BATCH_FILE_S3_URL", "value": "s3://amzn-s3-demo-source-bucket/myjob.sh" }, { "name": "BATCH_FILE_TYPE", "value": "script" } ], "user": "nobody" } }