Create AWS Elastic Container Service ECS Task definitions — Step 9

Photo by Katie Smith on Unsplash

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.

Navigate to ECS and select Task Definitions

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

Select EC2 as we will be deploying our tasks in EC2 instances

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

Type Task Definition Name exactly the same as repository
Selecting Task memory and Task CPU is based on our application’s demand

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.

Click on Add Container to finish the task configuration

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.

Fill in Container name, Image, Memory Limits and Port mappings
Enter CPU units lesser than reserved units
Create environment variables will be explained in detail
Finally check the Auto-configure CloudWatch Logs and we are done

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 :)

--

--

--

Father, Software Architect and a Story teller

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Top 10 Programming Languages to Learn in 2020

Day 20

How Much Do Software Testing Metrics Matter?

Quick Start and Debugging in Jsonnet

algorithm(s)

6 Exercises Gained from Relocating Web Application on Creation

Tableless Query for Postgres

Introducing Airbloc’s B2C Data Alliance and 1st application service

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

More from Medium

Java SpringBoot gRPC App & Create AWS EKS Cluster Using Terraform As GitLab Infrastructure & CI/CD…

Building Kubernetes Admission Webhooks (Part 2 of 2)

Kafka install Ansible Playbook

Traffic routing using istio service mesh