Giter Club home page Giter Club logo

energy-costs's Introduction

Energy Costs

Service to demonstrate ECS with Fargate.

Application

A simple hello world app with health check written using Go with Gorilla mux for routing requests.

Dockerfile

The dockerfile has been built in 2 stages. The first to get dependencies and build the app. The second using a distroless build with only the bare essentials to run the app.

The file can built and ran locally (exposing at port 8080) with:

docker build -t energycost .
docker run -p 8080:8080 -it energycost

Infrastructure

Infrastructure has been written using Terraform for ECS on AWS with high availability in mind. The project consists of the following:

  • A VPC with a /16 netmask, allowing for a total of 65536 IP addresses.
  • Subnets with /24 netmasks, allowing for a total of 256 IP addresses per subnet.
  • 3 Public subnets, in 3 AZs.
  • 3 Private application subnets, in 3 AZs. These will host all application servers.
  • 3 Private database subnets, in 3 AZs. These will host all database servers.
  • 1 internet gateway.
  • Public route table, with route to the internet gateway. Public subnets are associated with the public route table.
  • Public security group. Allow tls/http from anywhere and all egress traffic.
  • Private application security group. Allow traffic from the resources associated with the public security group and all egress traffic.
  • Default security group. Allow all internal VPC traffic and all egress traffic.
  • VPC endpoints associated with the VPC for ECR (dkr and api instance endpoint) and S3 (gateway endpoint). This allows ECS to pull the requested resources from ECR.
  • Application Load Balancer in the 3 public subnets, associated with the public security group. ALB has health check configured to for /health, along with a http listener.
  • ECR repository to hold the docker image.
  • ECS task definition using fargate defined with the minimum compute (256 cpu, 512 memory).
  • ECS cluster with single service running the task definition running within the private application subnets and the private application security group.
  • Autoscaling scheduled actions: in to 0 in the evening, and out to 1 in the morning.
  • Autoscaling target tracking policy to scale in/out to maintain a maximum of 75% cpu utilization.

energy-costs's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.