This repository holds the Terraform code necessary for provisioning AWS resources as per the technical test requirements.
Ensure these tools are installed on your system:
Execute the following steps to deploy resources using Terraform:
Clone this repository to your local machine:
git clone https://github.com/hkowrada/testDocto.git
Navigate to the repository directory:
cd testDocto
Prepare your Terraform environment:
terraform init
Update the terraform.tfvars
file with appropriate values:
aws_region = "us-east-1"
ami_id = "ami-0e001c9271cf7f3b9"
instance_type = "t2.micro"
instance_name = "doctolib"
bucket_name = "doctolibs3bucket"
iam_role_arn = "arn:aws:iam::730335412610:role/doctolib-ec2-role"
ssh_user = "ubuntu"
ssh_private_key = "path/to/your/private-key.pem"
ssh_key_pair_name = "your-ssh-key-pair-name"
Generate a Terraform plan:
terraform plan
Apply the Terraform configuration:
terraform apply
Confirm with yes
when prompted.
Monitor the provisioning process; outputs will be displayed upon completion.
Connect to the EC2 instance via SSH:
ssh -i path/to/your/private-key.pem ubuntu@<public-ip-address>
Replace placeholder values accordingly. Verify software installation with docker --version
and docker-compose --version
.
To reach the web server hosted on ECS:
- Retrieve the DNS name or public IP from the Application Load Balancer via Terraform outputs or AWS Management Console.
- Access the server through your browser using the retrieved address.
Remove all provisioned resources:
terraform destroy
Confirm with yes
when prompted.