DEV Community

Ezzio Moreira
Ezzio Moreira

Posted on

7

Stack Grafana deployed on AWS ECS -Part 1 - Create a Cluster

This post is part of a series about the stack Grafana deployed on AWS ECS. This project is a simple MVP.

In part 1, we will set up our cluster ECS and LoadBalance.

AWS ECS: is a container orchestration that helps us to deploy, manage, and scale applications.

Pre-Requirements

  • Knowledge with Terraform
  • AWS Account
    • 2 subnets publics, with tag: tier = public
    • 2 subnets private, with tag: tier = private

AWS VPC

We need the following structure for AWS VPC. We'll get ID the subnets privates with the Terraform DataSource.

Image description

Remember the add tag tier = private for private subnets.

Image description

Remember the add tag tier = public for public subnets.

Image description

ECS Cluster Type

Currently, there are three types of the ECS cluster. Cluster EC2 instance, serverless Fargate, and on-primeses VM.

Consult the AWS documentations for more details. https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-configuration.html

We'll use the ECS EC2 cluster for this MVP.

Create ECS Cluster

You can use this Terraform module to create cluster ECS.

Below an example how to use this module. That will provide a cluster ECS type of EC2, and Application LoadBalance.



####################################################################################################
### ECS Cluster o11y ###
####################################################################################################

module "ecs_cluster" {
source = "https://github.com/EzzioMoreira/aws-terraform-module//modules/ecs-cluster?ref=v0.0.1-ecs-cluster-alb"

cluster_name = "ecs-cluster-example"
min_size = 1
max_size = 2
desired_size = 1
instance_type = "t3a.medium"
vpc_id = "vpc-xxxxxxxx"
tags = {
created_by = "terraform"
documentation = "null"
env = "prod"
repository = "ezziomoreira/aws-terraform-modules"
service = "observability"
team = "sre"
}
}

####################################################################################################
### Loadbalance o11y ###
####################################################################################################
module "loadbalance" {
source = "https://github.com/EzzioMoreira/aws-terraform-module//modules/loadbalance?ref=v0.0.1-ecs-cluster-alb"

name = "ecs-cluster-example-internal"
type = "application"
internal = true
subnet_ids = ["subnet-xyxyx", "subnet-yxyxyx"]
security_group_ids = [sg-123123123]
tags = {
created_by = "terraform"
documentation = "null"
env = "prod"
repository = "ezziomoreira/aws-terraform-modules"
service = "observability"
team = "sre"
}
}

Enter fullscreen mode Exit fullscreen mode




References

Reinvent your career. Join DEV.

It takes one minute and is worth it for your career.

Get started

Top comments (0)

Heroku

This site is powered by Heroku

Heroku was created by developers, for developers. Get started today and find out why Heroku has been the platform of choice for brands like DEV for over a decade.

Sign Up

👋 Kindness is contagious

Dive into an ocean of knowledge with this thought-provoking post, revered deeply within the supportive DEV Community. Developers of all levels are welcome to join and enhance our collective intelligence.

Saying a simple "thank you" can brighten someone's day. Share your gratitude in the comments below!

On DEV, sharing ideas eases our path and fortifies our community connections. Found this helpful? Sending a quick thanks to the author can be profoundly valued.

Okay