A simple ECS Terraform setup that includes:
- 1 Task CPU based auto-scale
- 1 SQS Message count based auto-scale.
- 1 VPC
- 4 Subnets(2 public and 2 private)
- 2 Elastic IP
- 2 NAT
- 1 ALB
- 1 ECS Cluster
- 2 ECS Service
- 2 SQS
- Set AWS Credentials using
awsuser
for profile. - Execute
terraform apply ${image}
(Make sure you pick correct workspace).
env
- module that based on selected workspace specify what environment will be used across the whole deploymentsecurity
- generate role/security groups and etc...workers
- a module that represents worker instance.
- Select the environment you want with following command -
terraform workspace select ${environment}
. - Execute
terraform apply
and provide the required container image parameter. - If deploy plan is OK, type yes.
aws ecs execute-command --profile ${aws_profile} --region us-east-1 --cluster ${cluster_name} --task ${task} --command bash --interactive