2
b2plane
167d

// Rant 1
---
Im literally laughing and crying rn

I tried to deploy a backend on aws Fargate for the first time. Never used Fargate until now

After several days of brainwreck of trial and error

After Fucking around to find out

After Multiple failures to deploy the backend app on AWS Fargate

After Multiple times of deleting the whole infrastructure and redoing everything again

After trying to create the infrastructure through terraform, where 60% of it has worked but the remaining parts have failed

After then scraping off terraform and doing everything manually via AWS ui dashboard because im that much desperate now and just want to see my fucking backend work on aws and i dont care how it will be done anymore

I have finally deployed the backend, successfully

I am yet unsure of what the fuck is going on. I followed an article. Basically i deployed the backend using:

- RDS
- ECS
- ECR
- VPC
- ALB

You may wonder am i fucking retarded to fail this hard for just deploying a backend to aws?

No. Its much deeper than you think. I deployed it on a real world production ready app way.

- VPC with 2 public and 2 private subnets. Private subnets used only for RDS. Public for ALB.

- Everything is very well done and secure. 3 security groups: 1 for ALB (port 80), 1 for Fargate (port 8080, the one the backend is running on), 1 for RDS postgres (port 5432). Each one stacked on top and chained

- custom domain name + SSL certificate so i can have a clean version of the fully working backend such as https://api.shitstain.com

- custom ECS cluster

- custom target groups

- task definitions

Etc.

Right now im unsure how all of this is glued together. I have no idea why this works and why my backend is secure and reachable. Well i do know to some extent but not everything.

To know everything, I'll now ask some dumbass questions:

1. What is ECS used for?

2. What is a task definition and why do i need it?

3. What does Fargate do exactly? As far as i understood its a on-demand use of a backend. Almost like serverless backend? Like i get billed only when the backend is used by someone?

4. What is a target group and why do i need it?

5. Ive read somewhere theres a difference between using Fargate and... ECS (or is it something else)? Whats the difference?

Everything else i understand well enough.

In the meantime I'll now start analyzing researching and understanding deeply what happened here and why this works. I'll also turn all of this in terraform. I'll also build a custom gitlab CI/CD to automate all of this shit and deploy to fargate prod app

// Rant 2
---
Im pissing and shitting a lot today. I piss so much and i only drink coffee. But the bigger problem is i can barely manage to hold my piss. It feels like i need to piss asap or im gonna piss myself. I used to be able to easily hold it for hours now i can barely do it for seconds. While i was sleeping with my gf @retoor i woke up by pissing on myself on her bed right next to her! the heavy warmness of my piss woke me up. It was so embarrassing. But she was hardcore sleeping and didnt notice. I immediately got out of bed to take a shower like a walking dead. I thought i was dreaming. I was half conscious and could barely see only to find out it wasnt a dream and i really did piss on myself in her bed! What the fuck! Whats next, to uncontrollably shit on her bed while sleeping?! Hopefully i didnt get some infection. I feel healthy. But maybe all of this is one giant dream im having and all of u are not real

Comments
  • 1
  • 1
    1. What is ECS used for?

    2. What is a task definition and why do i need it?

    3. What does Fargate do exactly? As far as i understood its a on-demand use of a backend. Almost like serverless backend? Like i get billed only when the backend is used by someone?

    4. What is a target group and why do i need it?

    5. Ive read somewhere theres a difference between using Fargate and... ECS (or is it something else)? Whats the difference?

    I know exactly what the answers to these are, but I feel like I should get paid for telling you this. Trust me I've banged my head around AWS for 2 years to learn the shit you mentioned above.

    Don't hate on me on wanting to get paid.
  • 1
    ECS is a container orchestration system.

    ECS runs services wich are several replicas of a task. It may scale automatically or not.

    Such task is defined in a Task Definition. Things like container image URI, cores and ram, environment variable. Think of it like a docker-compose file. But for ECS.

    Since ECS runs containers it needs instances. You can create an autoscaling group of instances with the ECS agent installed so ECS may launch/orchestrate these containers for you OR... forget about managing instances and use "Fargate". Fargate spins up the instances for you, since it's AWS managed you won't see these instances in the EC2 dashboards.

    For routing incoming traffic in a load balancer to these ECS tasks you need to associate a Target Group with the ECS tasks. Each ECS tasks spun up will update the task's private IP in the target group. The load balancer should have a rule pointing a condition (like Host:foo.bar.tld) to a target group.
  • 1
    The target group is the "glue" between the Load Balancer and the ECS tasks. This is a way you make incoming traffic to the LB end up load-balanced in your ECS tasks.
  • 1
    3. Regarding Fargate billing, AWS get your moneis out for having running containers and their size. Not usage.
    You use 2 core / 2GB 24x31, you get charged for that.
  • 1
    @yamlbreakfast ohh ive been wondering how come i see nothing in my ec2 dashboard. Thanks!
  • 0
    @yamlbreakfast if im asked why did i choose elastic beanstalk or why did i choose fargate as a deployment for my backend... What do i say?
  • 0
    @b2plane With Beanstalk, the developer doesn't need to worry about provisioning, configuring, or deploying resources. They simply upload their application image and let Elastic Beanstalk take care of the rest. ECS, on the other hand, provides more control over the environment.
  • 2
    1. ECS is containers for container noobs (no mean to insult, I use it as well for I have no knowledge of kube and such)

    2. Task def is the description of a task. After you define it you can have multiple tasks based on that def (think of image/container relationship)

    3. Yes, fargate is a mechanism to use containers in a server less (lambda-like) fashion. Opposed to fargate, there's the cluster fashion, where you have static servers (ec2) on which your containers run. In this way you pay a fixed price monthly, not based on usage.

    4. In this case the destination of an ALB. Like an abstraction of what can be the fargate obscure blobcrap or a bunch of ec2 instances (among other things)

    5. Ecs is the system that manages all your containers crap. It does it in two ways: using a cluster of ec2 instances or with some obscure serverless lambda-like crap that costs you a fortune if used 24/7 by your userbase (fargate)
Add Comment