NOTE: Kong can be deployed as a proxy server using code from https://github.com/GloballogicPractices/ECS-Kong
# Prepare your environment ( Terraform and Ansible )
# Change directory to terraform/environments/development
# We are considering a sample development environment
# Update secrets.tf file with your public key
$ cat secrets.tf
aws_key_name = "test-cluster-key"
aws_key_path = "~/.ssh/test-cluster-key.pem"
// Can be generated using
// ssh-keygen -y -f mykey.pem > mykey.pub
keypair_public_key = "ssh-rsa publickey" # Replace this with public key corresponding to your private key in AWS
# You can use any authentication procedures mentioned here https://www.terraform.io/docs/providers/aws/
$ export AWS_ACCESS_KEY_ID="anaccesskey"
$ export AWS_SECRET_ACCESS_KEY="asecretkey"
$ export AWS_DEFAULT_REGION="us-west-2"
/*
Variables for deploying stack
--------------------------------
- ACM certificates have to pre-exist
*/
// General
region = "eu-central-1" #Select a region based on your preference
vpc_name = "Custom-VPC"
vpc_cidr = "10.2.0.0/16"
// This is for generated ssh.cfg if you want to get into the instance
proxy_cidr = "10.2.*"
/*
Environment keyword is important
- This will become suffix for your clusters
- Ansible roles for deployments are called based on the environment
- For simplicity we keep this as development.
*/
environment = "development"
# AZs are combintation of az length + subnet cidrs
public_sub_cidr = ["10.2.0.0/24","10.2.1.0/24","10.2.2.0/24"]
private_sub_cidr = ["10.2.3.0/24","10.2.4.0/24","10.2.5.0/24"]
azs = ["eu-central-1a","eu-central-1b","eu-central-1c"]
// You can reduce the size if you do not want to incur cost
bastion_instance_type = "t2.micro"
kafka_instance_type = "t2.medium"
# Ansible auto ssh - used when you want to do host level
# configuration
ansible_ssh_user = "ec2-user"
ansible_user = "ansible"
// For public facing sites and ELBs
// Applications will be accessible from these IPs only
control_cidr = "52.45.0.0/16,138.5.0.0/16"
# ECS Kafka cluster
kafka_asg_max_size = 3
kafka_asg_min_size = 3
kafka_asg_desired_size = 3
// Same as vpc cidr. Can change upon vpc peering
private_sub_control_cidr ="10.2.0.0/16"
// Kafka EFS
// Zookeeper config is stored in a sub directorty
// under kafka directory
efs_kafka_data_dir = "/kafka-data"
terraform plan -var-file="secrets.tf"
# If successful then
terraform apply -varf-file="secrets.tf"
## There should be no manual intervention required.
kafka.{{environment}-internal.com
For information on Ecs utility : https://github.com/faizan82/ecs-orchestrate