gpt4 book ai didi

amazon-web-services - 如何使用efsVolumeConfiguration任务定义参数Beta(由AWS于2020年1月启动)在ECS集群上安装EFS

转载 作者:行者123 更新时间:2023-12-02 20:33:25 26 4
gpt4 key购买 nike

AWS在文档here中提供了此功能

{
"containerDefinitions": [
{
"name": "container-using-efs",
"image": "amazonlinux:2",
"entryPoint": [
"sh",
"-c"
],
"command": [
"ls -la /mount/efs"
],
"mountPoints": [
{
"sourceVolume": "myEfsVolume",
"containerPath": "/mount/efs",
"readOnly": true
}
]
}
],
"volumes": [
{
"name": "myEfsVolume",
"efsVolumeConfiguration": {
"fileSystemId": "fs-1234",
"rootDirectory": "/path/to/my/data"
}
}
]
}

我创建了一个EFS文件系统,并为其分配了安全组,允许入站NFS,并且EFS使用该安全组以及ECS群集使用的子网和VPC。

问题

当我使用AWS管理控制台在任务定义中创建挂载点时,我必须输入 containerPath,否则 mountPoints不会反射(reflect)在我的JSON中

问题

1)我的 containerPath应该在 mountPoints下吗?

2)我应该在 rootDirectory下指定一个 efsVolumeConfiguration吗?

信息

1)我在ECS集群上运行wordpress

2)我想要为我的容器持久存储,这就是为什么我尝试挂载EFS的原因

3)我想将我所有的wordpress文件映射到EFS容器上,以便在容器重新启动时我所做的任何更改都不会撤消

最佳答案

containerPath是您想在docker容器内使用的路径。在wordpress中,可能是“/ var / www / html / htdocs / content / uploads”。rootDirectory是您要使用的EFS内部目录的路径。
我的EFS中有一个文件夹uploads的示例:

"volumes": [
{
"efsVolumeConfiguration": {
"fileSystemId": "fs-xxxxxx",
"rootDirectory": "/uploads"
}]

首次创建EFS目标时,其中没有任何文件夹,因此必须使用 /作为 rootDirectory

关于amazon-web-services - 如何使用efsVolumeConfiguration任务定义参数Beta(由AWS于2020年1月启动)在ECS集群上安装EFS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60057088/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com