GithubHelp home page GithubHelp logo

deltacodepl / aws-terrajet Goto Github PK

View Code? Open in Web Editor NEW

This project forked from christranv/aws-terrajet

0.0 0.0 0.0 2.48 MB

Terraform template built for AWS. Help Developers deploy their monolith application to AWS in the easiest and fastest way ๐Ÿš€

Shell 1.30% JavaScript 0.61% HTML 0.28% Smarty 1.43% HCL 95.70% Dockerfile 0.69%

aws-terrajet's Introduction

Built For Your Monolith

TerraJet follows AWS best practices to help your infrastructure archives reliability, security, performance, and cost optimization. Save your time on researching and deploying. TerraJet provide the easiest way to approach Infrastructure as Code (IaC) frameworks like Terraform.

terraformย  awsย  aws-cliย  dockerย  nodejs

Table of Contents

๐ŸŒฑ Features

  • Support deploying Single-page application (React, Angular, Vue) to S3 and cached by CloudFront.
  • Support deploying SQL database to RDS.
  • Support deploying and automatic scaling Dockerized API to ECS cluster.
  • Enable Role-Based Access Control for API app.
  • Enable spot instance mode in ECS to save computing cost.
  • Provide TLS/SSL certificate with ACM
  • Provide Microservices adaptability for your future growth.

๐Ÿ— Design Diagram

diagram

๐Ÿ“ฆ Provided Modules

These AWS Terraform modules are provided by current version.

Name Description
IAM Identity and Access Management
Policy IAM Policy
VPC Virtual Private Cloud
SecurityGroup Security Group
S3 S3
CloudFront CloudFront
RDS Relational Database Service (RDS)
KeyPair EC2 KeyPair
EC2 EC2
ECR Elastic Container Registry
ECS Elastic Container Service
ELB Elastic Load Balancer
Logs CloudWatch Logs
Route53 Route 53
Route53 Record Route 53 Record
ACM AWS Certificate Manager

๐Ÿ›  Installation

This instruction can be used for all environments with Development (Dev) environment as an example.

  1. Install Terraform, AWS CLI, Docker to your machine.

  2. Create AWS account and bind credit card.

  3. Prepare a domain.

  4. Create IAM user with AdministratorAccess policy and save AWS credentials to local machine with aws-terrajet-dev profile name

  5. Set up environment variables in envs/dev.tf

  6. Create 2 ssh keys for ECS and EC2 bastion

    ssh-keygen -t ed25519 -f ~/.ssh/terrajet_dev_ecs
    ssh-keygen -t ed25519 -f ~/.ssh/terrajet_dev_bastion
    
  7. Clone template.secrets.env.yaml secret template in /secrets folder with name secrets.dev.yaml

  8. Update RDS username, password and public key of 2 ssh keys created above to secrets.dev.yaml

  9. Run terraform init

  10. Run terraform apply, then type 'yes'

  11. Update information of created services in Output section to domain provider and deploy section.

    api_domain = "<your-domain>"
    bastion_dns = "<url>"
    db_endpoint = "<url>"
    ecr_repository_urls = {
    "api" = "<url>"
    }
    route_53_ns = tolist([
    "<ns>",
    "<ns>",
    "<ns>",
    "<ns>",
    ])
    s3_web_app_bucket_name = "terrajet-dev-static-web-app"
    
    1. Update Route53 NS to your domain provider.
    2. Go to /apps folder and update deploy.sh file with above values.
  12. Go to /apps folder and run deploy.sh to deploy API and web app

  13. Access your 'domain' and 'api.domain' URL to check the app is running.

๐Ÿงน Cleanup

  1. Run terraform destroy, then type 'yes'
  2. Delete your AWS account.

๐Ÿ“Œ Extra step for Production

  • Move your Terraform state to safe backend like S3 or Terraform Cloud

โ” FAQ

Q: Why ECS is used for monolith app?

Deploying an app on AWS using EC2 is a commonly used and straightforward approach. However, it can be challenging to maintain and scale, particularly when working with Docker containers. On the other hand, ECS cluster may appear more complex at first glance, but it actually simplifies the process. With ECS, you leave all the container control tasks for it, allowing you to focus on your code.

Q: Why is ECS but not Kubernetes?

Although Kubernetes is popular and strongest for container clusters, but it's not necessary for our regular workload. It's resource-intensive and better suited for large-scale projects with a dedicated DevOps team. ECS is simpler and suitable for small to medium-sized monolithic apps.

aws-terrajet's People

Contributors

christranv 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.