I am currently exploring AWS ECS with Fargate. At first, I thought that it is a good feature that can do autoscaling and save cost, as well as without server maintenance overhead.
But when I look further onto it, the more I see the pain into it.
My question is:
- Anyone have an alternative of dealing with issue (1) and (2)? a way that can overcome it for cost saving purposes and at the same time retaining an elastic IP
A load balancer (ALB or NLB) is really your only option. Your statement about health checks preventing Fargate from "sleep" is incorrect though. There is no "sleep" option in Fargate.
If you want something very similar, but with a sleep option, I suggest looking into AWS App Runner.
- If ALB is forwarded to Fargate with IP address, what happen if IP ECS (Fargate) IP got restarted? Will ALB auto detect it or what are the way to detect Fargate IP changes and update back to ALB automatically, and if not, how to handle such situation where the IP is recycled?
ECS integrates directly with the load balancer target group. You configure the ECS service what load balancer and target group you are using, and ECS will keep the load balancer's target group up-to-date with your Fargate IP address(es) automatically.