https://pulumi.com logo
#getting-started
Title
# getting-started
t

tall-orange-51528

07/12/2023, 1:47 PM
Hello, I am trying to provision ECS with the following code. The examples only show one container used and when i change to use multiple, only the first one is created, any ideas what I am doing wrong? (No nginx container is created but the command succeeds with no errors)
Copy code
service = awsx.ecs.FargateService(
    "service",
    cluster=cluster.arn,
    network_configuration=aws.ecs.ServiceNetworkConfigurationArgs(
        subnets=vpc.private_subnet_ids, security_groups=[security_group.id]
    ),
    task_definition_args=awsx.ecs.FargateServiceTaskDefinitionArgs(
        containers={
            "php": awsx.ecs.TaskDefinitionContainerDefinitionArgs(
                image=php_image.image_uri, cpu=512, memory=128, essential=True
            ),
            "nginx": awsx.ecs.TaskDefinitionContainerDefinitionArgs(
                image=nginx_image.image_uri, cpu=512, memory=128, essential=True
            ),
        }
    ),
)
d

dry-sugar-28823

07/12/2023, 2:10 PM
I'm not super familiar with awsx, but try awsx.ecs.FargateTaskDefinition instead of awsx.ecs.FargateServiceTaskDefinition https://www.pulumi.com/registry/packages/awsx/api-docs/ecs/fargatetaskdefinition/
b

billowy-army-68599

07/12/2023, 3:32 PM
containers
is an array:
Copy code
containers=[{
            "php": awsx.ecs.TaskDefinitionContainerDefinitionArgs(
                image=php_image.image_uri, cpu=512, memory=128, essential=True
            ),
            "nginx": awsx.ecs.TaskDefinitionContainerDefinitionArgs(
                image=nginx_image.image_uri, cpu=512, memory=128, essential=True
            ),
        }]