All Projects → azavea → terraform-aws-ecs-web-service

azavea / terraform-aws-ecs-web-service

Licence: Apache-2.0 license
A Terraform module to create an Amazon Web Services (AWS) EC2 Container Service (ECS) service associated with an Application Load Balancer (ALB).

Programming Languages

HCL
1544 projects
shell
77523 projects

Projects that are alternatives of or similar to terraform-aws-ecs-web-service

terraform-aws-ecs-service
Creates an ECS Service.
Stars: ✭ 86 (+230.77%)
Mutual labels:  ecs, terraform-modules, ecs-service
terraform-aws-ecs-cluster
Terraform module for building an ECS cluster in AWS
Stars: ✭ 42 (+61.54%)
Mutual labels:  ecs, terraform-modules, ecs-service
ecs-deplojo
Deployment tool for Amazon ECS
Stars: ✭ 19 (-26.92%)
Mutual labels:  ecs, amazon-web-services
ecsdemo-crystal
Part 4 of a 4 part ECS Workshop
Stars: ✭ 54 (+107.69%)
Mutual labels:  ecs, ecs-service
provose
Provose is a new way to manage your Amazon Web Services infrastructure.
Stars: ✭ 27 (+3.85%)
Mutual labels:  ecs, amazon-web-services
terraform-ecs
Terraform ECS module
Stars: ✭ 15 (-42.31%)
Mutual labels:  ecs, terraform-modules
container-demo
How can I manage microservices using ecs-cli?
Stars: ✭ 30 (+15.38%)
Mutual labels:  ecs, ecs-service
terraform-aws-alb-ingress
Terraform module to provision an HTTP style ingress rule based on hostname and path for an ALB using target groups
Stars: ✭ 20 (-23.08%)
Mutual labels:  ecs, terraform-modules
terraform-aws-ecs-fargate-service
AWS ECS Fargate Service Terraform Module
Stars: ✭ 52 (+100%)
Mutual labels:  amazon-web-services, ecs-service
terraform-aws-mongodb
Simplify MongoDB provisioning on AWS using Terraform
Stars: ✭ 20 (-23.08%)
Mutual labels:  ecs, terraform-modules
Compose Cli
Easily run your Compose application to the cloud with compose-cli
Stars: ✭ 353 (+1257.69%)
Mutual labels:  ecs, amazon-web-services
terraform-aws-s3-bucket
A Terraform module to create a Simple Storage Service (S3) Bucket on Amazon Web Services (AWS). https://aws.amazon.com/s3/
Stars: ✭ 47 (+80.77%)
Mutual labels:  amazon-web-services, terraform-modules
terraform-aws-acm-certificate
A Terraform module to create an Amazon Certificate Manager (ACM) certificate with Route 53 DNS validation.
Stars: ✭ 43 (+65.38%)
Mutual labels:  amazon-web-services, terraform-modules
terraform-aws-iam-user
A Terraform module to create and manage Identity and Access Management (IAM) Users on Amazon Web Services (AWS). https://aws.amazon.com/iam
Stars: ✭ 17 (-34.62%)
Mutual labels:  amazon-web-services, terraform-modules
Ecs Deploy
Powerful CLI tool to simplify Amazon ECS deployments, rollbacks & scaling
Stars: ✭ 541 (+1980.77%)
Mutual labels:  ecs, amazon-web-services
terraform-aws-ecs-fargate-scheduled-task
AWS ECS Fargate Schedule Task Terraform Module
Stars: ✭ 25 (-3.85%)
Mutual labels:  ecs, amazon-web-services
terraform-aws-vpc
A Terraform module to create an Amazon Web Services (AWS) Virtual Private Cloud (VPC).
Stars: ✭ 24 (-7.69%)
Mutual labels:  amazon-web-services, terraform-modules
terraform-aws-redis-elasticache
A Terraform module to create an Amazon Web Services (AWS) Redis ElastiCache cluster.
Stars: ✭ 33 (+26.92%)
Mutual labels:  amazon-web-services, terraform-modules
terraform-aws-ecs-web-app
Terraform module that implements a web app on ECS and supports autoscaling, CI/CD, monitoring, ALB integration, and much more.
Stars: ✭ 175 (+573.08%)
Mutual labels:  ecs, ecs-service
Amazon Ecs Nodejs Microservices
Reference architecture that shows how to take a Node.js application, containerize it, and deploy it as microservices on Amazon Elastic Container Service.
Stars: ✭ 483 (+1757.69%)
Mutual labels:  ecs, amazon-web-services

terraform-aws-ecs-web-service

CircleCI

A Terraform module to create an Amazon Web Services (AWS) EC2 Container Service (ECS) service associated with an Application Load Balancer (ALB).

Usage

