truckpad / ecs-cloudformation

CloudFormation architecture for deploying containerized microservices with Amazon ECS
Apache License 2.0
3 stars 2 forks source link
aws cloudformation ecs yaml

Deploying Microservices with Amazon ECS, AWS CloudFormation, and an Application Load Balancer

This repository (based on the reference architecture located here) provides a set of YAML templates for deploying microservices to Amazon EC2 Container Service (Amazon ECS) with AWS CloudFormation.

TL;DR

If you're in a hurry:

Overview

The repository consists of a set of nested templates that deploy the following:

Template details

The templates below are included in this repository and reference architecture:

Template Description
master-normal.yaml This is the master template for an ECS cluster with On Demand instances - deploy it to CloudFormation and it includes all of the others automatically.
master-spot.yaml This is the master template for an ECS cluster with Spot instances - deploy it to CloudFormation and it includes all of the others automatically.
infrastructure/vpc.yaml This template deploys a VPC with a pair of public and private subnets spread across two Availability Zones. It deploys an Internet gateway, with a default route on the public subnets. It deploys a pair of NAT gateways (one in each zone), and default routes for them in the private subnets.
infrastructure/security-groups.yaml This template contains the security groups required by the entire stack. They are created in a separate nested template, so that they can be referenced by all of the other nested templates.
infrastructure/load-balancers.yaml This template deploys an ALB to the public subnets, which exposes the various ECS services. It is created in in a separate nested template, so that it can be referenced by all of the other nested templates and so that the various ECS services can register with it.
infrastructure/ecs-cluster.yaml This template deploys an ECS cluster to the private subnets using an Auto Scaling group.
services/dd-agent/service.yaml This is an long-running ECS service that monitors your cluster and apps with Datadog.

After the CloudFormation templates have been deployed, the stack outputs contain a link to the load-balanced URLs for each of the deployed microservices.

License

Copyright 2017 TruckPad. All Rights Reserved.

Copyright 2011-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the License. A copy of the License is located at

http://aws.amazon.com/apache2.0/

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.