Trying to create an ECS Service using the following Cloudformation resource definition:
MyUIService:
Type: AWS::ECS::Service
Properties:
Cluster: !ImportValue MyClusterName
DesiredCount: 1
LaunchType: EC2
LoadBalancers:
- !ImportValue ALBDemo
Role: !Ref MyServiceRole
ServiceName: my-ui-service
ServiceRegistries:
- arn:aws:servicediscovery:eu-west-1:2398942890842:service/srv-ohc098mdj55yesez7
TaskDefinition: !ImportValue MyTaskArn
However it fails with the following error:
Value of property LoadBalancers must be a list of objects
But I am defining a list (albeit with one element).
The list contains an export of the ALB's arn.
What is the exact syntax?
edit: Here is the relevant documentation that does not seem consistent with the error:
LoadBalancers
A list of load balancer objects to associate with the cluster. If you specify the Role property, LoadBalancers must be specified as well. For information about the number of load balancers that you can specify per service, see Service Load Balancing in the Amazon Elastic Container Service Developer Guide. Required: Conditional Type: List of Amazon Elastic Container Service Service LoadBalancers