A simple web server that responds to GET /hello and responds with OK and a 200 status code.
- Node.js
Start the server locally:
node ./app/server.js
Send a request locally:
curl -v http://localhost:8080/hello
- Docker
Build the image locally:
docker build -t devops-test ./app
Run the container with optional PORT environment variable (default 8080):
docker run -e PORT=8080 -p 8080:8080 devops-test
Send a request locally:
curl -v http://localhost:8080/hello
- AWS CLI configured
- Docker
- Terraform
terraform -chdir=infra init
terraform -chdir=infra apply
Get ecr_repository_url and lb_dns_name from output. For example:
ecr_repository_url = "022514024772.dkr.ecr.ap-southeast-2.amazonaws.com/devops-test"
lb_dns_name = "devops-test-1688647813.ap-southeast-2.elb.amazonaws.com"
Push the image to ECR based on ecr_repository_url.
aws ecr get-login-password --region ap-southeast-2 | docker login --username AWS --password-stdin 022514024772.dkr.ecr.ap-southeast-2.amazonaws.com
docker buildx build --platform linux/amd64 -t devops-test ./app
docker tag devops-test:latest 022514024772.dkr.ecr.ap-southeast-2.amazonaws.com/devops-test:latest
docker push 022514024772.dkr.ecr.ap-southeast-2.amazonaws.com/devops-test:latest
Send a request to ELB based on lb_dns_name.
curl -v http://devops-test-1688647813.ap-southeast-2.elb.amazonaws.com/hello