Skip to content

leonardopliski/terraform-ecs-fargate-spot-instances-traefik

Repository files navigation

Terraform AWS - ECS Fargate Spot Instances, Networking & Traefik

Table of Contents

About The Project

There are many issues involved when creating new project infrastructures.

Here's why:

  • It's difficult to handle projects maintenance when there's no codified infrastructure, you don't know what and how much resources are being used.
  • Cross development gets harder since there's no idea about how the application infrastructure work.
  • The process of manually creating your infrastructure takes so much time.
  • It's difficult to create an infrastructure cost prediction.

Due to these issues, Terraform is an IaC (Infrastructure as Code) tool to automate your setup.

Getting Started

To get your infrastructure up and running follow the steps:

Prerequisites

aws configure
  • Create an AWS Secrets Manager secret to store your AWS secret access key, and grab its ARN.

  • Terraform v0.14.5

  • Check the fixtures.staging.us-west-2.tfvars file variables, and set them according to your environment. Or create one file for another environment :).

Usage

  1. Go to the remote-state folder and initialize your remote state using AWS S3 and DynamoDB. (Optional, but recommended).
terraform init
terraform apply -var-file=../fixtures.staging.us-west-2.tfvars
  1. Install all modules required by this configuration.
cd ../
terraform init
  1. Apply your infrastructure based on environment variables. (Check variables.tf and create a terraform tfstate file if necessary)
terraform apply -var-file=fixtures.staging.us-west-2.tfvars
  1. (Optional) - If you want to estimate your infrastructure costs, so you may generate a terraform plan and analyze it with terraform cost estimation
terraform plan -var-file=fixtures.staging.us-west-2.tfvars  -out=plan.tfplan && terraform show -json plan.tfplan > plan.json

About

Sample Terraform IaC code to create an AWS Fargate cluster with Traefik.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published