我正试图使用terraform在aws_batch_job_definition中定义ephemeralStorage,但不起作用。我不确定参数应该放在JSON和GUI中的哪个位置。
这是我的工作定义:
resource "aws_batch_job_definition" "sample" {
name = "sample_job_definition"
type = "container"
platform_capabilities = [
"FARGATE",
]
container_properties = <<CONTAINER_PROPERTIES
{
"command": ["bash", "/root/plotter.sh"],
"image": "995648859937.dkr.ecr.us-east-1.amazonaws.com/chia:latest",
"fargatePlatformConfiguration": {
"platformVersion": "LATEST"
},
"resourceRequirements": [
{"type": "VCPU", "value": "4"},
{"type": "MEMORY", "value": "15360"}
],
"networkMode": "awsvpc",
"networkConfiguration": {
"assignPublicIp" : "ENABLED"
},
"executionRoleArn": "${aws_iam_role.ecs_task_execution_role.arn}",
"jobRoleArn": "${aws_iam_role.ecs_task_role.arn}"
}
CONTAINER_PROPERTIES
}
我们也一直在努力寻找有关这方面的信息,但似乎你做不到。
最好的解决方法似乎是连接和安装EFS卷,例如:
{
"containerProperties": [
{
"name": "container-using-efs",
"image": "amazonlinux:2",
"command": [
"ls",
"-la",
"/mount/efs"
],
"mountPoints": [
{
"sourceVolume": "myEfsVolume",
"containerPath": "/mount/efs",
"readOnly": true
}
],
"volumes": [
{
"name": "myEfsVolume",
"efsVolumeConfiguration": {
"fileSystemId": "fs-12345678",
"rootDirectory": "/path/to/my/data",
"transitEncryption": "ENABLED",
"transitEncryptionPort": integer,
"authorizationConfig": {
"accessPointId": "fsap-1234567890abcdef1",
"iam": "ENABLED"
}
}
}
]
}
]
}