Launch a cluster

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.

  1. Navigate to the Amazon ECS console. Under the Amazon ECS section, choose Clusters in the left menu and choose Create Cluster.

  2. Leave the Networking only box selected and choose Next step.

  3. Give the cluster a name like twitch-sentiment-cluster then click Create.

  4. When the button becomes enabled, click View Cluster.

  5. Click Update Cluster.

  6. Click Add provider.

  7. In the dropdown next to Provider 1, choose FARGATE.

  8. Click Update.

  9. In the left menu, choose Task Definitions, then choose Create new Task Definition.

  10. Leave the Fargate box selected and choose Next step.

  11. Give the Task Definition a name like twitch-sentiment-task.

  12. 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.

  13. In the section that says Choose the service that will use this role, select Elastic Container Service.

  14. In the section that says Select your use case, select Elastic Container Service Task, then choose Next: Permissions.

  15. Select sentiment-policy, the policy you created for the programmatic user in the prerequisites module.

  16. Click Next: Tags.

  17. Click Next: Review.

  18. Give the new role a name like twitch-sentiment-task-role and choose Create role.

  19. 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.

  20. In the Task size section, select 0.5GB for Task memory and 0.25 vCPU for Task CPU.

  21. In the Container Definitions section, choose Add container.

  22. Type twitch-sentiment-container into the Container name field.

  23. 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.

  24. At the bottom of the Create new Task Definition form, choose Create.