This repository contains Terraform scripts to automate the deployment of a Docker Swarm cluster on AWS EC2 instances. Docker Swarm allows you to manage a cluster of Docker engines, providing native clustering capabilities to turn a group of Docker engines into a single virtual Docker engine.
Before you begin, ensure you have the following:
- AWS account with appropriate permissions.
- Terraform installed locally. See Terraform Installation Guide for instructions.
- AWS CLI installed and configured with an IAM user's access key and secret key.
-
Clone the Repository:
git clone https://github.com/saikiranpi/Terraform-Docker-Swarm-Cluster.git cd Terraform-Docker-Swarm-Cluster -
Update AWS Key Location and Name: Replace the default key location and name in Terraform configuration files (
variables.tf,main.tf) with your own key details. -
Validate Terraform Configuration:
terraform validate
-
Plan Deployment:
terraform plan
-
Apply Deployment:
terraform apply
Enter
yeswhen prompted to confirm the deployment. -
Accessing the Docker Swarm Cluster: After deployment, follow Terraform output or AWS Console to access the Docker Swarm cluster.
- Adjust
variables.tfandmain.tfto customize cluster size, instance types, and other parameters.
To destroy the Docker Swarm cluster and associated resources:
terraform destroyEnter yes when prompted to confirm destruction.
Contributions are welcome! Feel free to open issues or pull requests for any improvements or fixes.
This project is licensed under the MIT License - see the LICENSE file for details.