This project deploys a Dockerized Node.js Express app onto a single EC2 instance using Terraform.
- Uses the default VPC (simple & low-friction)
- Installs Docker via user data
- Builds the Docker image on the instance and runs it on port 80
- Allocates an Elastic IP and prints the URL as an output
- AWS account and credentials configured (
aws configure) - Terraform >= 1.6
- Default VPC present in the chosen region (it exists in most accounts; you can also adapt to a custom VPC)
cd terraform
terraform init
terraform applyOutputs include public_ip and url. Open the URL to see the
paste the public ip to your browser and then
// connect the instance to gitbash and then in gitbash
do sudo-i cd /opt/app/ docker-compose up -d
And now our node js app is ready