Creating the Task Definition
This article will be referencing the following repositories as the Docker image codebase:
In ECS, create a new Task Definition and choose the desired launch type compatibility (Fargate or EC2)
Attach the Task Role
Attach the task role created from Storing Secrets in Amazon Parameter Store to use in ECS.
Attach the Task Execution Role
This role is required by tasks to pull container images and publish container logs to Amazon CloudWatch on your behalf. You can use the default one created by Amazon.
Adjust the Task Size
We can assign total memory and CPU to the task. For PeerID, choose:
2GB Task Memory (GB)
1 vCPU Task CPU (vCPU)
Adding the Containers
Create two containers:
PeerID Backend
PeerID Frontend + Webserver (we will be using NGINX)
PeerID Backend
Enter the container name.
Enter the path to the Docker registry with the container Image.
Enter
1024for a soft limit for the memory.Enter
3000tcp for the port mappings.Enter
756CPU units.Tick the essential box.
Enter
/peerid-backend/docker-entrypoint.shfor the entry point.Enter
npm,run,startfor the command.Enter
peerid-backendfor the working directory.Enter the environment variables for PeerID Backend using
ValueFromand referencing the parameters from Systems Manager Parameter Store.
PeerID Frontend
Enter the container name.
Enter the path to the Docker registry with the container Image.
Enter
256for a soft limit for the memory.Enter
80and443tcp for the port mappings.Enter
256CPU units.Tick the essential box.
Enter
/docker-entrypoint.shfor the entry point.Enter
nginx,-g,daemon off;for the command.Enter the environment variables for PeerID GUI using
ValueFromand referencing the values created from Systems Manager Parameter Store.
Last updated
Was this helpful?
