Prerequisites
Clone the project (https://github.com/NileTradeX/infrastructure-as-code.git) and go to the EKS directory.
To run the Terraform project, you will need:
- Terraform v1.8+
- an AWS account
- the AWS CLI v2.7.0/v1.24.0 or newer, installed and configured
- AWS IAM Authenticator
- kubectl v1.24.0 or newer
Installation
AWS Configuration
- Configure your AWS credentials using the AWS CLI with
aws configure
. You will need your AWS Access Key ID, Secret Access Key, and default region name.
Deployment
- Initialize your Terraform workspace, which will download the provider plugins for AWS:
terraform init
- Validate the Terraform configuration files:
terraform validate
- Plan your changes:
terraform plan
- Apply your changes:
terraform apply
Outputs
This Terraform module will output the following:
cluster_name
: The name of the EKS cluster.cluster_version
: The version of the EKS cluster.cluster_endpoint_public_access
: Whether the EKS cluster endpoint is publicly accessible.enable_cluster_creator_admin_permissions
: Whether the creator of the EKS cluster has admin permissions.
Configure kubeconfig
After the EKS cluster is created, you can configure kubectl to use the new cluster by updating your kubeconfig file:
aws eks –region
Replace <region>
with your AWS region and <cluster_name>
with the output cluster_name
.
Destruction
To destroy the Terraform-managed infrastructure:
terraform destroy
Please note that this will destroy all the resources created by Terraform, including the EKS cluster and the VPC.