本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
參考:環境變數
下列範例任務定義使用環境變數來指定檔案類型和 Amazon S3 URL。此特定範例來自建立簡單的「擷取和執行」 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" } }