Does anyone have an example of defining a Fargate ...
# aws
a
Does anyone have an example of defining a Fargate deployment in Python? I'm seeing an error with the TaskDefinition resource and setting the
container_definitions
array. It says that the attribute needs to be an array when I set it to a string via
json.dumps
and says it needs to be a single value when I set it to a Python list... Here's my code as it stands right now
Copy code
sign_and_verify_task = ecs.TaskDefinition(
    f'sign-and-verify-task-{env_suffix}',
    cpu='0.25',
    memory='500',
    network_mode='awsvpc',
    pid_mode='task',
    requires_compatibilities='FARGATE',
    tags=aws_config.merged_tags({'Name': f'sign-and-verify-{env_suffix}'}),
    execution_role_arn=sign_and_verify_task_execution_role.arn,
    family=f'sign-and-verify-task-{env_suffix}',
    container_definitions=[
        {
            'name': 'sign-and-verify',
            'image': f'mitodl/sign-and-verify:{sign_and_verify_config.require("docker_label")}',
            'environment': [
                {'name': 'PORT', 'value': '5000'}
            ],
            'secrets': [
                {'name': 'UNLOCKED_DID', 'valueFrom': unlocked_did_secret.arn}
            ]
        }
    ],
    ipc_mode='task',
)