amazon-web-services - 如何在 aws_batch_job_definition 中使用 terraform 定义 ephemeralStorage?
问题描述
我正在尝试使用 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"
}
}
}
]
}
]
}
推荐阅读
- java - 在 Spring 中使用类进行查询
- flutter - 如何在颤动中获得加速度计的更新频率?
- mysql - 无法启动 MariaDB 数据库服务器(MariaDB 服务器已关闭/超时)
- javascript - 如何选择元素的父元素而不是单击时具有 id/class 的父子元素?
- javascript - 寻找一种在网页上动态自动填充邮政编码输入的方法
- javascript - jquery 在现有表下追加表并链接到该行记录的 id
- sql - 如何编辑此 SQL 代码以过滤表中的数据?
- c++ - last input not working after exiting the while loop
- c++ - 为什么 afl-g++ 无法编译 ImageMagick?
- go - 在 FindAllString 正则表达式中排除重复项