Skip to content

Latest commit

 

History

History
129 lines (98 loc) · 7.94 KB

README.md

File metadata and controls

129 lines (98 loc) · 7.94 KB

terraform-all-in-one

Get fine-grained Kubernetes + Infrastructure on AWS in 30 mins 🚀


Prerequisite

$ brew install ansible jq terraform kops watch
$ pip install awscli

$ git clone [email protected]:1ambda/terraform-all-in-one.git
$ cd terraform-all-one

# Remove .gitigonre to index generated files
rm .gitignore

Usage

1. Export AWS Key Environment variables

The key should have AdministratorAccess permission.

$ export AWS_ACCESS_KEY_ID={VALUE} AWS_SECRET_ACCESS_KEY={VALUE}

2. Generate SSH Key Pair

# Modify values for `COMPANY`,`PROJECT`, and `EMAIL`
$ COMPANY=github PROJECT=1ambda [email protected] ./create-ssh-key.sh

3. Modify Terraform Variables to Customize

company and project variable should match with values used for the generated ssh key.

4. Applying Terraform Modules

  • root-infra: Create VPC, Bastion, ECS, Stroages and build kops scripts

    cd root-infra;
    
    # build infra using terraform
    terraform init
    terraform apply -var 'rds_username={USERNAME}' -var 'rds_password={PASSWORD}'
    
    # provision non-managed stroages using ansible
    ../script-provision/generated.provision-zookeeper.sh
  • root-kubernetes: Build Kubernetes Cluster and install add-ons

    cd root-kubernetes;
    
    # generate kops files
    $(cat generated.kops-env.sh);
    ./generated.kops-create.sh;
    
    # build kubernetes cluster
    terraform init
    terraform apply
    
    # wait for few minitues until Kube API ELB is ready (`api-kops-*`)
    # then validate the created cluster
    kops export kubecfg --name=$NAME
    ./generated.correct-kubectl-context.sh
    
    # wait for 3-5 mins until kubernetes cluster is ready
    kops validate cluster
    kubectl get pods

Features

Credits