Giter Site home page Giter Site logo

lamp-on-aws-ecs's Introduction

LAMP on AWS ECS example

Demo showing example of a containerised LAMP application with high availability deployed on AWS.

Containers on AWS! Awesome!

Author: Lim Chooi Guan

Technology stack

  • AWS ECS for containers
  • AWS Cloudfront for content distribution
  • AWS Aurora RDS MySQL

Instructions

To deploy the application you will need the AWS CLI installed. Then clone this repo, change directory to the cloudformation directory, and run the following in order from the terminal:

aws --region us-east-1 cloudformation create-stack --stack-name ecs-networking --template-body file://ecs-networking.yml --capabilities CAPABILITY_NAMED_IAM
aws --region us-east-1 cloudformation create-stack --stack-name ecs-public-service --template-body file://ecs-public-service.yml --capabilities CAPABILITY_NAMED_IAM
aws --region us-east-1 cloudformation create-stack --stack-name rds-aurora-mysql --template-body file://rds-aurora-mysql.yml --capabilities CAPABILITY_NAMED_IAM

This will deploy 3 stacks in the us-east-1 region. But you can deploy these in any region you deem appropriate.

  1. ecs-networking provides the networking infrastructure (vpc, subnets, internet gateway, nat gateways, hosted zone record set).
  2. ecs-public-service contains the service which defines the tasks (containers) to run. The docker image used is retrieved from my docker hub repo. This is a php application which you can modify, it is referenced in app/index.php. The Dockerfile to build this image is stored here.
  3. rds-aurora-mysql creates the Aurora RDS cluster with 2 MySQL database instances, one for failover purposes.

Note: This is a demo only. You will have to make some minor changes by providing your own values in the Cloudformation templates. The SSL certificate which I am using is my own and used for the domain moocaholic.com. Additionally code for connecting to the database including the username and password has to be provided in app/index.php. You will have to make these changes to your own Docker image and then push this image either to either Dockerhub (or Amazon ECR) and provide the URL to the ecs-public-service template. Note that the retrieval of the image of baby yoda in this demo is using Cloudfront, but that is not automated. Session stickiness has not been enabled so as to illustrate load balancing. If you want sessions to be sticky this has to be enabled in the target group, see here for instructions.

lamp-on-aws-ecs's People

Contributors

minimice avatar

Watchers

James Cloos 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.