Skip to content

KevsAlex/aws-terraform-ecs-automated-service-deploy

Repository files navigation

aws-ecs-terraform-automated-service-deploy

This intention of this project is to deploy services on a ECS cluster in AWS

Alt text

This project has 5 modules

  1. Environment : Designed to manage different AWS accounts (one for dev and other for production)
  2. ECR : Creates ECR repository of a service
  3. LOAD_BALANCER : Take care of listener and target groups of the ECS load balancer
  4. ECS Creates service and its task definitions
  5. CODE_BUILD Manage CI/CD using AWS code pipeline

Módules

ECR

module "ECR" {
  source = "./modules/ECR"
  repositorios = local.servicios
}

Gets an array of servis for being created and exposed

  • repositorios An array of services
[
      {
        name = "dummy-spring-service",
        port = 8127
        task-environment = "dev"
      },
      {
        name = "dummy-python-service",
        port = 8128
        task-environment = "dev"
      }
]

Load Balancer

module "LB_MODULE" {
  source = "./modules/LOAD_BALANCER"
  
  vpc-lb = local.vpc
  load-balancer = local.load-balancer
  security-groups = local.security-groups
}
  • vpc-lb La vpc del balanceador
  • load-balancer El nombre del balanceador
  • security-groups los security groups al que hacen referencia los target group

ECS

module "ECS_MODULE" {

  source = "./modules/ECS"
  security-groups = local.security-groups
  subnets = local.subnets
  vpc = local.vpc
  target-groups = module.LB_MODULE.target-groups
  services = local.servicios
  cluster = local.cluster
  AWS_ACCOUNT_ID = local.AWS_ACCOUNT_ID
  config-server = local.config-server
}

CODE BUILD

module "CODE_BUILD" {

  source = "./modules/CODE_BUILD"
  AWS_ACCOUNT_ID = local.AWS_ACCOUNT_ID
  AWS_DEFAULT_REGION = var.region
  security-groups = local.security-groups
  subnets = local.subnets
  vpc = local.vpc
  compilations = local.servicios
  subnet-arn = local.subnet-arn
  code-build-branch = local.code-build-branch
  cluster-name = local.cluster-name
  codestar-arn = local.codestar-arn
}

About

automated service deploy using terraform in AWS ECS cluster

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages