Skip to content

doritoes/ipdice.com

Repository files navigation

ipdice.com

Building a container-based IP address web site on Amazon ECS.

Please be forewarned that this lab is fairly expensive. AWS promises to save you up to 50% on compute costs by utilizing autonomous scaling, provisioning, and usage-based pricing. However the costs of even a lab environment add up quickly. Here the top costs:

  • VPC costs 💵
  • ELB costs 💵
    • you pay for AWS resources to run the load balancer(s)
    • per application load balancer-hour
    • per LCU-hour (load-based)
    • redue the number of regions
  • ECS costs 💵
    • you pay for the memory and vCPU resourcs the containers use
    • reduce costs by reducing the minimum required CPU and memory in the Task definition
    • reduce scaling - use step scaling and reduce the maximum number of tasks
    • reduce the number of regions
  • Route53 - monthly cost
  • EC2 costs / EC2 - Other
    • Idle Elastic IPs incur a small fee
    • ELB usage is charged a small fee

Learn more at https://www.appsdevpro.com/blog/aws-fargate-pricing/

Docker Pulls nginx 1.24 php 8.3 License MIT

Please be forewarned that this lab is fairly expensive. AWS promises to save you up to 50% on compute costs by utilizing autonomous scaling, provisioning, and usage-based pricing. However the costs of even a lab environment add up quickly. Here the top costs:

  • VPC costs 💵
  • ELB costs 💵
    • you pay for AWS resources to run the load balancer(s)
    • per application load balancer-hour
    • per LCU-hour (load-based)
    • redue the number of regions
  • ECS costs 💵
    • you pay for the memory and vCPU resourcs the containers use
    • reduce costs by reducing the minimum required CPU and memory in the Task definition
    • reduce scaling - use step scaling and reduce the maximum number of tasks
    • reduce the number of regions
  • Route53 - monthly cost
  • EC2 costs / EC2 - Other
    • Idle Elastic IPs incur a small fee
    • ELB usage is charged a small fee

Learn more at https://www.appsdevpro.com/blog/aws-fargate-pricing/

Overview and Genesis

After building a number of container web apps and deploying them to on-premise Kubernetes (k8), I wanted to try a real-world use case. Patterning after https://github.com/doritoes/ipgiraffe.com, I am creating a new site to return a more complete and playful IP Address web site experience.

Amazon Elastic Container Service (ECS) offers a simplified experience with tight integration with AWS services. This is just what I want for my lab.

  • I haven't used ECS before
  • Use Route 53 and CloudFront for multi-regions support
  • Supports service auto scaling (container instances)
  • Supports capacity provider scaling

This demonstration site has the following features:

  • No ads
  • No SQL backend
  • Serverless computing on Fargate
  • Small container based on Alpine Linux
  • Demonstrate global autoscaling container applications without breaking the bank (don't want to cost too much for this free site)
  • Gradually release new experiences to the web application
  • Integration with external geo-location API
  • Fun easter eggs to find

Project Goals

Here are the goals I have for this project. If you would like to encourage me to add additional goals or to complete these goals, I'm open to contributions to pay my Cloud bills.

This is mean to be a step-by-step Lab exercise that you can follow along to.

In Scope

Completed

  • Register domain name
  • Bootstrapping repo on Github
  • Bootstrapping image on Docker Hub
  • Basic IP address experience
  • One region built
  • Multi-region
  • Added first two easter eggs
  • Multi-region
  • Add anti-snoop protection
  • Integration with https://www.ip-api.com for geo-location

Working on

  • Improvement and testing

Will Do

  • No major work at this point

Might Do

  • Feature: Dice rolling experience
  • Feature: API for dice rolls (using custom dice rolling algorithm)
  • Feature: API for physical dice roles (rolled and captured by Raspberry Pi-powered physical device)

Out of Scope

  • Amazon Elastic Kubernetes Service (EKS) doesn't meet my criteria for integrating a new technology for me. I have done other Kubernetes labs (here and here).
  • Azure and GCP are out of scope for this lab

Step-by-Step

  1. Pre-Requisites
  2. Create and Build the Web App Container
  3. Configuring ECS
  4. Configuring CloudFront
  5. Testing and Monitoring
  6. Adding Regions
  7. Next Steps

References

My favorite IP address checking web sites:

More "IP Animals":

IP Lookup API options

My IP address checking web sites:

My other web sites:

To find your private LAN IP address: