In order to run the monitoring service in a cluster, you need to create an ECS cluster and a Task Definition that tells AWS how to run the application.
Navigate to the Amazon ECS console. Under the Amazon ECS section, choose Clusters in the left menu and choose Create Cluster.
Leave the Networking only box selected and choose Next step.
Give the cluster a name like
twitch-sentiment-cluster then click Create.
When the button becomes enabled, click View Cluster.
Click Update Cluster.
Click Add provider.
In the dropdown next to Provider 1, choose FARGATE.
In the left menu, choose Task Definitions, then choose Create new Task Definition.
Leave the Fargate box selected and choose Next step.
Give the Task Definition a name like
Underneath the Task Role dropdown, click the blue IAM Console link. This opens a new tab with the IAM console. Choose Create role at the top of the page.
In the section that says Choose the service that will use this role, select Elastic Container Service.
In the section that says Select your use case, select Elastic Container Service Task, then choose Next: Permissions.
sentiment-policy, the policy you created for the programmatic user in the prerequisites module.
Click Next: Tags.
Click Next: Review.
Give the new role a name like
twitch-sentiment-task-role and choose Create role.
Go back to the Create new Task Definition form. Next to the Task Role dropdown, click the refresh icon. Then, select the role you just created.
In the Task size section, select 0.5GB for Task memory and 0.25 vCPU for Task CPU.
In the Container Definitions section, choose Add container.
twitch-sentiment-container into the Container name field.
Paste the full URI of the ECR image into the Image field. There’s a copy icon you can use to get this in the ECR Console. Then, choose Add.
At the bottom of the Create new Task Definition form, choose Create.