resource "aws_security_group_rule" "app_lb_https_ingress" {
  type        = "ingress"
  from_port   = 443
  to_port     = 443
  protocol    = "tcp"
  cidr_blocks = ["0.0.0.0/0"]

  security_group_id = "${module.app_web_service.lb_security_group_id}"
}

resource "aws_ecs_task_definition" "app" {
  lifecycle {
    create_before_destroy = true
  }

  family                = "ProductionApp"
  container_definitions = "..."
}

module "app_web_service" {
  source = "github.com/azavea/terraform-aws-ecs-web-service?ref=0.4.0"

  name                = "App"
  vpc_id              = "vpc-..."
  public_subnet_ids   = ["subnet-...", "subnet-..."]
  access_log_bucket   = "logs-bucket"
  access_log_prefix   = "ALB"
  health_check_path   = "/health-check/"
  port                = "8080"
  ssl_certificate_arn = "arn..."

  cluster_name                   = "default"
  task_definition_id             = "${aws_ecs_task_definition.app.family}:${aws_ecs_task_definition.app.revision}"
  desired_count                  = "1"
  min_count                      = "1"
  max_count                      = "2"
  scale_up_cooldown_seconds      = "300"
  scale_down_cooldown_seconds    = "300"
  deployment_min_healthy_percent = "100"
  deployment_max_percent         = "200"
  container_name                 = "django"
  container_port                 = "8080"
  
  ecs_service_role_name = "..."

  project     = "${var.project}"
  environment = "${var.environment}"
}

resource "aws_cloudwatch_metric_alarm" "app_service_high_cpu" {
  alarm_name          = "alarmAppCPUUtilizationHigh"
  comparison_operator = "GreaterThanOrEqualToThreshold"
  evaluation_periods  = "1"
  metric_name         = "CPUUtilization"
  namespace           = "AWS/ECS"
  period              = "60"
  statistic           = "Average"
  threshold           = "60"

  dimensions {
    ClusterName = "default"
    ServiceName = "App"
  }

  alarm_actions = ["${module.app_web_service.appautoscaling_policy_scale_up_arn}"]
}

resource "aws_cloudwatch_metric_alarm" "app_service_low_cpu" {
  alarm_name          = "alarmAppCPUUtilizationLow"
  comparison_operator = "LessThanOrEqualToThreshold"
  evaluation_periods  = "1"
  metric_name         = "CPUUtilization"
  namespace           = "AWS/ECS"
  period              = "60"
  statistic           = "Average"
  threshold           = "15"

  dimensions {
    ClusterName = "default"
    ServiceName = "App"
  }

  alarm_actions = ["${module.app_web_service.appautoscaling_policy_scale_down_arn}"]
}

Variables

  • name - Name of the service in CamelCase without spaces
  • vpc_id - ID of VPC housing the service
  • public_subnet_ids - A list of public subnet IDs used to place load balancers
  • security_group_ids - A list of security group IDs to append to the load balancer (default: [])
  • access_log_bucket - Bucket name used to collect load balancer access logs
  • access_log_prefix - Prefix within bucket to nest load balancer access logs
  • health_check_path - Path to use for service health check (default: /)
  • port - Port used for the load balancer target group
  • ssl_certificate_arn - ARN of the certificate to associate with the HTTPS listener
  • cluster_name - ECS cluster name to associate with the service
  • task_definition_id - Concatenation of ECS task definition family and revision separated by a colon
  • ecs_service_role_name - Name of IAM role for ECS tasks
  • desired_count - Desired number of service instances (default: 1)
  • min_count - Minimum number of service instances (default: 1)
  • max_count - Maximum number of service instances (default: 1)
  • deployment_min_healthy_percent - Minimum healthy service instances as a percentage (default: 100)
  • deployment_max_percent - Maximum service instances as a percentage (default: 200)
  • container_name - Name of container in task definition to associate with load balancer
  • container_port - Port exposed by container in task definition to associate with load balancer
  • scale_up_cooldown_seconds - Amount of time, in seconds, after a scale up activity completes and before the next can start (default: 300)
  • scale_down_cooldown_seconds - Amount of time, in seconds, after a scale down activity completes before the next can start (default: 300)
  • project - Name of project for this service (default: Unknown)
  • environment - Name of environment for this service (default: Unknown)

Outputs

  • id - The service ARN
  • name - The service name
  • lb_zone_id - Service load balancer hosted zone ID
  • lb_dns_name - Service load balancer DNS name
  • lb_security_group_id - Security group ID of load balancer security group
  • appautoscaling_policy_scale_up_arn - ARN of Application AutoScaling policy to scale up
  • appautoscaling_policy_scale_down_arn - ARN of Application AutoScaling policy to scale down

Note: A security group for the service load balancer is created within the module without any rules. Use the lb_security_group_id output along with aws_security_group_rule as seen in the example above to add your own security group rules.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].