Creating our ECS hello world service

We have an ECS cluster and a load balancer ready to take on traffic on one side and an ECR repository containing the image of our application on the other side. We now need to tie the two together. This is done by creating an ECS service resource. We will create a new file called helloworld-ecs-service-cf-template.py and start as usual with its imports, template variable creation, and template description:

"""Generating CloudFormation template."""from troposphere.ecs import (    TaskDefinition,    ContainerDefinition)from troposphere import ecsfrom awacs.aws import (    Allow,    Statement,    Principal,    Policy)from troposphere.iam import Rolefrom troposphere import (    Parameter,    Ref,    Template,    Join,    ImportValue, Select, ...

Get Effective DevOps with AWS - Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.