https://github.com/buildwithlal/digitaltolk-assessment-task
A small task to assess Python and Terraform skills.
https://github.com/buildwithlal/digitaltolk-assessment-task
Last synced: about 2 months ago
JSON representation
A small task to assess Python and Terraform skills.
- Host: GitHub
- URL: https://github.com/buildwithlal/digitaltolk-assessment-task
- Owner: BuildWithLal
- Created: 2024-11-16T05:15:09.000Z (5 months ago)
- Default Branch: master
- Last Pushed: 2024-11-16T05:46:59.000Z (5 months ago)
- Last Synced: 2025-01-20T09:47:45.178Z (3 months ago)
- Language: HCL
- Size: 13.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
### FastAPI and Terraform Assessment Task
#### Set Up Locally
1. Clone the Repository
```bash
git clone https://github.com/BuildWithLal/digitaltolk-assessment-task.git
```
```bash
cd digitaltolk-assessment-task
```
2. Set Up Infrastructure
Navigate to the Infrastructure directory
```bash
cd infrastructure
```Initialize Terraform:
```bash
terraform init
```
3. Update VPC and Subnet IDs in `Infrastructure/terraform.tfvars`
```bash
vpc_id = "vpc-***********"
public_subnet_id = "subnet-*********"
```
4. Preview the resources to be created
```bash
terraform plan
```
5. Apply the configuration to create the AWS resources:
```bash
terraform apply
```Type `yes` when prompted.
6. SSH into Bastion Instance
```bash
ssh ubuntu@{OUTPUT_IP_FROM_TERRAFORM_APPLY}
```
#### Set Up the FastAPI Application
Navigate to the root directory and run
```bash
docker compose up
```Visit application at http://localhost:8000
#### Clean Up
To avoid unnecessary AWS charges and Resource consumption on local machine, clean up the resources you created:
Navigate back to the Infrastructure directory
```bash
cd infrastructure
```Destroy the resources:
```bash
terraform destroy
```Type `yes` when prompted.
Navigate to the root directory
Press **CTRL + C** to stop the FastAPI application
Remove container and other resources
```bash
docker compose down
```