- Python flask microservice server connected to mongodb from official docker hub image
- Containerised with docker
- Easily deployed with Terraform and docker-compose
- Deployed on my free-tier aws EC2 instance (t2.micro)
http://52.221.192.224:5001/users
- In terraform/main.tf, edit access_key and secret_key with IAM user credentials that have sufficient privileges
- Navigate to terraform folder and open cmd here
- Execute these commands:
terraform init
terraform apply
π Deployment on Cloud (Amazon Linux 2) (ALL THESE WILL BE DONE BY TERRAFORM, view user data in terraform codes.)
- Connect to ec2 instance and access the terminal
- Install required dependencies:
- Getting git repository folders into ec2 instance:
- Deploy docker compose:
- Ensure security groups and network access control list allows for inbound connection to the ec2 instance
sudo yum update
sudo yum install git
sudo yum install docker
sudo yum install docker-compose-plugin
mkdir assessment2
cd assessment2
git clone https://github.com/adamhcj/assessment2.git
sudo docker compose up -d
With docker compose installed, simply navigate to root directory of this repository, and type:
docker compose up -d