Skip to content

zero module for a basic AWS kubernetes stack on EKS

License

Notifications You must be signed in to change notification settings

commitdev/zero-aws-eks-stack

Repository files navigation

Overview

Validation Status

A set of templates meant to work with Zero, the templated result is a ready to scale infrastructure boilerplate built on top of AWS EKS baked with all best practices we have accumulated.

Repository structure

The root folder is used for declaring parameters required by the templates, and Zero will gather the required parameters and parse the templates as individual repositories for user to maintain.

/   # file in the root directory is for initializing the user's repo and declaring metadata
|-- Makefile                        #make command triggers the initialization of repository
|-- zero-module.yml                 #module declares required parameters and credentials
|
|   # files in templates become the repo for users
|   templates/
|   |   # this makefile is used both during init and
|   |   # on-going needs/utilities for user to maintain their infrastructure
|   |-- Makefile
|   |-- terraform/
|   |   |-- bootstrap/              #initial setup
|   |   |-- environments/           #infrastructure setup
|   |   |   |-- prod/
|   |   |   |-- stage/
|   |-- kubernetes
|   |   |-- terraform
|   |   |   |-- environments        #k8s-ultities
|   |   |   |   |-- prod/
|   |   |   |   |-- stage/

AWS EKS Stack

The Zero-aws-eks stack is designed with scalability and maintainability in mind, this repo is a series of templates indented to be filled in with modules parameters, and executed by zero This is a Zero module which sets up a hosting environment on AWS running Kubernetes. It will generate terraform output which describes the environment mapped in this architecture diagram.

Resource List: Link

Prerequisites

  • Terraform installed
  • Kubectl installed
  • Wget installed
  • A valid AWS account
  • Set up the AWS CLI
  • A domain registered with Route53
    • Note: if you want to use different domain per environment (staging/production), you need to have multiple hosted zones. The available zones in Route53 can be found by running this command. aws route53 list-hosted-zones

Optional Prerequisites

Getting Started

This is meant to be used with the zero tool and not directly. See the Zero repository for more information. The tool will parse through configuration and fill in any template variables which need to be encoded into the terraform configuration.

Testing and linting

The codebase uses terraform validate as a basic sanity check, it uses an example zero-project.yml fixture to fill-in the templates, then runs terraform init and terraform validate against the templated out environment and modules.

How much does this stack cost?

The expected total monthly cost: $ 0.202 USD / hr or ~$150USD / month. The most expensive component will be the EKS cluster as well as the instances that it spins up. Costs will vary depending on the region selected but based on us-west-2 the following items will contribute to the most of the cost of the infrastructure:

  • EKS Cluster: $0.1 USD / hr
  • NAT Gateway: $0.045 USD / hr
  • RDS (db.t3.small): $0.034 USD / hr
  • EC2 (t2.small): $0.023 USD / hr

EC2 instance sizing can be configured in templates/terraform/environments/stage/main.tf

Other links

Project board