Skip to content

Latest commit

 

History

History

ec2-autoscaling

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

ECS Cluster w/ EC2 Autoscaling

Configuration in this directory creates:

  • ECS cluster using EC2 autoscaling groups
  • Autoscaling groups with IAM instance profile to be used by ECS cluster
  • Example ECS service that utilizes
    • Mounts a host volume into the container definition
    • Load balancer target group attachment
    • Security group for access to the example service

Usage

To run this example you need to execute:

$ terraform init
$ terraform plan
$ terraform apply

Note that this example may create resources which will incur monetary charges on your AWS bill. Run terraform destroy when you no longer need these resources.

Requirements

Name Version
terraform >= 1.0
aws >= 4.66.1

Providers

Name Version
aws >= 4.66.1

Modules

Name Source Version
alb terraform-aws-modules/alb/aws ~> 9.0
autoscaling terraform-aws-modules/autoscaling/aws ~> 6.5
autoscaling_sg terraform-aws-modules/security-group/aws ~> 5.0
ecs_cluster ../../modules/cluster n/a
ecs_service ../../modules/service n/a
vpc terraform-aws-modules/vpc/aws ~> 5.0

Resources

Name Type
aws_availability_zones.available data source
aws_ssm_parameter.ecs_optimized_ami data source

Inputs

No inputs.

Outputs

Name Description
cluster_arn ARN that identifies the cluster
cluster_autoscaling_capacity_providers Map of capacity providers created and their attributes
cluster_capacity_providers Map of cluster capacity providers attributes
cluster_id ID that identifies the cluster
cluster_name Name that identifies the cluster
service_autoscaling_policies Map of autoscaling policies and their attributes
service_autoscaling_scheduled_actions Map of autoscaling scheduled actions and their attributes
service_container_definitions Container definitions
service_iam_role_arn Service IAM role ARN
service_iam_role_name Service IAM role name
service_iam_role_unique_id Stable and unique string identifying the service IAM role
service_id ARN that identifies the service
service_name Name of the service
service_task_definition_arn Full ARN of the Task Definition (including both family and revision)
service_task_definition_revision Revision of the task in a particular family
service_task_exec_iam_role_arn Task execution IAM role ARN
service_task_exec_iam_role_name Task execution IAM role name
service_task_exec_iam_role_unique_id Stable and unique string identifying the task execution IAM role
service_task_set_arn The Amazon Resource Name (ARN) that identifies the task set
service_task_set_id The ID of the task set
service_task_set_stability_status The stability status. This indicates whether the task set has reached a steady state
service_task_set_status The status of the task set
service_tasks_iam_role_arn Tasks IAM role ARN
service_tasks_iam_role_name Tasks IAM role name
service_tasks_iam_role_unique_id Stable and unique string identifying the tasks IAM role

License

Apache-2.0 Licensed. See LICENSE.