0

I have 3 containerized applications. All these applications are a simple python script that calls an api at different times. For example, App1: calls every hour, App2: calls every 30 mins, and App3: calls every minute. Right now we have an ec2 instance for each application, which is ok because I need the applications to run on different AWS EC2 Instances because I don’t want my IP Blacklisted. But now how would I go about scaling an application? For example, I need 3 instances of app 1.

Im currently using Terraform to create the EC2 instances and while that can work I don't know how to go about automating updating the images on each EC2 instance.

I tried using AWS ECS to scale the container but this requires that it shares IP address ( I would like for these applications to live in different VMS(EC2 Instances.), so that the IP does not have a problem getting blacklisted.) with the other applications and I don’t want that.

What tools or architecture can best help me accomplish the scaling of these applications?

  • How simple the applications are? As an option if they can be easily converted to Lambda functions I think the bounding of Lambda + CloudWatch (for scheduling crons) should solve the case with scalability. Here should be a clue how to have distinct IPs: https://stackoverflow.com/a/53291517/4644059 If you need to keep docker you most likely have to stay with EC2/ECS. You can check options that spin up multiple EC2 instances. – wisp Aug 26 '20 at 05:35

1 Answers1

1

For your specific case, I would suggest AWS Fargate ECS + Cloudwatch events cron triggers (Scheduled Fargate ECS tasks).

Fargate instances have awsvpc network mode by default, which means if you run them in public subnet with public IP allocation, each container instance will retrieve unique public IP (via dedicated automatically attached ENI - Elastic Network Interface).

Additionally, running tasks on Fargate will allow you to utilize much more convenient docker packaging of your applications while keeping management & operating requirements low - as Fargate is a Server-less container scheduler, and it requires less effort than operating AWS EC2 instances.

You will need 3 ECS resources :

  1. cluster
  2. template resource for container definition
  3. task definition resource

and 3 CloudWatch resources:

  1. aws_cloudwatch_event_rule
  2. aws_cloudwatch_event_target
  3. aws_cloudwatch_log_group

in Terraform to make it work, + ECR repo/s for storing image artifacts.

BlackStork
  • 7,603
  • 1
  • 16
  • 18