Skip to content
Get fine-grained Kubernetes + Infrastructure on AWS in 30 mins πŸš€
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
root-infra
root-kubernetes
script-provision
script-ssh
template
.gitignore
README.md
create-ssh-key.sh

README.md

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 git@github.com: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=1ambda@github.com ./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

You can’t perform that action at this time.