Elastic Container Service - Lexicon from CLI

Prerequisites

Firstly install and configure both the AWSCLI and ECSCLI.

These are the steps to use the CLI to generate the Lexicon infrastructure with a Fargate Task. All .json configuration files are available on github.

Cluster

1
2
3
4
5
6
7
8
--- Create ECS cluster using config and profile setup from `Prerequisites`
ecs-cli up --cluster-config carl_configuration_name --ecs-profile carl_ecs_cli_profile

--- Get default security group ID for the VPC. Use the VPC ID from the previous output
aws ec2 describe-security-groups --filters Name=vpc-id,Values=vpc-00000000000000000 --region ap-southeast-2

--- Security group rule to allow inbound access on port 80
aws ec2 authorize-security-group-ingress --group-id sg-0000000000000000 --protocol tcp --port 80 --cidr 0.0.0.0/0 --region ap-southeast-2

Compose File

Here you will need subnet ID 1, subnet ID 2 and security group ID values which would have been displayed when you ran ecs-cli up. If you cleared the console you can use aws ec2 describe-vpcs and look at the Tags to make an educated guess.

References