Code Monkey home page Code Monkey logo

laravel-ecs's Introduction

Laravel App Configured to Deploy to ECS Fargate - Managed with AWS CDK

This repo contains all the code necessary to configure AWS infrastructure to run autoscaling containerised applications using AWS ECS. Specifically it leverages the Fargate Service for pay as you go autoscaling. Everything related to configuring infrastructure via AWS CDK can be found in cdk/lib/cdk-stack.ts

Architecture Overview

For the sake of example, a Laravel application is what has been packaged up for deployment on our infrastructure. This uses a black Laravel 8.4 installation. The only change made is in routes/api where I have added a health-check route for the load balancer

Route::get('/health-check', function () {
    return response('OK', 200);
});

Deployments with CDK

You'll need to install the CDK CLI

npm install -g aws-cdk

Then you'll need to make sure you have AWS Credentials configured on the host machine.

Useful commands

To be run from the /cdk directory

  • cdk bootstrap you will need to bootstrap some CDK assets the first time you deploy
  • cdk deploy deploy this stack to your default AWS account/region
  • cdk diff compare deployed stack with current state
  • cdk synth emits the synthesized CloudFormation template

Note: Deploying this infrastructure WILL incur charges in your AWS account. The following infrastructure costs roughly $100-150 USD/month to maintain on AWS.

Code Use

This code is provided as is without warranty. Feel free to use any of the Docker config, or CDK code for your own projects.

Learn More

If you want to learn more about how this works, you can check out my short course on Gumroad. It will cover everything referenced in the CDK stack in under 90 minutes.

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.