Create AWS Elastic Container Service ECS Task definitions — Step 9

Let’s prep things and put the oven in pre heat mode. Its time to cook.

This story is part of a series “Initial Commit till Running on Cloud”.

We are going to create task definitions in ECS for each deployable component we have developed. Task definitions are like the manifests we create in kubernetes. It has configurations of which docker image to run, name of the task, memory and CPU requirements, log configuration, environment variables among other important things.

Click Create new Task Definition button to begin configuring the tasks for all our deployable components.

Populate the fields mentioned in the screenshots below and leave others with default.

I have selected 1024 because, I don’t need much CPU as it is a simple application. And if the EC2 instance I am running this task has 2 virtual CPU then I can run 2 tasks in the same EC2 instance. Also 424 is a number below the actual available RAM of t3a.nano instance. So if we run this task it will have a memory and CPU reservation as mentioned. If the EC2 instance has 454 MB RAM space then 30MB RAM will be free when u deploy this task in it.

No more configurations in the main page apart from these settings.

Add container will open up a popup frame where we will add details about the docker image, soft limits on CPU and memory, environment variables and logs configuration.

Click on Add in the popup and then click on Create in the main page.

Environment Variables

Configure the following environment variables in respective task definitions. For mongo DB replace the uri with your mongo atlas account info.

awesome-app-user-microservice

spring.data.mongodb.uri = mongodb+srv://awesome-app-user-microservice-admin:actualpassword@test-orvxq.mongodb.net/awesome-app-user-microservice

awesome-app-bff

spring.data.mongodb.uri = mongodb+srv://awesome-app-bff-admin:actualpassword@test-orvxq.mongodb.net/awesome-app-bff

internal.lb.uri = http://internal-prod-private-lb-xxx.eu-central-1.elb.amazonaws.com

awesome-app-api-gateway

internal.lb.uri = http://internal-prod-private-lb-xxx.eu-central-1.elb.amazonaws.com

We will replace internal.lb.uri with actual ELB hostname once we deploy the VPC to cloud. Which actually is the next part of our tutorial :)

Going good? Please read the next part of this series. Also kindly leave your feedback :)

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Richy Great

Richy Great

Father, Software Architect and a Story teller