0

我正在使用 AWS Step Functions 手动启动 ECS 任务 (Fargate)。状态机定义了 3 个环境变量。

我试图在手动执行时定义第四个。(我也尝试过手动执行定义所有 4 个,以及其他类似的排列。)

当任务通过手动执行步进函数/状态机启动时,CloudWatch 中的 TaskStateEntered 会显示我输入的 containerOverrides 输入转换。

见下文:

{
    "id": "2",
    "type": "TaskStateEntered",
    "details": {
        "input": "{\"containerOverrides\": [{\"name\": \"mycontainername\",\"environment\": [{\"name\": \"FILENAME\",\"value\": \"1627990305120623410.zip\"}]}]}",
        "inputDetails": {
            "truncated": false
        },
        "name": "loadsvc/us"
    },
    "previous_event_id": "0",
    "event_timestamp": "1627993300758",
    "execution_arn": "arn:aws:states:us-east-1:000000000000:execution:sm-mystatemachine-us:000000000000-000000000000-000000000000-000000000000-000000000000"
}

但是,当它实际调度任务时,在下一步中,根据 TaskStateEntered,只定义了原来的 3 个环境变量。

{
    "id": "3",
    "type": "TaskScheduled",
    "details": {
        "parameters": "{\"LaunchType\":\"FARGATE\",\"Cluster\":\"arn:aws:ecs:us-east-1:000000000000:cluster/mycluster\",\"TaskDefinition\":\"arn:aws:ecs:us-east-1:000000000000:task-definition/loadsvc-task\",\"NetworkConfiguration\":{\"AwsvpcConfiguration\":{\"AssignPublicIp\":\"ENABLED\",\"SecurityGroups\":[\"sg-000000000000\"],\"Subnets\":[\"subnet-000000000000\"]}},\"Overrides\":{\"ContainerOverrides\":[{\"Name\":\"mycontainername\",\"Environment\":[{\"Name\":\"AWS_REGION\",\"Value\":\"us\"},{\"Name\":\"LOCATION\",\"Value\":\"s3\"},{\"Name\":\"S3_BUCKET_NAME\",\"Value\":\"mybucketname\"}]}]}}",
        "region": "us-east-1",
        "resource": "runTask",
        "resourceType": "ecs"
    },
    "previous_event_id": "2",
    "event_timestamp": "1627993300758",
    "execution_arn": "arn:aws:states:us-east-1:000000000000:execution:sm-mystatemachine-us:000000000000-000000000000-000000000000-000000000000-000000000000"
}

我的问题是我似乎无法将环境变量数据从输入转换器传递到运行的容器。(即无论我尝试什么,我都无法将第四个环境变量正确传递给 ECS 任务。)

4

0 回答 0