• About Me
  • Projects
  • WebApp
  • Archive

Barnaby Baron. Exploring AWS.

  • Building an Amazon ECS resource with Fargate using Terraform

Building an Amazon ECS resource with Fargate using Terraform

2024-04-06 4 min read Projects Barny Baron

Journey: πŸ“Š Community Builder πŸ“Š

Subject matter: Building on AWS

Another project build! It won’t always be as regular as this but I have momentum currently!

In this article, we build a VPC and create an Amazon ECS using Fargate. Within the 6 Pillars of the AWS Well-Architected Framework, Operational Excellence will be achieved by using Terraform to deliver an Infrastructure as Code pipeline.

Once the environment comes online, multiple container instances will be running in an auto-scaling configuration, communicating via a NAT gateway in a public subnet, while the ECS is residing in a private subnet. Access is granted to the ECS via a load balancer connected to an Internet Gateway.

Finally, we have CloudWatch delivering health checks, and logs and communicating with the auto-scaling boundaries.

AWS

Credit: This architecture was created using a fantastic walkthrough from Samuel Olayinka on Medium.

Please see the article: Here

What did I use to build this environment?

  • Visual Studio Code platform
  • Terraform
  • AWS CLI
  • Amazon ECS
  • AWS Fargate
  • Amazon CloudWatch
  • Amazon VPC
  • Multiple AZs
  • Application Load Balancer
  • Auto Scaling
  • Public and Private subnets
  • Security Groups
  • Internet Gateway
  • NAT Gateway

How did it look?

I initially created the project in eu-west-2 before destroying it and recreating it in us-east-1 to check out the build times between the two, which were negligible.

Some of the highlights…

The VPC builds:

VPC

Target groups online, using HTTP on port 80.

In a prod environment, this would have been HTTPS on port 443.

Target Groups

The ALB came online:

ALB

The environment is online!

Cluster

Once I had built the environment, I was able to successfully visit my public Internet-facing ALB, and when refreshing the page, I could see my ALB redistributing against one of the three available ECS clusters.

CloudWatch was also monitoring and providing me with data.

Then… time for IaC destruction!!

Terraform

Destruction complete!

Terraform

My interpretation of the architecture:

Amazon ECS

I hope you have enjoyed the article, I enjoyed the build!

Cloud

Community Builder Fargate Terraform
Latest posts
  • Designing a Formula 1 Race Track and gaining insights from Amazon Nova
  • Year 2 - AWS Community Builder
  • Troubleshooting an EKS Pod creation error - Persistent Volume Controller Failed Binding
  • Building an EKS cluster and mounting an S3 bucket within a pod using the CSI Driver
  • Sopra Steria Merch Delivery!
  • AWS Community Builders Application Window!
  • Building a VPC and provisioning an EC2 instance using Modules!
Categories
  • AWS News (84)
  • Projects (29)
  • Exploring (19)
  • Troubleshooting (10)
  • General (8)
  • Quotes (5)
  • Video (3)
Social media
Archive
© 2025 by Barny Baron
Powered by Bilberry Hugo Theme