项目作者: acro5piano

项目描述 :
A dead simple example to setup AWS Fargate using Fargate CLI + Terraform
高级语言: Makefile
项目地址: git://github.com/acro5piano/terraform-fargate-example.git
创建时间: 2020-04-25T08:11:33Z
项目社区:https://github.com/acro5piano/terraform-fargate-example

开源协议:MIT License

下载


Terraform & Fargate example

A dead simple example to setup AWS Fargate using Fargate CLI + Terraform

Features

  • Use Terraform to setup AWS ECS basic environment
  • Use Fargate CLI to create Fargate services without hassle
  • Zero-downtime deploy thanks to Fargate

Why

We can create all of AWS ECS environment with Terraform. However, it requires a lot of Terraform boilerplates and understanding how Terraform works. Instead of copy & paste HCL from the Terraform document, let’s delegate some parts to Fargate CLI.

How to use

Initial Setup

  1. cp aws-credentials.ini.example aws-credentials.ini
  2. # Add your credentials
  3. vim aws-credentials.ini
  4. # Initialize Terraform
  5. make init

Create service

  1. make create

Show information

  1. make info

Deploy service

  1. make deploy

Note: This will build Dockerfile in the current directory. If you have other deploy strategy, edit Makefile.

Delere everything

  1. make destroy

Note: ECS Execution Role will not be deleted.

What will be created?

By Terraform:

  • ECS Cluser
  • EC2 Security Group
  • ECR Repository

By Fargate CLI:

  • ECS Task Definition
  • ECS Service
  • ECS Task
  • ECS Task Execution Role
  • ALB
  • ALB Target Group
  • CloudWatch Log Group