TerraTicTac: Containerized Tic-Tac-Toe Game Hosted on AWS ECS with Terraform for Iac
Create a new repository and launch a github Code-spaces
Rebuilding Codespace container with Terraform and AWS
Docker comes pre-installed, or else you can add Docker as well.
Rebuild the container:
Checking whether everything is installed properly:
Code for tic tac toe game
Find code in repo: https://github.com/Rupak-Shrestha/Terraform-ECS-tictactoe/tree/main/tictactoe-app
Push code to GitHub:
Adding logo file:
Check image in codespace:
Write a Docker file
Build image with Dockerfile: docker build -t tictactoeapp:latest .
Build a container with this image
Open in Browser:
App running successfully:Push image to DockerHub
docker tag tictactoeapp:latest rupaks/tictactoe-app:latest
docker login
docker push rupaks/tictactoe-app:latestTerraform for ECS
Creating the filesFind code in repo: https://github.com/Rupak-Shrestha/Terraform-ECS-tictactoe/tree/main/tf-for-ecs
Create access key and secret key from AWS console:
Push code to remote repo:
aws configure:
Keep the key secure.
Run terraform commands
Check resources
VPC, Subnet, Route table, Internet GatewaySecurity Group
ECS cluster
Running ECS container:
Access the application:
Destroy the resources:
Never forget to destroy the resources.
Happy Learning!