Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Overview

AWS ECS Fargate is a serverless compute engine provided by Amazon Web Services (AWS) that simplifies the deployment and management of containerized applications. It eliminates the need for managing the underlying infrastructure, allowing you to focus on application logic while AWS handles provisioning, scaling, and maintenance of compute resources.

...

Components Required for Running KnowHOW on ECS

Terraform Script -

View file
nameknowhow-terraform-scripts.zip

Expand
title1. Infrastructure
  • VPC (Virtual Private Cloud): A logically isolated section of the AWS cloud where resources are launched. Configure IP address ranges, subnets, and route tables.

  • Subnets: Subdivisions of a VPC, typically created in different Availability Zones for high availability.

  • Internet Gateway: Enables communication between VPC instances and the internet.

  • Route Table: Defines rules for directing network traffic within the VPC.

  • Route Table Association: Links subnets to route tables to use defined routes.

Expand
title2. Platform
  • ECS Cluster: A logical grouping of container instances for managing containers as a single unit.

  • ALB (Application Load Balancer): Distributes incoming application traffic across multiple targets.

  • NLB (Network Load Balancer): Routes TCP/UDP traffic at the transport layer (Layer 4).

  • ALB Listener: Processes connection requests and forwards them to target groups.

  • ALB Listener Rules: Define routing based on conditions like URL paths or hostnames.

  • Target Group: A collection of resources serving traffic together.

  • Security Group: A virtual firewall controlling inbound and outbound traffic.

Expand
title3. Application
  • ECS Task Definition: A blueprint for containers defining parameters like Docker images, CPU/memory requirements, and networking settings.

  • ECS Service: Maintains a specified number of running tasks based on task definitions.

  • CloudWatch: Monitors performance and logs metrics.

  • NFS (Network File System): Provides persistent storage for MongoDB data.

  • IAM Role & Policy: Grants permissions for ECS tasks and services to securely access AWS resources.

...

Deploying KnowHOW on ECS Using Terraform Scripts

Expand
titleStep 1: Infrastructure
  1. Navigate to the infrastructure directory:

    Code Block
    cd ecs_fargate/1-Infrastructure
  2. Initialize Terraform:

    Code Block
    terraform init
  3. Apply the configuration:

    Code Block
    terraform apply -auto-approve
Expand
titleStep 2: Platform
  1. Navigate to the platform directory:

    Code Block
    cd ../2-Platform
  2. Replace your SSL certificate ARN and actual IP address in 2-Platform/variable.tf:

    • Line 122: Update SSL_certificate_arn.

    • Line 118: Update with your IP address.

  3. Initialize and apply Terraform:

    Code Block
    terraform init
    terraform apply -auto-approve
Info

Refer to the README.MD file for instructions on uploading the SSL certificate.

Expand
titleStep 3: Application
  1. Navigate to the application directory:

    Code Block
    cd ../3-Application
  2. Update the terraform.tfvars file with the desired KnowHOW version (e.g., 7.2.0).

  3. Initialize and apply Terraform:

    Code Block
    terraform init
    terraform apply -auto-approve

...

Using Existing Services with Terraform

Commenting Existing Resource Blocks

To avoid recreating existing resources, comment out the corresponding resource block in the Terraform configuration. Example:

Code Block
#resource "aws_ecs_cluster" "PSKnowHOW-Cluster" {
#  name = var.ecs_cluster_name
#}

...

Importing Existing Resources

Import existing resources into the Terraform state:

Code Block
terraform import aws_vpc.example_vpc example-vpc

...

Using Outputs

Define outputs in output.tf to share resource information:

Code Block
output "imported_VPC_id" {
  value = aws_vpc.example_vpc.id
}

...

Summary

  • Comment existing resource blocks in Terraform.

  • Use terraform import to manage existing resources.

  • Define outputs for sharing resource details.

This approach ensures seamless integration with existing infrastructure, minimizing the risk of unintended changes.