scripts for auto-setup of an ECS cluster and agent workdir
- AWS access configured
- awscli, ecs-cli and jq installed
- create an IAM role called ecsInstanceRole with the following policy attached: AmazonEC2ContainerServiceforEC2Role. see here for more details on this role.
- your ssh key imported to all regions:
./create-key-pairs.sh ~/.ssh/id_ed25519.pub
# create a cluster in us-west-2 (this will have no instances)
./create-cluster.sh us-west-2 myCluster
# add an m5.large ec2 container instance to cluster (defaults to m5.large)
./add-instance-to-cluster.sh myCluster m5.large
# register a task definition
aws ecs register-task-definition --region us-west-2 --cli-input-json file://sampletask.json
# run the task definition "dd" on cluster
./run-task.sh myCluster dd
- Run
remove-instances-from-cluster.sh CLUSTER_NAME
to terminate all instances in cluster, but keep the cluster. - Run
delete-cluster.sh CLUSTER_NAME
to terminate all instances in cluster and delete it's cloudformation stack.