ECS PlacementConstraint TypeError
See original GitHub issueI am running troposphere from the latest commit on master. When trying to use ECS PlacementConstraint in a TaskDefinition I get the following error:
TypeError:` <class 'troposphere.ecs.TaskDefinition'>: taskDefinition.PlacementConstraints is <class 'troposphere.ecs.PlacementConstraint'>, expected [<class 'troposphere.ecs.PlacementConstraint'>]
My TaskDefinition looks similar to:
taskDefinition = t.add_resource(TaskDefinition(
'taskDefinition',
TaskRoleArn=GetAtt(role, 'Arn'),
NetworkMode='bridge',
PlacementConstraints=PlacementConstraint(Type='distinctInstance'),
ContainerDefinitions=[
ContainerDefinition(
Name='service',
Image=Ref(serviceImage),
Essential=True,
MemoryReservation=256,
PortMappings=[
PortMapping(
ContainerPort=8080,
HostPort=80,
Protocol='tcp',
),
],
),
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Amazon ECS task placement constraints - AWS Documentation
A task placement constraint is a rule that's considered during task placement. ... Amazon ECS supports the following types of task placement constraints:....
Read more >Unable to import VPC in AWS cdk - python - Stack Overflow
I am trying to create few resources like ECS, SG,LB etc. I want to use default VPC in the resources. Below is my...
Read more >rusoto_ecs::TaskDefinition - Rust
The IPC resource namespace to use for the containers in the task. The valid values are host , task , or none ....
Read more >TypeError: ecs.tagResource is not a function | AWS re:Post
Hi, Trying to work out why I cant tag a Running ECS Task via Lambda. I've enabled the new ARNs in ECS. Using...
Read more >awslabs/aws-cdk - Gitter
__init__(scope, id, **kwargs) task_definition = ecs.Ec2TaskDefinition(self, "API Task", placement_constraints=[ ecs.PlacementConstraint.distinct_instances() ]) ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
There is a comment here that “distinctInstance is not supported in task definitions”. Which might imply it only works with AWS::ECS::Service.
I implemented this today and noticed a discrepancy on whether this is a single PlacementConstraint or a list of PlacementConstraint. I implemented it as a list given the other usage in Service. Also, I have a discussion going with the CF team to verify. Try using: