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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.