Skip to content

About

This project uses Terraform and Ansible to automate the provisioning and configuration of a Kubernetes cluster on AWS. With a single command, you can create a cluster of any size and have it fully configured automatically.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Repository files navigation

AWS Cluster Setup with Terraform and Ansible

AWS Cluster Architecture

This project uses Terraform and Ansible to automate the provisioning and configuration of a Kubernetes cluster on AWS. With a single command, you can create a cluster of any size and have it fully configured automatically.

This solution is ideal for developers and DevOps engineers who want to quickly provision AWS infrastructure and manage it using Infrastructure as Code (IaC) tools.

Features

  • Automated Cluster Provisioning – Deploy an AWS-based cluster with any number of worker nodes.
  • Infrastructure as Code – Manage infrastructure using Terraform.
  • Automated Configuration – Configure cluster nodes automatically with Ansible.
  • Easy to Use – Launch the entire setup with a single make command.
  • Customizable – Easily modify configuration values to fit your environment.

Prerequisites

Before getting started, make sure the following tools are installed on your machine:

Getting Started

1. Clone the Repository

git clone https://github.com/ayumusakdiken/maker-cluster.git
cd maker-cluster

2. Configure the Environment

Before running the deployment, update the following configuration values according to your environment:

AWS Region

Set your preferred AWS region in:

main.tf

EC2 Instance Type

The default instance type is t3.medium.

If you want to use a different instance type or deploy in a region where t3.medium is unavailable, update the instance_type variable in:

ec2-instance.tf

SSH Private Key

Update the PRIVATE_KEY_PATH variable in the Makefile:

PRIVATE_KEY_PATH=/path/to/your/private-key.pem

This key will be used by Ansible to connect to the EC2 instances.

3. Configure AWS CLI

Terraform uses AWS CLI credentials to authenticate with AWS.

If you have not configured AWS CLI yet, run:

aws configure

Provide your:

  • AWS Access Key ID
  • AWS Secret Access Key
  • Default Region
  • Output Format

Verify that your credentials have sufficient permissions to create AWS resources.

4. Deploy the Cluster

Run:

make

You will be prompted to enter the number of worker nodes:

How many worker nodes would you like to create?

After entering the desired number, Terraform will provision the infrastructure and Ansible will automatically configure the cluster.

Makefile Commands

Deploy the Cluster

make

Creates the infrastructure and configures the cluster.

Update Terraform Dependencies

make update

Reinitializes Terraform modules/providers and reapplies the configuration.

Export Inventory

make out

Generates the Ansible inventory file from Terraform outputs.

Retrieve Kubeconfig

make kubeconfig

Downloads and updates the kubeconfig file without reconfiguring the entire cluster.

Destroy the Cluster

make clean

Removes all AWS resources created by Terraform.

Clear Local Cache

make cache

Removes Terraform state files, lock files, and generated Ansible artifacts.

About

This project uses Terraform and Ansible to automate the provisioning and configuration of a Kubernetes cluster on AWS. With a single command, you can create a cluster of any size and have it fully configured automatically.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages