Terraform files for fully-automated deployment of VMLabAutomation on ECS cluster on AWS. Basic configuration contains database, app and selected number of worker instences. The deployed system is described here.
Repository includes two main parts:
app
folder which contains terraform code needed for app deployment.ami
folder which contains some packer files to build Amazon AMIs for workers and P4 lab. Also terraform with bucket and role needed for ami import is included there.
Requires: terraform 0.14.7
- Navigate to Amazon AWS Console and copy credentials in format:
[default]
aws_access_key_id=
aws_secret_access_key=
aws_session_token=
- Paste them in
./.aws/credentials
cd ami
- Create ami using packer
packer build amis/amzn_ecs_worker.pkr.hcl
and copy ami id intovar.cluster_ami
cd app
- Run
cp ./env/secret.template.tfvars ./env/secret.tfvars
and paste required credentials there - Then in the
app
folder type:terraform -chdir=scripts init
terraform -chdir=scripts apply -var-file=../env/dev.tfvars -var-file=../env/secret.tfvars
- Enjoy!
cd ami/p4-machine
vagrant up
- Stop machine manually (shutdown doesn't work well)
cd ..
packer build p4lab.pkr.hcl
AWS doesn't support nested virtualization on smaller instances...